SRL Archive - C#/Visual Basic Help and Tutorials

Visual Basic Visual Styles Help


gimillii1592

2008-11-24 10:17:51

Hello, I am relatively new to Visual Basic, and I was wondering how you changed the visual style of a Visual Basic program (like the theme).
Here is a picture:


How do I change the blue area on the top and the buttons on the window to a different theme?
Thank you.

Laimonas171

2008-12-17 16:11:29

include source please. i watch what i can do 4u :)

Bad Processor

2009-01-31 11:23:46

EDIT: BUMPED! I just realised, oops.
Hmm, okay, I think I can help here.

1. Change your BorderStyle to 0 - None.
2. Copy and paste this into the top of your form code. (Put any API calls in-between option explicit and the subs)

Option Explicit
Dim XPos As Long, YPos As Long

Private Sub TopBar_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
XPos = X
YPos = Y
End Sub

Private Sub TopBar_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Me.Left = Me.Left - (XPos - X)
Me.Top = Me.Top - (YPos - Y)
End If
End Sub
3. Create any object that you want the user to drag to move the form. Name this TopBar.
4. Create buttons or whatever, whereever you want for the X (close) and _ (minimize) buttons. Maximizing your form makes it look odd, so I'll leave that out.
5. On the Close button code, type in
Unload Me
6. On the minimize button code, type in
Me.WindowState = vbMinimized
7. Make sure the boolean ShowInTaskbar is set to true.

There you go, a fully working, custom, border!

Note: If you want professional X and _ icons on your close and minimize buttons, follow this:
1. Change the button font to Marlett, not bold, any size.
2. If the button is a close button, type in r. If it is minimize, type in 0 (zero). Make sure the r is not capital.

Or of course, you could try the vbSkinner control that costs money. The free version only has one skin :(

So, that's all my help. This is for VB6 btw, not VB.NET


– BP

pinoyid0l

2009-01-31 23:42:54

If you really want to make it anything you like, just remove the the border. Use pictures (just like what websites do) in place of system buttons and borders.




-my eyes hurt with VB6 interfaces…