Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
How do we use custom controls to create our own controls(tools) like in the vs.net toolbox. If we create a custom control, Can we create a customcontrol by using GDI. Can somebody please help me on how to create our own custom controls by GDI. I've already read about creating buttons in cuatom controls.All I want to know is how to create a complex control like toolstrips,menubars,sliders etc. I'll Thank you in advance. Just please Help me with that. Can somebody post an article and source code or demo project on my doubts above.Thank You...
Posted

1 solution

The minimum you need to create your own controls is a class that inherits from the System.Windows.Forms.Control class. Once you have this, if you build the project, it should appear in the toolbox. If you want to use it in other projects, compile it as a Class Library DLL, then in VS, right click in the Toolbox and select Choose Items, then Browse to your DLL file

Your class will have a Paint event, which you can use to draw whatever you need using GDI+; You can use GDI through P/Invoke if you want though.

Any public properties will show up in the property grid on the form designer.

Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900