Question

I was trying to do something in visual studio the other day when I realized, if I could just make a form control to do it for me it would be allot easier, except I have no idea how to do that, I want the form control to have grids, each square having its own color property, if anyone knows how to make form controls, or even better knows how to make something like what I just described, I would be very happy :D

Was it helpful?

Solution

This MSDN article is a basic step by step outline of how you can write a customer control. Unfortunatly MS has not figured out how to do avoid link rot -- so you may need to search creating custom winform controls to find this if you come in the future.

You are usually best servered by subclassing an existing control and customizing it.

You might also find some of the freely available winform control projects a gold-mine of useful info if you get serious about this.

However, it sounds likely what you should consider doing is creating a "User Control", this is usually simpler for a composite of few existing controls. This article on the types of controls for winforms may be a useful overview for you.

Beyond that you really should use S/O if you are trying to resolve a specific problem you are having when you are coding. Google is a more appropriate tool for finding tutorials, etc.

OTHER TIPS

1) Inside your project: Solution Explorer --> Right Click the .csproj --> Add UserControl

2) Drag and drop gridBox or any control you want into your custom control.

3) Check the ToolBox, your custom control should be located at the very first selection

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top