You can use graphics methods, such as Circle and Line, to draw your control, or you can create your control’s appearance using existing ActiveX controls and Visual Basic intrinsic controls. Controls you add to the UserControl to create its appearance are called constituent controls.
As its name suggests, ShapeLabel’s appearance is created using a Shape control and a Label control.
Note This topic is part of a series that walks you through creating a sample ActiveX control. It begins with the topic Creating an ActiveX Control.
To add constituent controls to the ShapeLabel control
Property | Value |
BorderStyle | 0 - Transparent |
FillColor | &H000000FF (Red) |
FillStyle | 0 - Solid |
Name | shpBack |
Shape | 2 - Oval |
Note To set color properties such as FillColor and ForeColor to specific colors, select the Palette tab of the color selection dialog.
Property | Value |
Alignment | 2 - Center |
BackStyle | 0 - Transparent |
ForeColor | &H00FFFFFF (White) |
Name | lblCaption |
Private Sub UserControl_Resize()
' Size the Shape control to fill ShapeLabel's
' visible surface area.
shpBack.Move 0, 0, ScaleWidth, ScaleHeight
' Center the Label control vertically, and
' make it the same width as ShapeLabel.
lblCaption.Move 0, (ScaleHeight _
- lblCaption.Height) / 2, ScaleWidth
End Sub
For More Information See "Drawing Your Control" in "Building ActiveX Controls."
This topic is part of a series that walks you through creating a sample ActiveX control.
To | See |
Go to the next step | Saving the ShapeLabel Control's Property Values |
Start from the beginning | Creating an ActiveX Control |