|
Thanks again,
I tried setting Empty String for Text property but it does not work. Still tabs are shown with no texts on it. If tab control had a boolean type property like "HideTabsFromGUI", then it could be the perfect solution. Is it possible to implement this by inheriting the tab control ?
Using so many panels in Windows Form and showing one at a time is never an easy task. Because, whatever panel I will intend to show, I will have to programmatically relocate it (Size and Position) in the Windows form and that is not charming at all.
So, I am just thinking only about creating a custom control inheriting from Tab Control. But can you help me to do this ? I mean, how I can hide the tabs ?
Emran
|
|
|
|
|
This has been mentioned many times before on many internet forums.
The only way is to keep your own list of TabPages List<TabPage> and programmatically add/remove them from the TabControl - it's no big deal as you always have the full collection in memory.
Dave
|
|
|
|
|
Emran Hussain wrote: Using so many panels in Windows Form and showing one at a time is never an easy task.
Emran Hussain wrote: programmatically relocate it (Size and Position)
I don't agree: rather than inheriting from something that does not do things the way you want
(basically is too complex), I suggest you build it from simpler things. So make a little class (say
MultiPanel) that inherits from Panel and that holds a List of Panels. All the Panels in the List are
added to the Controls collection of MultiPanel, all same size same location, but only one has
Visible=true;
Now give it some properties:
- a Bounds property, that sets the Bounds of each of the Panels
- a SelectedIndex property, that sets all Panels invisible except the one with the matching index
and some methods, including:
- CreatePanel()
FYI: An invisible Panel does not show its contents, and does not consume events. So the whole thing
behaves like the one Panel that is selected. No more, no less.
And if you want to design your panels with Visual Designer, just make them separate classes,
inheriting from Panel, and add them as per above, except you now need a method AddExistingPanel(Panel).
Hope this helps.
|
|
|
|
|
Thank you sooo much for your suggestion. I am wondering how com Microsoft missed this control from Visual Studio!!
Regards.
|
|
|
|
|
You're welcome.
Emran Hussain wrote: I am wondering how com Microsoft missed this control from Visual Studio!!
Not sure what you mean here.
|
|
|
|
|
I meant, Microsoft could do this work for us, like they did make MultiPage Control for ASP.NET, same type of control they could make for Windows Forms too! As Creating Wizard is very common type application and I am wondeing how the developers are handling this problem ? Are they creating their own custom control as you described !!!
Anyway, thanks for your time again.
Emran
|
|
|
|
|
Emran Hussain,
It sounds like you want to create several controls and then dock them on the form. Each control has a Next/Prev button and when thats clicked, hide the current one, and display the next one.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
I want to update a graph displayed in a Control Panel each time the control button is pressed. How do I pass the updated array values from the control button to the control panel's graph.
|
|
|
|
|
Hi,
A button does not hold any data (unless you hide something in its Tag).
The normal approach is to have your data structured somehow and stored in class members.
Then these data may get operated upon by Controls, such as a Button causing an OpenFileDialog to
appear, and a file being read; and an OnPaint method may read the same data to display something
on the Form or one of its Controls (such as a Panel).
|
|
|
|
|
I have a user control (which for the purposes of this post is just a container), and several nested user controls. I want to lay out the child controls inside the container in a similar way to the following picture:
http://mi6.nu/docking.jpg
I've tried different combinations of Anchor and Dock properties as well as using a Flow Layout Panel, but I can't get it to work.
The two things I know are:
1) The location of each child control on the Y-axis
2) The height of the control
I need some way to assign these controls a combination of properties and have them stack up as shown in the picture. Full width child controls should float to the left, and if there's more than one child control at a Y location (eg: 3 and 4), the available space should be split.
I managed to get it sort of working, but items were overlapping.
|
|
|
|
|
Have you looked at adding a SplitContainer into the mix?
I'm thinking that if you dock one panel on the left side of the form (or control), dock a second panel in the upper-right, a third panel in the bottom right, and place a SplitContainer into an area you leave open between the two panels docked on the right, then you can place your #3 and #4 controls in the split container panels, and not worry about any overlap. You could set the IsSplitterFixed property to True to prevent the user from resizing the split, and make the splitterwidth small enough that it is unseen.
Anyways, that is one idea, I won't be surprised if there are better ideas...
|
|
|
|
|
yep, do it hierarchically, i.e. split your form in two parts (that would be 1 versus 2+3+4+5) using
either a SplitContainer or two Panels; give those the right anchoring.
Then iterate for the next split (5 versus 2+3+4). Etc.
|
|
|
|
|
Thanks for the quick response. I didn't explain myself very well. The number of child controls isn't a fixed value. In the example there are two items with the same Y value, but there may be just one, or four or five.
|
|
|
|
|
I don't know which Control would help you split a distance in N equal parts, N being possibly larger than 2 and not a power of 2.
The way I used to do all these things, before I was even aware of anchoring and SplitContainers, is
by calculating Top, Left, Height and Width myself, by code, in the OnResize handler. Takes some code,
but does exactly what you want with no additional Controls to achieve your layout.
|
|
|
|
|
I still do it the way that Luc mentioned in his post above. It's alot more code but it leaves you in control!
Dave
|
|
|
|
|
Looks like mountains of code it is then.
I always try to avoid excessive code, especially in OnPaint methods, but there are times when it's unavoidable.
|
|
|
|
|
...
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
|
|
|
|
|
I agree. How do we stop the dots...
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Press the stop button.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Well, the best way to do this in the presented situation would be pressing the power button. It'll surely stop what you need.
|
|
|
|
|
Sincerely.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Just power down the computer and walk away
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
|
> ...
&who: ...
&message: "incorrect usage of auxiliary keyword"
&syntax: ...
&trace: #<syntax ...>
|
|
|
|
|
Hi All,
I have an application which displays the fonts in "Segoe UI".
But if I run the same application on another OS on which the font is not available.
It is displaying the font in "Microsoft Sans Serif".
Is there any way to change the default font to "Tahoma" on those machines ?
Thanks in Advance.
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|