The owner of my company wants to be able to draw lines in Visual Studio.net as he did Visual Basic 6.0. So far the only method I have found is a runtime method using system.drawing which of course only work during runtime, and not quite practical for what he wants to do.
Is there any third party control (free or otherwise) that will give him a button at design time to draw lines?
Use the Visual Basic Powerpack (free, from Microsoft, the makers of VB.Net)
The best way to draw a line in design time is to add PictureBox and set its properties as follows:
BackColor - select the color you want
Size - ex: width=1 height=300
The best option is to draw a label and set its properties as follows:
Clear the Text property.
Set the Autosize property to False.
Set BackColor as reqiured.
Set the Enabled property to False (or else it can be moved at run time).
Use Shift + arrows to resize the label, e.g. Shift+↑ to make a thin line and Shift+← to make a small line.
Related
In Adobe Illustrator and other drawing programs I can group objects so I can move them together, resize them together, or treat them as a single object when I'm doing alignments. Is there a way to do this in Visual Studio 2012? I've seen GroupBox, but that's not what I want because that's a programming object instead of a behavior of the IDE. And how can I make it such that I can, say, keep two controls fixed in position but still align or change the spacing of third a third with respect to them?
In Windows Forms you group controls by dropping them inside the same container. Then moving the container, or disabling it, or hiding it, anything really, also affects every child object too.
Rather than a GroupBox though, I'd recommend a Panel. It's a light weight object who's sole purpose is to just host controls.
I would like to create an extension for visual studio in which some UI behaviors are overridden. I have found many examples of adding UI components to VS, but none where they change them. A very good example of what I want to do is make it so that each tab takes up exactly 50 pixels in width (at the top of the editor window group). Is this possible? If so, what would be a good resource for me?
For your specific example, the Document Tab Well extension inside the Productivity Power Tools pack lets you set minimum and maximum widths for the editor tabs, so you could force it to 50 pixels if you want.
In general, there is no uniform way you can override or replace UI components in Visual Studio. A few components were designed to be easily replaced, while some components cannot be replaced, but many aren't replacable. The general problem with replacing components is it fails the "what if two extensions want to do it test", because it's not clear which replacement wins. Thus most extension points are add-only.
My advice: if you want to replace a specific component, ask a separate question on Stack Overflow and hopefully somebody can chime in on how to customize that particular component.
I am trying decorate code lines with various metrics collected during an execution of a program. In order to do that I use VS extensibility and adornments layer. However it seems to be somewhat unstable and moves relative to the top of the document when the editor is scrolled and thus spoiling the alignment of code and the adornment. Also it is not always initialized in the top of the editor.
So how to anchor theadornment layer added to the code editor in Visual Studio 2010? I add a canvas into it by the folling way:
_adornmentLayer = view.GetAdornmentLayer("CodeAdornment");
_adornmentLayer.RemoveAllAdornments();
Canvas.SetTop(myOwnCanvas, 0);
adornmentLayer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, null, null, myOwnCanvas, null);
I start to have a feeling that it is a bug in the editor layouting.
You might want to make a viewport adornment that will always be on the top of the editor. Otherwise, you might want to use AdornmentPositioningBehavior.TextRelative and give a span for the first line in the document.
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 label, 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.
What shall i use to make a spacer between elements in visual studio like that in QT
http://www.tuxradar.com/files/qt_menq_spacers.jpg
You might be able to use the Margin and Padding properties of any control to that end.
Edit: In response to your comment, I get the impression that your main goal is not to add a certain amount of space between controls (which would be what the Margin and Padding properties are for), but that you want to align controls along certain lines or edges. In Winforms, this is usually done via a combination of panels and the proper use of a control's Anchor and Dock properties.
You can use Anchor property to position controls relative to the dialogs edges.
And you can use a couple of panels to separate controls into different areas.
But I don´t think there is some thing like the spacers you mentioned in the question.