Link to home
Start Free TrialLog in
Avatar of tyy8
tyy8

asked on

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)
Avatar of FIIS-VSO
FIIS-VSO

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
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
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Avatar of tyy8

ASKER

Thanks everyone. The line control is in the VB6.0 toolbox - I just can't imagine why they got rid of it in .NET