vbAccelerator - Contents of code file: frmCustomiseSkin.frm
VERSION 5.00
Begin VB.Form frmCustomiseSkin
BorderStyle = 3 'Fixed Dialog
Caption = "Customise Skin"
ClientHeight = 6360
ClientLeft = 2925
ClientTop = 2730
ClientWidth = 5775
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6360
ScaleWidth = 5775
ShowInTaskbar = 0 'False
Begin VB.CheckBox chkAdjustRGB
Height = 315
Left = 420
TabIndex = 16
Top = 3960
Width = 255
End
Begin VB.CheckBox chkColourise
Height = 315
Left = 480
TabIndex = 15
Top = 2640
Width = 255
End
Begin VB.PictureBox picSample
AutoRedraw = -1 'True
BorderStyle = 0 'None
Height = 2115
Left = 480
ScaleHeight = 2115
ScaleWidth = 4635
TabIndex = 14
Top = 420
Width = 4635
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "Cancel"
Default = -1 'True
Height = 435
Left = 3960
TabIndex = 13
Top = 5460
Width = 1155
End
Begin VB.CommandButton cmdOk
Caption = "OK"
Height = 435
Left = 2760
TabIndex = 10
Top = 5460
Width = 1155
End
Begin VB.HScrollBar hscSaturation
Enabled = 0 'False
Height = 255
LargeChange = 10
Left = 1380
Max = 100
TabIndex = 7
Top = 3360
Value = 50
Width = 3735
End
Begin VB.HScrollBar hscHue
Enabled = 0 'False
Height = 255
LargeChange = 10
Left = 1380
Max = 600
TabIndex = 6
Top = 3000
Value = 100
Width = 3735
End
Begin VB.HScrollBar hscBlue
Enabled = 0 'False
Height = 255
LargeChange = 10
Left = 1380
Max = 200
TabIndex = 2
Top = 5100
Value = 100
Width = 3735
End
Begin VB.HScrollBar hscGreen
Enabled = 0 'False
Height = 255
LargeChange = 10
Left = 1380
Max = 200
TabIndex = 1
Top = 4740
Value = 100
Width = 3735
End
Begin VB.HScrollBar hscRed
Enabled = 0 'False
Height = 255
LargeChange = 10
Left = 1380
Max = 200
TabIndex = 0
Top = 4380
Value = 100
Width = 3735
End
Begin VB.Label lblInfo
Caption = "Sample:"
Height = 255
Index = 7
Left = 480
TabIndex = 17
Top = 120
Width = 4635
End
Begin VB.Label lblInfo
Caption = "&Colourise"
Height = 255
Index = 6
Left = 780
TabIndex = 12
Top = 2700
Width = 4275
End
Begin VB.Label lblInfo
Caption = "&Adjust Red Green and Blue"
Height = 255
Index = 5
Left = 720
TabIndex = 11
Top = 4020
Width = 4395
End
Begin VB.Label lblInfo
BackStyle = 0 'Transparent
Caption = "&Saturation"
Enabled = 0 'False
Height = 255
Index = 4
Left = 480
TabIndex = 9
Top = 3420
Width = 855
End
Begin VB.Label lblInfo
BackStyle = 0 'Transparent
Caption = "&Hue"
Enabled = 0 'False
Height = 255
Index = 3
Left = 480
TabIndex = 8
Top = 3060
Width = 555
End
Begin VB.Label lblInfo
BackStyle = 0 'Transparent
Caption = "&Blue %"
Enabled = 0 'False
Height = 255
Index = 2
Left = 480
TabIndex = 5
Top = 5100
Width = 555
End
Begin VB.Label lblInfo
BackStyle = 0 'Transparent
Caption = "&Green %"
Enabled = 0 'False
Height = 255
Index = 1
Left = 480
TabIndex = 4
Top = 4800
Width = 675
End
Begin VB.Label lblInfo
BackStyle = 0 'Transparent
Caption = "&Red %"
Enabled = 0 'False
Height = 255
Index = 0
Left = 480
TabIndex = 3
Top = 4440
Width = 555
End
End
Attribute VB_Name = "frmCustomiseSkin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private m_cN As New cNeoCaption
Private m_cSkin As cSkinConfiguration
Private m_fOwner As Object
Private m_sSkinName As String
Private m_bCancel As Boolean
Public Property Get Cancelled() As Boolean
Cancelled = m_bCancel
End Property
Public Property Get SkinConfiguration() As cSkinConfiguration
Set SkinConfiguration = m_cSkin
End Property
Private Sub setColours()
Dim ctl As Control
Me.BackColor = m_cN.MenuBackgroundColor
For Each ctl In Me.Controls
On Error Resume Next
ctl.ForeColor = m_cN.ActiveMenuColor
ctl.BackColor = m_cN.MenuBackgroundColor
Debug.Print ctl.Name, Err.Number
Err.Clear
Next
End Sub
Private Sub pColourise()
Dim Hue As Single
Dim Saturation As Single
If Not (Me.Tag = "NOEVENTS") Then
m_cSkin.colourise = (chkColourise.value = vbChecked)
m_cSkin.Hue = (hscHue.value - 100#) / 100#
m_cSkin.Saturation = hscSaturation.value / 100#
drawSample
End If
End Sub
Private Sub pAdjustRGB()
If Not (Me.Tag = "NOEVENTS") Then
m_cSkin.AdjustRGB = (chkAdjustRGB.value = vbChecked)
m_cSkin.PercentRed = (hscRed.value - 100#) / 100#
m_cSkin.PercentGreen = (hscGreen.value - 100#) / 100#
m_cSkin.PercentBlue = (hscBlue.value - 100#) / 100#
drawSample
End If
End Sub
Private Sub drawSample()
picSample.Cls
m_cSkin.drawSample m_fOwner.hWnd, picSample.hDC, 4, 4, picSample.ScaleWidth
\ Screen.TwipsPerPixelX - 40, picSample.ScaleHeight \ Screen.TwipsPerPixelY
- 40, False
m_cSkin.drawSample m_fOwner.hWnd, picSample.hDC, 32, 32,
picSample.ScaleWidth \ Screen.TwipsPerPixelX - 40, picSample.ScaleHeight \
Screen.TwipsPerPixelY - 40, True
picSample.Refresh
End Sub
Public Property Let SkinName(ByVal value As String)
m_sSkinName = value
End Property
Public Property Let Owner(ByRef f As Object)
Set m_fOwner = f
End Property
Private Sub chkAdjustRGB_Click()
hscRed.Enabled = (chkAdjustRGB.value = vbChecked)
hscGreen.Enabled = (chkAdjustRGB.value = vbChecked)
hscBlue.Enabled = (chkAdjustRGB.value = vbChecked)
pAdjustRGB
End Sub
Private Sub chkColourise_Click()
hscHue.Enabled = (chkColourise.value = vbChecked)
hscSaturation.Enabled = (chkColourise.value = vbChecked)
pColourise
End Sub
Private Sub cmdCancel_Click()
m_bCancel = True
Unload Me
End Sub
Private Sub cmdOK_Click()
m_bCancel = False
Unload Me
End Sub
Private Sub Form_Load()
Dim ctl As Control
m_bCancel = True
If Not m_fOwner Is Nothing Then
Set m_cSkin = m_fOwner.SkinConfiguration
m_cN.Attach2 Me, m_cSkin
Me.Tag = "NOEVENTS"
hscHue.value = (m_cSkin.Hue + 1) * 100#
hscSaturation.value = m_cSkin.Saturation * 100#
If (m_cSkin.colourise) Then
chkColourise.value = vbChecked
End If
hscRed.value = m_cSkin.PercentRed * 100# + 100#
hscGreen.value = m_cSkin.PercentGreen * 100# + 100#
hscBlue.value = m_cSkin.PercentBlue * 100# + 100#
If (m_cSkin.AdjustRGB) Then
chkAdjustRGB.value = vbChecked
End If
Me.Tag = ""
End If
setColours
drawSample
End Sub
Private Sub hscBlue_Change()
pAdjustRGB
End Sub
Private Sub hscBlue_Scroll()
pAdjustRGB
End Sub
Private Sub hscGreen_Change()
pAdjustRGB
End Sub
Private Sub hscGreen_Scroll()
pAdjustRGB
End Sub
Private Sub hscHue_Change()
pColourise
End Sub
Private Sub hscHue_Scroll()
pColourise
End Sub
Private Sub hscRed_Change()
pAdjustRGB
End Sub
Private Sub hscRed_Scroll()
pAdjustRGB
End Sub
Private Sub hscSaturation_Change()
pColourise
End Sub
Private Sub hscSaturation_Scroll()
pColourise
End Sub
Private Sub lblInfo_Click(Index As Integer)
If Index = 6 Then
chkColourise.value = Abs(chkColourise.value - 1)
ElseIf Index = 5 Then
chkAdjustRGB.value = Abs(chkAdjustRGB.value - 1)
End If
End Sub
|
|