home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 4.00 Begin VB.Form Form1 BorderStyle = 1 'Fixed Single Caption = "Image Information" ClientHeight = 3690 ClientLeft = 1995 ClientTop = 2985 ClientWidth = 6585 Height = 4380 Left = 1935 LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3690 ScaleWidth = 6585 Top = 2355 Width = 6705 Begin VB.Frame Frame2 Caption = "Image" Height = 2595 Left = 3600 TabIndex = 5 Top = 960 Width = 2895 Begin VB.Label lblBPal Caption = "lblBPal" Height = 195 Left = 2430 TabIndex = 29 Top = 1710 Width = 375 End Begin VB.Label lblGPal Caption = "lblGPal" Height = 195 Left = 1890 TabIndex = 28 Top = 1710 Width = 375 End Begin VB.Label lblRPal Caption = "lblRPal" Height = 195 Left = 1350 TabIndex = 27 Top = 1710 Width = 375 End Begin VB.Label lblBCol Caption = "lblBCol" Height = 195 Left = 2430 TabIndex = 26 Top = 1170 Width = 375 End Begin VB.Label lblGCol Caption = "lblGCol" Height = 195 Left = 1890 TabIndex = 25 Top = 1170 Width = 375 End Begin VB.Label lblRCol Caption = "lblRCol" Height = 195 Left = 1350 TabIndex = 24 Top = 1170 Width = 375 End Begin VB.Label Label15 Caption = "B:" Height = 195 Left = 2250 TabIndex = 23 Top = 1710 Width = 195 End Begin VB.Label Label14 Caption = "G:" Height = 195 Left = 1710 TabIndex = 22 Top = 1710 Width = 195 End Begin VB.Label Label13 Caption = "R:" Height = 195 Left = 1170 TabIndex = 21 Top = 1710 Width = 285 End Begin VB.Label Label12 Caption = "B:" Height = 195 Left = 2250 TabIndex = 20 Top = 1170 Width = 195 End Begin VB.Label Label11 Caption = "G:" Height = 195 Left = 1710 TabIndex = 19 Top = 1170 Width = 195 End Begin VB.Label Label10 Caption = "R:" Height = 195 Left = 1170 TabIndex = 18 Top = 1170 Width = 285 End Begin VB.Shape Shape1 FillStyle = 0 'Solid Height = 465 Left = 120 Top = 1980 Width = 2625 End Begin VB.Label Label6 Caption = "Palette Color:" Height = 255 Left = 90 TabIndex = 15 Top = 1680 Width = 975 End Begin VB.Label lblHeight Caption = "lblHeight" Height = 255 Left = 1170 TabIndex = 14 Top = 540 Width = 735 End Begin VB.Label lblWidth Caption = "lblWidth" Height = 255 Left = 1170 TabIndex = 13 Top = 270 Width = 735 End Begin VB.Label Label4 Caption = "Height:" Height = 255 Left = 90 TabIndex = 12 Top = 540 Width = 615 End Begin VB.Label Label3 Caption = "Width:" Height = 255 Left = 90 TabIndex = 11 Top = 270 Width = 495 End Begin VB.Label lblPalIndex Caption = "lblPalIndex" Height = 255 Left = 1200 TabIndex = 10 Top = 1440 Width = 735 End Begin VB.Label Label9 Caption = "Palette Index:" Height = 255 Left = 90 TabIndex = 9 Top = 1440 Width = 1095 End Begin VB.Label Label7 Caption = "Color:" Height = 255 Left = 90 TabIndex = 8 Top = 1170 Width = 495 End Begin VB.Label lblBitDepth Caption = "lblBitDepth" Height = 255 Left = 1170 TabIndex = 7 Top = 810 Width = 735 End Begin VB.Label Label5 Caption = "Bit Depth:" Height = 255 Left = 90 TabIndex = 6 Top = 810 Width = 855 End End Begin VB.Frame Frame1 Caption = "Cursor" Height = 855 Left = 3600 TabIndex = 0 Top = 0 Width = 2895 Begin VB.Label lblYPos Caption = "lblYPos" Height = 255 Left = 1170 TabIndex = 4 Top = 480 Width = 735 End Begin VB.Label lblXPos Caption = "lblXPos" Height = 255 Left = 1170 TabIndex = 3 Top = 240 Width = 735 End Begin VB.Label Label2 Caption = "Y Position:" Height = 255 Left = 90 TabIndex = 2 Top = 480 Width = 1095 End Begin VB.Label Label1 Caption = "X Position:" Height = 255 Left = 90 TabIndex = 1 Top = 240 Width = 855 End End Begin ik32Lib.Picbuf Picbuf1 Height = 3375 Left = 120 TabIndex = 16 Top = 0 Width = 3375 _Version = 65536 _ExtentX = 5953 _ExtentY = 5953 _StockProps = 253 End Begin VB.Label Label8 Alignment = 2 'Center Caption = "Click on image for color information" Height = 195 Left = 90 TabIndex = 17 Top = 3420 Width = 3435 End Begin MSComDlg.CommonDialog CommonDialog1 Left = 3000 Top = 480 _Version = 65536 _ExtentX = 847 _ExtentY = 847 _StockProps = 0 End Begin VB.Menu mnuFile Caption = "&File" Begin VB.Menu mnuLoad Caption = "&Load Image..." End Begin VB.Menu mnuSpacer Caption = "-" End Begin VB.Menu mnuExit Caption = "E&xit" Shortcut = ^X End End Attribute VB_Name = "Form1" Attribute VB_Creatable = False Attribute VB_Exposed = False Option Explicit 'Description: This code clears the captions of 'labels on the screen Sub InitImageInfo() 'set label captions to image data values lblBitDepth.Caption = Picbuf1.ColorDepth lblWidth.Caption = Picbuf1.Xresolution lblHeight.Caption = Picbuf1.Yresolution 'clear other labels lblRCol.Caption = "" lblGCol.Caption = "" lblBCol.Caption = "" lblRPal.Caption = "" lblGPal.Caption = "" lblBPal.Caption = "" lblPalIndex.Caption = "" Shape1.FillColor = 0 End Sub 'Description: This code initializes all presets Private Sub Form_Load() 'Set picbuf properties InitPicbuf Picbuf1, True, "marybeth.tif" InitImageInfo Picbuf1.MousePointer = MPCross 'set cursor to cross hair End Sub 'Description: This code ends the program Private Sub mnuExit_Click() ExitProgram End Sub 'Description: This code loads an image using the 'Common Dialog control. It then sets the value of 'several text boxes, according to information about 'the image. Private Sub mnuLoad_Click() LoadImage Picbuf1, CommonDialog1 InitImageInfo End Sub 'Description: This sets the color of a shape control 'to the color being clicked on Private Sub Picbuf1_Click() Dim nColor, nPalColor As Long 'set color & palette labels If Val(lblXPos.Caption) <> -1 And Val(lblXPos.Caption) < Val(lblWidth.Caption) And Val(lblYPos.Caption) <> -1 And Val(lblYPos.Caption) < Val(lblHeight) Then If Picbuf1.ColorDepth = 24 Then nColor = Picbuf1.GetColor(Val(lblXPos.Caption), Val(lblYPos.Caption)) Else lblPalIndex.Caption = Picbuf1.GetPalIndex(Val(lblXPos.Caption), Val(lblYPos.Caption)) nPalColor = Picbuf1.GetPalColor(Val(lblPalIndex.Caption)) nColor = Picbuf1.GetColor(Val(lblXPos.Caption), Val(lblYPos.Caption)) lblRPal.Caption = getRed(Val(nPalColor)) lblGPal.Caption = getGreen(Val(nPalColor)) lblBPal.Caption = GetBlue(Val(nPalColor)) End If lblRCol.Caption = getRed(Val(nColor)) lblGCol.Caption = getGreen(Val(nColor)) lblBCol.Caption = GetBlue(Val(nColor)) End If Shape1.FillColor = Val(nColor) End Sub 'Description: this code updates the values of text 'boxes according to the information about the 'selected pixel Private Sub Picbuf1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'set x&y position labels lblXPos.Caption = Picbuf1.ScreenToImageX(X / Screen.TwipsPerPixelX) lblYPos.Caption = Picbuf1.ScreenToImageY(Y / Screen.TwipsPerPixelY) End Sub