A Frame with rounded corners

Simply place 2 Shapes and one Label in the form and name them Shape1, Shape2 and Label1. Shape1 will end up being your Frame so you can locate it and resize it accordingly. Shape2 can be sized as small as possible and moved to a location out of the way from other controls since it will be resized and relocated to follow Shape1. Paste the following code in the code area of your form and run the program. You could also turn it into a user control for better maintenance.

Private Sub Form_Load()
SetNewShape
End Sub
Private Sub SetNewShape()
With Shape1
    .BackColor = &H8000000F
    .BackStyle = 0
    .BorderColor = &H8000000C
    .BorderStyle = 1
    .BorderWidth = 1
    .FillStyle = 1
    .Shape = 4
    .ZOrder
End With
With Shape2
    .BackColor = &H8000000F
    .BackStyle = 1
    .BorderColor = &H80000009 'white for contrast
    .BorderStyle = 1
    .BorderWidth = 1
    .FillStyle = 1
    .Shape = 4
    .Height = Shape1.Height
    .Left = Shape1.Left + 20 'move to the left
    .Top = Shape1.Top + 20 'move down
    .Width = Shape1.Width
End With
With Label1
    .AutoSize = True
    .Alignment = 2
    .Width = Label1.Width + 110
    .Left = Shape1.Left + 350
    .Top = Shape1.Top - 110
    .ZOrder
End With
End Sub

You might also like...

Comments

Ricardo Buccianti

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++ : Where friends have access to your private members.” - Gavin Russell Baker