📄 colour dialog.frm
字号:
VERSION 5.00
Begin VB.Form ColourDialog
BorderStyle = 1 'Fixed Single
Caption = "Get Colour Dialog"
ClientHeight = 1935
ClientLeft = 3435
ClientTop = 2820
ClientWidth = 3975
Icon = "Colour Dialog.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 1935
ScaleWidth = 3975
Begin VB.PictureBox Colourpreview
Height = 275
Left = 240
ScaleHeight = 210
ScaleWidth = 3465
TabIndex = 4
Top = 1110
Width = 3525
End
Begin VB.TextBox Colour
Height = 285
Left = 240
TabIndex = 2
Top = 1470
Width = 3525
End
Begin VB.CommandButton Cancel
Caption = "&Cancel"
Height = 495
Left = 2820
TabIndex = 1
Top = 285
Width = 975
End
Begin VB.CommandButton Command2
Caption = "Get &Colour Dialog..."
Default = -1 'True
Height = 525
Left = 240
TabIndex = 0
Top = 270
Width = 2355
End
Begin VB.Label Colourlabel
Caption = "Colour:"
Height = 255
Left = 240
TabIndex = 3
Top = 870
Width = 615
End
End
Attribute VB_Name = "ColourDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rtn As String
Private Sub Cancel_Click()
Unload Me 'exit the program
End Sub
Private Sub Command2_Click()
Dim cc As ChooseColor
cc.lStructSize = Len(cc)
cc.hwndOwner = Me.hWnd
cc.hInstance = App.hInstance
cc.flags = 0
cc.lpCustColors = String$(16 * 4, 0)
rtn = ChooseColor(cc)
If rtn >= 1 Then
Colourpreview.BackColor = cc.rgbResult
Colour.Text = "Custom Colour is: " & cc.rgbResult
Else
Colour.Text = "Cancel Was Pressed"
End If
End Sub
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2 'centre the form on the screen
'This project was downloaded from
'
'http://www.brianharper.demon.co.uk/
'
'Please use this project and all of its source code however you want.
'
'UNZIPPING
'To unzip the project files you will need a 32Bit unzipper program that
'can handle long file names. If you have a latest copy of Winzip installed
'on your system then you may use that. If you however dont have a copy,
'then visit my web site, go into the files section and from there you can
'click on the Winzip link to goto their site and download a copy of the
'program. By doing this you will now beable to unzip the project files
'retaining their proper long file names.
'Once upzipped, load up your copy of Visual Basic and goto
'File/Open Project. Locate the project files to where ever you unzipped
'them, then click Open. The project files will be loaded and are now ready
'for use.
'
'THE PROJECT
'Do you ever get sick and tired of having to attach many different OCX files
'with your finished programs, that can be sometimes about half a megabyte in
'size and can almost triple the size of distribution of your program. Instead
'of using Visual Basic's OCX for the Custom Colour Dialog, you can call the
'default Windows 95 one with only one API call to the system. This can be very
'handy indead and can help a lot if your distribution size of your program must
'be kept to a minimum.
'
'NOTES
'I have only provided the necessary project files with the zip. This keeps
'the size of the zip files down to a minimum and enables me to upload more
'prjects files to my site.
'
'I hope you find the project usful in what ever you are programming. I
'have tried to write out a small explanation of what each line of code
'does in the project, although most of it is pretty simple to understand.
'
'If you find any bugs in the code then please dont hesitate to Email me and
'I will get back to you as soon as possible. If you however need help on a
'different matter concerning Visual Basic then please please Email me as
'I like to here from people and here what they are programming.
'
'My Email address is:
'Brian@brianharper.demon.co.uk
'
'My web site is:
'http://www.brianharper.demon.co.uk/
'
'Please visit my web site and find many other useful projects like this.
'
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -