Windows Develop Bookmark and Share   
 index > Windows Forms General > Allow designer to add to panels of a custom user control
 

Allow designer to add to panels of a custom user control

So I've created a User Control that has a SplitPanel with a TabControl within the second panel. At design time I want developers to be able to add tabs to the TabControl and other components to those tabs as well as add other components to the first panel of the SplitPanel. How would I accomplish this? This is only my first attempt at a User Control (I'm working on this concurrently with another Control that is essential a FourWaySplitPanel split horizontally and vertically).
  • Moved byOmegaManMVPWednesday, August 26, 2009 7:22 PM (From:Visual C# General)
  •  
jcarreer  Wednesday, August 26, 2009 4:14 PM
This is an amazingly difficult task.

If you have a User Control with multiple controls in it (called a composite control), then the User Control does not have any of the properties, methods, or events of the controls within it. You have to expose them with your own code.

This is not true if you create a User Control that inherits from a single control because the properties, methods, and events are accessible by way of inheritance.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Wednesday, August 26, 2009 7:41 PM
Perhaps I miss-phrased the statement of my task, I found the solution to be quite simple by looking at this post (simple for me - MS must have evil wizards working for them to create such magical design software). However I have only implemented this for the "blank" panel of the my User Control and not for the TabControl that resides in the other panel. I imagine that I need to expose its tab collection or the entire TabControl itself in my user class and do something similar to what I did for the "blank" panel. BTW this is all in an attempt to mimic the nice minimizing tab bars in VS that hold the Solution Explorer and Properties editor (oh and dont talk to me about WPF - I'd like to use it but I'm not allowed, long story). Thanks for you answer though Deborahk and if you have any insights that might be useful feel free to let me know!
jcarreer  Thursday, August 27, 2009 6:14 PM
Alright it does seem that enabling the designer for sub panels of a composite control is easy, but as far as enabling designer support for gridControl Ive run into a bit of a wall.
jcarreer  Friday, August 28, 2009 4:08 PM
Trying to bump this DeborahK, if I did want to expose the methods needed to allow a designer to add new tabs to a composite control that I have created, what would those be? And would it be as simple as adding those methods to my control and then just calling them on the internal control that is already a member variable of my new control?
  • Edited byjcarreer Tuesday, September 15, 2009 7:33 PMMust have written it while drunk my grammar was terrible.
  •  
jcarreer  Monday, September 14, 2009 3:39 PM
I have never successfully accomplished what you are asking ... so I don't know the answer.

Hope someone else here can help you ...


www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Monday, September 14, 2009 7:28 PM
I'm taking the approach of now extending something I call "PinTabs" which has the basic behavior of changing a title bar, auto-minimizing and hiding the second pannel in the SplitContainer but contains no tabs in the TabController. In the extension I add the tabs to the tab controller - this seems to work even if it doesn't seem intuitive to another developer. The weirdest thing is that I in my previous attempt to create this control I exposed the TabCollection of the TabController in my composite control in order to allow me to add tabs in the designer - and this worked: I could add tabs and add elements to those tabs from the designer but when I compiled the project the TabController contained a duplicate of every tab and none of the tabs had the sub elements I added, which is weird. Anyway thanks for the help.
jcarreer  Tuesday, September 15, 2009 7:50 PM

You can use google to search for other answers

Custom Search

More Threads

• ToolStripTextBox Passwords?
• Multiple Status Listeners for a BackgroundWorker
• XML Document read write with VB.NET iusing datasets
• Activex form error
• Timer
• VB.NET - User input ????? Please help
• Html edit in windows forms
• Listbox Display Cut Off By GroupBox Boundary.
• Resize vs. SizeChanged
• Centering called forms