ActiveX

Листинг для Урока 10 (продолжение)

ActiveX Control "FigureControl"

Property Page: ppFigureControl

'*****************************************************************
'Урок 10

'ActiveX Control - "FigureControl"

'Листинг

'*****************************************************************
Option Explicit

 

Private bSelected As Boolean

 

Private Sub cboGradientOrientation_Click()

    If Not bSelected Then Changed = True

End Sub

 

Private Sub chkBlue_Click()

    scrBlue.Enabled = Not (-1 * chkBlue.Value)

    If chkBlue.Value = 1 Then

        lblBlue.Caption = -1

    Else

        lblBlue.Caption = scrBlue.Value

    End If

    If Not bSelected Then Changed = True

End Sub

 

Private Sub chkGreen_Click()

    scrGreen.Enabled = Not (-1 * chkGreen.Value)

    If chkGreen.Value = 1 Then

        lblGreen.Caption = -1

    Else

        lblGreen.Caption = scrGreen.Value

    End If

    If Not bSelected Then Changed = True

End Sub

 

Private Sub chkRed_Click()

    scrRed.Enabled = Not (-1 * chkRed.Value)

    If chkRed.Value = 1 Then

        lblRed.Caption = -1

    Else

        lblRed.Caption = scrRed.Value

    End If

    If Not bSelected Then Changed = True

End Sub

 

Private Sub scrBlue_Change()

    lblBlue.Caption = scrBlue.Value

    If Not bSelected Then Changed = True

End Sub

 

Private Sub scrGreen_Change()

    lblGreen.Caption = scrGreen.Value

    If Not bSelected Then Changed = True

End Sub

 

Private Sub scrRed_Change()

    lblRed.Caption = scrRed.Value

    If Not bSelected Then Changed = True

End Sub

 

Private Sub chkGradient_Click()

    If Not bSelected Then Changed = True

End Sub

 

Private Sub txtBorderThickness_Change()

    If Not bSelected Then Changed = True

End Sub

 

Private Sub txtCaption_Change()

    If Not bSelected Then Changed = True

End Sub

 

Private Sub PropertyPage_ApplyChanges()

    SelectedControls(0).GradientBlue = lblBlue.Caption

    SelectedControls(0).GradientGreen = lblGreen.Caption

    SelectedControls(0).GradientRed = lblRed.Caption

    SelectedControls(0).Gradient = (chkGradient.Value = vbChecked)

    SelectedControls(0).GradientOrientation = cboGradientOrientation.ListIndex

    SelectedControls(0).Caption = txtCaption.Text

    SelectedControls(0).BorderThickness = txtBorderThickness.Text

End Sub

 

Private Sub PropertyPage_SelectionChanged()

    bSelected = True

 

    Select Case SelectedControls(0).GradientBlue

    Case -1

        chkBlue.Value = 1

    Case Else

        chkBlue.Value = 0

        scrBlue.Value = SelectedControls(0).GradientBlue

    End Select

    Select Case SelectedControls(0).GradientGreen

    Case -1

        chkGreen.Value = 1

    Case Else

        chkGreen.Value = 0

        scrGreen.Value = SelectedControls(0).GradientGreen

    End Select

    Select Case SelectedControls(0).GradientRed

    Case -1

        chkRed.Value = 1

    Case Else

        chkRed.Value = 0

        scrRed.Value = SelectedControls(0).GradientRed

    End Select

       

    chkGradient.Value = (SelectedControls(0).Gradient And vbChecked)

    cboGradientOrientation.ListIndex = SelectedControls(0).GradientOrientation

    txtCaption.Text = SelectedControls(0).Caption

    txtBorderThickness.Text = SelectedControls(0).BorderThickness

 

    bSelected = False

End Sub

 

К статье

Hosted by uCoz