Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i draw a line on a form?

in vb.net i would like to draw a regular line on a form. is there a control to do this?

like image 674
Alex Gordon Avatar asked Jul 16 '09 12:07

Alex Gordon


People also ask

How do you draw lines on a drawing?

Click and drag to draw, then release the mouse button to cement the shape. You can click and drag the line around after it's cemented. To delete a line, click it to select it and then press the Delete key. Add more lines.

Is there a way to draw lines in a userform?

VBA userforms do not have a builtin shape control for drawing lines or circles. You can mimic vertical and horizontal lines by using a label with no caption and a value of 1 for the width or height. I have an example file for using autoshape displayed as images which allows for a more rich drawing experience. Maybe this is something you could use.

How do I draw on a form?

Typically, when you draw on a form, you handle the form’s Paint event and perform the drawing using the Graphics property of the PaintEventArgs, as shown in this example The preceding example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler.

How do I add a line shape to a form?

However, if you want to have a visual control that you can drag on to a form, add the Microsoft.VisualBasic.PowerPack to your visual studio toolbox. To do that right-click on toolbox select "Choose Items...". Locate "Line Shape" on the .Net Framework Components tab.


1 Answers

What Mitch Wheat said is generally regarded as the correct answer, and what I have done in the past. However, if you want to have a visual control that you can drag on to a form, add the Microsoft.VisualBasic.PowerPack to your visual studio toolbox. To do that right-click on toolbox select "Choose Items...". Locate "Line Shape" on the .Net Framework Components tab.

like image 164
Mosquito Mike Avatar answered Oct 21 '22 03:10

Mosquito Mike