开发者

Displaying Ruler in visual studio 2010

Is there any way to display ruler or scale in visual studio designer mode? Actually I want a scale that will measure the vertical and horizontal space between the components (eg la开发者_运维问答bel, text box) and distance of those components from the form body. The scale or ruler will help to show the components with equal horizontal and vertical space in each form.


If I correctly understood, you need to control the distance of the components in a Window(Winforms). For this, you can create a control class, this class will check the distances between components in your window and establish rules of location for each component on run time. For control each component you can use this:

For Each ctrl As Control In Me.Controls
    If TypeName(ctrl) = "TextBox" Then
        If Not ctrl.Width = 0 Then
            MsgBox(ctrl.Name)
            'Do Something
        End If
    End If
Next

This rules of location can be applied on your window "load" event

You can learn more about location of component through this links:

https://msdn.microsoft.com/en-us/library/system.windows.forms.control.location(v=vs.110).aspx

Changing the location of a control on a windows form programatically using VB.net?

PS. You can see I use vb,net language examples but this can be easily converted to C# or other language.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜