[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

UI Design

Posted on 2006-04-12
5
Medium Priority
?
233 Views
Last Modified: 2010-04-23
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)
0
Comment
Question by:tyy8
5 Comments
 
LVL 2

Expert Comment

by:FIIS-VSO
ID: 16439672
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
 
LVL 2

Expert Comment

by:FIIS-VSO
ID: 16439717
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
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 150 total points
ID: 16440214
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
 

Expert Comment

by:Vis781
ID: 16445370
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
 

Author Comment

by:tyy8
ID: 16446965
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question