home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Put Color"
- ClientHeight = 3375
- ClientLeft = 3105
- ClientTop = 2265
- ClientWidth = 5535
- Height = 4065
- Left = 3045
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3375
- ScaleWidth = 5535
- Top = 1635
- Width = 5655
- Begin VB.CommandButton cmdSetColor
- Caption = "&Set Color"
- Height = 375
- Left = 3960
- TabIndex = 1
- Top = 2880
- Width = 1455
- End
- Begin ik32Lib.Picbuf Picbuf1
- Height = 3255
- Left = 120
- TabIndex = 0
- Top = 0
- Width = 3735
- _Version = 65541
- _ExtentX = 6588
- _ExtentY = 5741
- _StockProps = 253
- End
- Begin VB.Label Label2
- Caption = "New Color:"
- Height = 255
- Left = 3960
- TabIndex = 3
- Top = 1800
- Width = 1455
- End
- Begin VB.Shape Shape2
- BackColor = &H00000000&
- BackStyle = 1 'Opaque
- Height = 495
- Left = 3960
- Top = 480
- Width = 1455
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 4320
- Top = 1200
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- End
- Begin VB.Shape Shape1
- BackColor = &H00000000&
- BackStyle = 1 'Opaque
- Height = 495
- Left = 3960
- Top = 2280
- Width = 1455
- End
- Begin VB.Label Label1
- Caption = "Current Color:"
- Height = 255
- Left = 3960
- TabIndex = 2
- Top = 0
- Width = 1215
- End
- Begin VB.Label Label3
- Caption = "(Right Click)"
- Height = 255
- Left = 3960
- TabIndex = 4
- Top = 240
- Width = 1095
- End
- Begin VB.Label Label4
- Caption = "(Left Click)"
- Height = 255
- Left = 3960
- TabIndex = 5
- Top = 2040
- Width = 855
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuLoadImage
- Caption = "&Load Image..."
- End
- Begin VB.Menu mnuSaveImage
- Caption = "&Save Image..."
- End
- Begin VB.Menu mnuSpacer
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "E&xit"
- Shortcut = ^X
- End
- End
- Begin VB.Menu mnuReload
- Caption = "&Reload"
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- 'Description: This code changes the color of the
- 'shape control, and the color used to put color
- 'on the image.
- Private Sub cmdSetColor_Click()
- Shape1.BackColor = GetColor(commondialog1)
- End Sub
- 'Description: This code loads an image into the
- 'picbuf.
- Private Sub Form_Load()
- InitPicbuf Picbuf1, True, "marybeth.tif"
- End Sub
- 'Description: This code ends the program
- Private Sub mnuExit_Click()
- ExitProgram
- End Sub
- 'Description: This code uses the common dialog
- 'control to load an image into the imageknife
- 'control.
- Private Sub mnuLoadImage_Click()
- LoadImage Picbuf1, commondialog1
- End Sub
- 'Description: This reloads the specified image into
- 'the picbuf.
- Private Sub mnuReload_Click()
- Picbuf1.Load
- End Sub
- 'Description: This saves the image in the picbuf
- 'using the common dialog control.
- Private Sub mnuSaveImage_Click()
- SaveImage Picbuf1, commondialog1
- End Sub
- 'Description: This code either determines the
- 'color of the current pixel, or changes the color,
- 'depending on which button is clicked.
- Private Sub Picbuf1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
- Dim XPos As Integer
- Dim YPos As Integer
- XPos = Picbuf1.ScreenToImageX(x / Screen.TwipsPerPixelX)
- YPos = Picbuf1.ScreenToImageY(y / Screen.TwipsPerPixelY)
- If Button = 1 Then
- If XPos <> -1 And XPos < Picbuf1.Xresolution And YPos <> -1 And YPos < Picbuf1.Yresolution Then
- Picbuf1.PutColor XPos, YPos, Shape1.BackColor
- End If
- Else
- If XPos <> -1 And XPos < Picbuf1.Xresolution And YPos <> -1 And YPos < Picbuf1.Yresolution Then
- Shape2.BackColor = Picbuf1.GetColor(XPos, YPos)
- End If
- End If
- End Sub
-