Create composite control?

ManicCW

Well-known member
Joined
Jul 21, 2005
Messages
428
Location
Mostar
Programming Experience
Beginner
Hi, I want to create custom control that is composed from several simple controls like panel, listobx, button and so on. How to create this? Any links and tutorials will do. Tnx.
 
Creating the control will be relatively easy, the hard bit is making to do what you want it to do, and how complicated this control will be. As for creating in, just create a new user control and drop the 3 items onto the design surface. I can't help but feel that i havent quite understood what you are asking exactly, if i've mis interpreted the i apologise and could you post back with a slightly more detailed description of what you are trying to do.
 
So if i'm understanding correctly, you want to create a new type of control, that incorporates the elemnts you have described above. so for example you would drop this control onto a form and you would see a panel with list box inside it and also a button? Have i got that right? without seeing a picture of what yuo want it too look like or what functionality you want it to provide it's difficult to know how to advice you best. Are you fluent with GDI+? Also do you understand how to use attributes? Just so i know at what level you are starting from
 
Thats quite complex, but i believe you want to start with your control class. Then you will need to add a couple of other nested classes, one for each listbox and the comboboxes. Create instances of the nested classes inside you control class. Then depending on what sort of functionality you want to provide, you will need to override the WndProc in the nested class and post any messages that are relavent to your controls functionality. Its a start and without looking into it for some time i can't be sure. The object model for a control like that is fairly complex. But give me some time and i'll try to come up with a outline for you.
 
Reinventing the wheel for complex existing controls with GDI+ sounds like waste of time to me. When you create a Class Library project a dll file is built when you compile it. You can add a user control to this class library project, or several user controls if you wish. This Dll can be added to toolbox in other projects (without any sources exposed) and all the usercontrols inside will list in the components list for the user to add to form.
 
Back
Top