views:

80

answers:

2

Hi,

I have the following programming task (Visual Studio .net - no web application) where I wonder if there is maybe some sort of custom control (Third Party?), which could be useful:

There is a rectangular layout and it should be possible to create and move around rectangular buttons. The user should be able to create button and adjust properties like color, picture, set a text etc on the user level. It should also be possible to set custom properties for a button. Ideally it should be possible to align buttons on a grid, muti-select, etc.

Does anyone know if I have to create that from scratch or is there something that makes my live easier..

Thanks

+1  A: 

Simple example of moving a standard button around based on mouse position here.

You can create controls that inherit from existing controls to make life easier. Check this out from MSDN

As for moving controls and such around on the form, you can create events that override and trap the mouse down event and actually change the location values (x,y) based on mouse movement. You can also interact with any of the other properties as well based on mouse movement or color change and text value....

For example, if i want to change the button color on mouse over. I would override the mouse over method of my custom control that inherits from the button. I will set the color in this method when its trapped.

You can even override onPaint and handle all the drawing yourself.

gmcalab
+2  A: 

If you are using WinForms, you might want to look at the DesignSurface, which allows you to add a designer surface to your app... you can move buttons around like the Visual Studio designer. Check it out :

http://msdn.microsoft.com/en-us/magazine/cc163634.aspx

Brian Genisio