C#: How can I move my controls on a win form in windows application freely?
C#: How can I move my controls on a win form in windows application freely?
I do 开发者_StackOverflowNOT want IDE control the position of my controls for me.
Thank you
Visual Studio tries to help you align your controls by "snapping" them to an alignment line (e.g. left of another control, right of another control, a short distance from another control or the form edge etc.), so this might be what you experience as not being able to move your controls freely?
If this is the case, you can fine-tune the position by using the arrows on your keyboard. Move the control approximately where you want it with your mouse, and then use the keyboard for the final adjustment.
Do you mean at runtime dragging the controls around?
If so: you have to check when the mouse is clicked, find the control, and move it around on drag as long as the button is clicked.
it seems u r looking for similar implementation as in visual studio forms designer. system.design assembly defines DesignSurface that can certainly do what u need. check this out.
http://www.codeproject.com/KB/cs/DesignSurfaceExtended.aspx
精彩评论