How do I draw a menuline

Irotallic
04-02-2003, 04:11 AM
This is a very stupid question, but I will ask it... I am searching for a way to make a line on my form, just like the line under your menu's or the lines of an frame. With the linetool I can't get it fixed :confused: I think it's very easy, but I can't figure it out. Any idea?

Flyguy
04-02-2003, 06:56 AM
Just use 2 lines.
The code I used in a project with a Toolbar

Line2.Y1 = Toolbar1.Height + Screen.TwipsPerPixelY
Line2.Y2 = Line2.Y1
Line1.Y1 = Line2.Y1 + Screen.TwipsPerPixelY
Line1.Y2 = Line1.Y1

Line colors: Button Hightlight & Button Shadow

Irotallic
04-02-2003, 08:09 AM
Thanks Flyguy, this looks good. Until know I used a frame with no caption, wich height = 25. It looks almost as the line I wanted, but you saw some very little pixels on both sides. Your little piece off code works fine :)

Flyguy
04-02-2003, 09:18 AM
You can use a frame too.

With Frame1
.Left = -5 * Screen.TwipsPerPixelX ' So the edges are not visible
.Width = Me.Width + 10 * Screen.TwipsPerPixelX
.Height = Screen.TwipsPerPixelY * 2 ' or 1, you have to test it
End With

Squirm
04-02-2003, 09:29 AM
You can also use the DrawEdge function.

Irotallic
04-03-2003, 01:31 AM
Flyguy:

Well, I used the two lines first and thought it worked good, but sometimes it behaves very strange.

If you exactly want to see what line I want to make: look at the upper line of the options screen of Microsoft Word. As you see, the line is at the back of a label. So I set the X co÷rdinats of the line to Label1.Left + Label1.Width + 10. You would say that the line would get at the back of the label, but in fact the line is over the whole form :confused:

Then I tried the option off the frame. That's the best solution until now, because I can set the position as I want to. But as you suscribed in your reply, the line will be drawn outside on the right of the form. (it has to be inside, that looks better) When I change the code that the frame is inside the form, the pixel on the left isn't there, but the pixel on the right is. Could I change the code to get rid of that pixel on the right?

Squirm:
Could be I doing something wrong, but I can't create a line like I want with that function :( If this function can d the trick, could you explain a little more about how to do it...

Hope you both can help me, for this stupid 'simple problem' :)

Thanks

Irotallic

Flyguy
04-03-2003, 02:08 AM
I don't think I understand what you want to do.
Nevertheless have a look at this link:
http://www.mvps.org/vbnet/index.html?code/forms/menuunderline.htm

Irotallic
04-03-2003, 02:19 AM
Hmm, I can't find the right words in english, but i'll try to be a litlle more clear. Let's say I have an completly empty form. The formwidth would be 400 for example. What I wan't to do is that the line would be in the middle of the screen with a lenght of let's say 200. Both edges will be visible then. The pixel on the left of the frame isn't visible, but the pixel on the right of the frame still is. How can I get rid of that pixel?

Hope you're understanding what I want to achieve now :)

Irotallic
04-03-2003, 02:28 AM
Meaybe it has to do somthing with that I draw the line on top of an SSTab control? Just suggesting :)

Flyguy
04-03-2003, 05:50 AM
Meaybe it has to do somthing with that I draw the line on top of an SSTab control? Just suggesting :)

Based on the PM you sent me I created a small sample program.
I used the TabStrip control and not the the SSTAB, but the general idea will be the same.

Irotallic
04-03-2003, 06:22 AM
Great work Flyguy, it looks very nice now :) I am still using the SSTab, but I put a picturebox on it, like you did on the TabStrip. I think that did the trick.

Thanks a lot!!

Irotallic

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum