Академический Документы
Профессиональный Документы
Культура Документы
i
î
Now we want that the control will have all the Command Button properties.
lets add the BackColor property. Enter the following code to your form:
What we did now is almost the same as we did with the Text property.
The difference is that in the text property we used
a variable (TextVariable) to store the property information.
Here we not using a variable, we read and write the information
directly to the Command1.BackColor property.
î
Public Property Get Enabled() As Boolean
Enabled = Command1.Enabled
End Property
[
[ [
As you see, in some of the properties, we use SET instead of GET.
When you want to change the Command Button Picture property,
you press on the Button with the 3 dots on him that
found in the "Picture" cell (Image 17) , and then browse for your picture.
Image 17:
÷
÷
When we want to set property that uses the browse button, we use SET instead of GET.÷
î
Event KeyDown(KeyCode As Integer, Shift As Integer)
Event KeyUp(KeyCode As Integer, Shift As Integer)
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Private Sub UserControl_Initialize()
End Sub
The code that you will insert to this sub, will run when
the user first place the control on the form on design time,
and on runtime, when the form with the control on it is loaded.
You can browse for other event: At the control's code window,
choose UserControl from the left ComboBox under the title bar,
and choose event with the right ComboBox.
Image 18:
÷
÷
As you probably saw, when you inserted the control to your project,
the control had a default icon on the ToolBox (Image 16) .
To set your own Icon, Add your icon to the control ToolBoxBitmap property.
Image 19:
÷
÷
Some of the controls are invisible at runtime (Like Timer and ImageList).
To set your control to be invisible at runtime,
Set the control InvisibleAtRuntime property to True.
cî
Make an About property, that when the user will
press on the About property cell on the control Properties window,
A message box will show up with your details.
÷
From the 'Name' combo box choose AboutBox,
Click on the Advanced button, and from the 'Procedure ID'
choose AboutBox, and press OK.÷
Now a New property has just been added to your control - the About Property.
The End.