The standard shape controls do not have this capability. You need to explore the DrawEdge API function which can draw a variety of borders.
You can draw on the form or picture box. Or you can write a small user control if you are going to use it frequently.
See the example here. The following code goes in the form.
___
[tt]
Private Declare Function DrawEdge Lib "user32" (ByVal hdc As Long, qrc As RECT, ByVal Edge As Long, ByVal grfFlags As Long) As Long
Const BF_RECT = 15
Enum Borders
RaisedSingle = 1
RaisedDouble = 5
SunkenSingle = 2
SunkenDouble = 10
Bump = 9
Etched = 6
End Enum
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Const DT_VCENTER = &H4
Const DT_CENTER = &H1
Const DT_SINGLELINE = &H20
Private Sub Form_Load()
WindowState = vbMaximized
AutoRedraw = True
Dim rc As RECT
rc.Left = 100
rc.Right = 200
Dim N As Long
rc.Top = rc.Top + 50
rc.Bottom = rc.Top + 30
DrawTextInRect "Bump", Bump, rc
End Sub
Private Sub DrawTextInRect(Text As String, Edge As Borders, rc As RECT)
DrawEdge hdc, rc, Edge, BF_RECT
DrawText hdc, Text, Len(Text), rc, DT_CENTER Or DT_VCENTER Or DT_SINGLELINE
End Sub[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.