UI Design

I want to draw out a few lines on a form at design time (like being in MS Paint or something). But the toolbox doesn't seem to have such an object in it, is there a com object I can import? if not that, can you draw an HTML table on a form object (that would achieve the same thing that I'm after)
tyy8Asked:
Who is Participating?
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
Amazingly enough...there are no static built-in line controls for you to use on your forms in the .Net Framework:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vxconChangesToLineControlInVisualBasicNET.asp

Some options:

   (1) Draw them at design time using the Paint() event of your form and the graphics supplied in the "e" parameter.

   (2) Add a Label to your form and set its height to 1 in the Size() property.  Change the BorderStyle to FixedSingle.  It's a pain to move the Label around though!

   (3) Do a Google search for "VB.Net Line Control"....

   (4) Write your own UserControl that is a line...
0
 
FIIS-VSOCommented:
Well, I know there are several drawing functions built into VB .NET. As far as I know there aren't any MS-Paint style 'objects' you can import...

-----------------------------------------------------------
>> In order to use the built in drawing features, first create a graphics object:

Dim yourGraphicObj As Graphics = CreateGraphics()

>> You can then use that object to draw several shapes:

yourGraphicObj.DrawLine(New Pen(Drawing.Color.Red), 0, 0, 100, 100)

>> Play around with the functions and settings...

Hope that helps!

-FIIS
0
 
FIIS-VSOCommented:
Concerning your question about HTML forms, I don't think you can draw an HTML form on the VB form object itself, although you can create a Windows webpage object and open a predefined HTML form in it:

>> Just right-click in your Toolbox when in design view and click "Add/Remove Items..."
>> Next, click the "COM Components" tab in the window that pops up. (It'll take a while to load...)
>> Then scroll down and check the "Microsoft Web Browser" box and click OK

Now you'll have a new "Microsoft Web Browser" object available in your toolbox. With it, you can add any size browser object to your form and tell it to load a certain HTML page which contains your HTML form.

-FIIS
0
 
Vis781Commented:
In my opinion a custom line control would be most appropriate here. A quick guide on how to do it..

Add a few properties to hold the values for the different colors, i.e gradients etc
You can go as wild as you like with properties, and i guarentee that your new line control will be vastly more flexible than the old vb6 one
Ovveride the onpaint event.
And put something like this...

Dim P1 as new pen(color.black,1)
e.graphics.drawline(me.left,me.height/2,me.right,me.height/2)
p1.dispose
0
 
tyy8Author Commented:
Thanks everyone. The line control is in the VB6.0 toolbox - I just can't imagine why they got rid of it in .NET
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.