Tutorials on how to create composite controls in Windows Forms?
Anyone knows any tutorials with this topic?
开发者_开发技巧I searched the net but I see mostly asp.net controls, not winforms.
Try the WinForm Custom Controls section on CodeProject for many source code samples.
This one looks pretty 'how-to' oriented:
Write Your Own Bar Chart Winforms User Control
You might get more results if you search for 'UserControl' as you'll likely want to derive your custom/composite controls from that.
Typically, I'll place several controls on a UserControl, and expose only the methods and properties I need for the programmer to use it. A good example of such a control I made was a digital clock, where each digit was itself a custom control (which was actually a picturebox, coupled with some controlling logic). Then, I was able to drag n drop this control wherever I needed it.
Here's one tutorial you might find handy.
As an aside, when I did my google search, I used the following:
c# UserControl tutorial -asp
which ignored a lot of the ASP tutorials you were mentioning. It does seem that ASP programmers use a lot of these user controls!
精彩评论