Visual Basic 6. Руководство разработчика


         

Скелет элемента управления ActiveX


Перед добавлением кода следует изучить, что именно сделал мастер. Переклю­читесь в окно Project Explorer и выполните двойной щелчок на имени созданного элемента управления, чтобы открыть режим разработки Затем выполните двойной щелчок на форме элемента UserControl, чтобы открыть окно с кодом и просмотреть строки, вставленные мастером.

Программа 16.2. ActiveX Control

Private m_Caption As String

Private m_Effect As Integer

Private m TextAlignment As Integer

' Значения свойств по умолчанию:

Const m_def_Caption = "3D Label"

Const m_def_Effect = 2

Const m_def_TextAlignment = 4

' Переменные свойств:

' Объявления событий:

Event DblClick()

Event Click()

Event KeyUp(KeyCode As Integer, Shift As Integer)

Event KeyPress(KeyAscii As Integer)

Event KeyDown(KeyCode As Integer, Shift As Integer)

Event MouseUp(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 OLEStartDrag(Data As DataObject, AllowedEffects As Long)

Event OLESetData(Data As DataObject, DataFormat As Integer)

Event OLEGiveFeedback(Effect As Long, DefaultCursors As    Boolean)

Event OLEDragOver(Data As DataObject, Effect As Long, _

     Button As Integer, Shift As Integer, X As Single, _

     Y As Single, State As Integer)

Event OLEDragDrop(Data As DataObject, Effect As Long, _

Button As Integer, Shift As Integer, X As Single, _

Y As Single)

Event Resize ()

Public Property Get Font() As Font

Set Font = UserControl.Font

End Property

Public Property Set Font(ByVal New_Font As Font)

Set UserControl.Font = New_Font

PropertyChanged "Font"

End Property

Public Property Get BorderStyle() As Integer

BorderStyle = UserControl.BorderStyle

End Property

Public Property Let BorderStyle(ByVal New_BorderStyle As Integer)

UserControl.BorderStyle() = New_BorderStyle

PropertyChanged "BorderStyle"

End Property

Public Property Get BackStyle() As BackgroundStyle




Содержание  Назад  Вперед