Option expenditure must be defined first before you can use DIM XX, YY
Private submmand1_click () DIM FNAME AS STRING '. . . . . . Open a file comMMondialog1.Action = 1fname = Commondialog1.FileNameOpen FName for binary as # 1dim bmpgeshi1 as byte '. . . . . . Judgment is BMP picture DIM bmpgeshi2 as byteget # 1, 1, bmpgeshi1get # 1, 2, bmpgeshi2dim geshi as byte '. . . . . . Judging the number of BMP images GET # 1, & H1C 1, GESHIDIM K As long '. . . . . Find pictures high, wide Dimg AS Longget # 1, & H12 1, Kget # 1, & H16 1, GDIM POS AS Long 'Dotted Dimette DIM CHA AS INTEGER' DIM X AS Integer 'Draw Point Coordinate DIM Y AS INTEGERDIM Red As Byte, Green As Byte, Blue As Bytedim Xsz AS Byte' Taxel Value Chapter = ABS ((K * 3) MOD 4 - 4) MOD 4IF BmpGeshi1 <> 66 or bmpgeshi2 <> 77 THEN MSGBOX "Format Error" Close # 1ELSE SELECT CASE GESHICASE 24 Text1.Text = Str $ (GESHI) POS = & H36 1 Picture1.Picture = LoadPicture () for y = g - 1 to 0 step -1 'y Row '. . . . . . Point for x = 0 to k - 1 'x column GET # 1, POS, Blue' Get Color Get # 1, POS 1, Green 'Get Color Get # 1, POS 2, Red' Get Color Picture1.pset X, y), RGB (Red, Green, Blue) POS = POS 3 'starts reading a pixel next x pos = POS cha' sage, skipping unnecessary bytes Next Y Close # 1 ' Normal closing file case 8 text1.text = Str $ (GESHI) Picture1.picture = loadingPicture () DIM T (0 to 255, 1 to 3) AS BYTE 'Definition Toner DIM I as Integer, Weizhi as Integer WeizHi = & H36 1 'Palette start position for i = 0 to 255 get # 1, weizhi, t (i, 1)' Putting the palette content into the array T GET # 1, weizhi 1, t (i, 2) Get # 1, weizhi 2, T (i, 3) weizhip = weizhi 4 Next I
DIM Qidian as long 'gets the pixel start position get # 1, & ha 1, qidian pos = qidian 1 for y = g - 1 to 0 step -1' points for x = 0 to k - 1 get # 1, POS, XSZ 'reading a pixel point of the value blue = t (xsz, 1) Green = T (XSZ, 2) Red = T (XSZ, 3) Picture1.pset (x, y), RGB (Red, Green, Blue) POS = POS 1 Next X POS = POS Cha 'Dragon Skip Unneeriosis NEXT Y CLOSE # 1 Case Else End SELECTEND IFEXIT SUBEND SUBPRIVATE SUB Command2_Click () DIM PI1 &, PI2 &
DIM X, Y, M
DIM A, B AS INTEGER
Dim Red, Green, Blue AS Integer
A = 1
B = 1
XX = Picture1.scaleWidth
YY = Picture1.scaleHeight
For x = 1 to xx - 2
For y = 1 to yy - 2
PI1 & = Picture1.Point (x, y)
PI2 & = Picture1.Point (x a, y b)
Red = ABS ((PI1 & MOD 256) - (PI2 & MOD 256) 128)
Green = ABS ((((PI1 & AND & HFF00) / 256 &) MOD 256 &) (((PI2 & and & HFF00) / 256 &) MOD 256 &) 128)
Blue = ABS ((PI1 & and & HFF0000) / 65536) - ((PI2 & and & HFF0000) / 65536) 128)
Picture1.pset (x, y), RGB (Red, Green, Blue)
Next y
Next Xend Sub
Private Sub Command3_Click () DIM PI &
DIM X, Y
DIM A, B AS INTEGER
Dim Red, Green, Blue AS Integer
XX = Picture1.scaleWidth
YY = Picture1.scaleHeight
For x = 2 TO XX - 3
For y = 2 to yy - 3
A = rND * 3 - 1
B = RND * 3 - 1
Pi = Picture1.Point (x a, y b)
RED = (PI & MOD 256)
Green = ((PI & AND & HFF00) / 256 &) MOD 256 &
Blue = ((PI & AND & HFF0000) / 65536)
Picture1.pset (x, y), RGB (Red, Green, Blue)
Next y
Doevents
Next X
End Sub
Private Sub Command4_Click () DIM PI & DIM X, Y
DIM A, B AS INTEGER
Dim Red, Green, Blue AS Integer
A = 1
B = 1
XX = Picture1.scaleWidth
YY = Picture1.scaleHeight
For x = 0 TO XX
For y = 0 to yy
Pi = Picture1.Point (x, y)
RED = (PI & MOD 256)
Green = ((PI & AND & HFF00) / 256 &) MOD 256 &
Blue = ((PI & AND & HFF0000) / 65536)
IF (Red Green Blue) / 3 <128 THEN
Picture1.pset (x, y), RGB (0, 0, 0)
Else
Picture1.pset (x, y), RGB (255, 255, 255)
END IF
Next y
Next X
End Sub
Private submmand5_click () DIM PI1 &, PI2 &
DIM X, Y
DIM A, B AS INTEGER
Dim Red, Green, Blue AS Integer
A = 30
B = 40
XX = Picture1.scaleWidth
YY = Picture1.scaleHeight
For x = 1 to xx
For y = 1 to yy
PI1 = Picture1.Point (x, y)
IF SQR ((A - X) * (A - X) (B - Y) * (B - Y) - 40 <0 THEN
RED = ((PI1 & MOD 256) 200 * (1 - (SQR (A - X) * (A - X) (B - Y) * (B - Y)) 1) / 40))
Green = ((((PI1 & AND & HFF00) / 256 & MOD 256 &) 200 * (1 - (SQR (A - X) * (A - X) (B - Y) * (B - Y)) 1) / 40)))
Blue = ((PI1 & and & HFF0000) / 65536) 200 * (1 - (SQR ((A - X) * (A - X) 1) / 40 ))
IF red <0 THEN Red = 0
If Red> 255 Then Red = 255
IF green <0 Then Green = 0
IF Green> 255 Then Green = 255
IF blue <0 Then Blue = 0
IF blue> 255 Then Blue = 255
Picture1.pset (x, y), RGB (Red, Green, Blue)
END IF
Next y
Next X
End Sub
Private Sub Form_Load () Picture1.ScaleMode = vbPixels' set coordinates of the pixel Picture1.AutoRedraw = FalseCommonDialog1.Filter = "file bmp * .bmp | * .bmp |" CommonDialog1.InitDir = App.PathEnd Sub this program, I There is a little don't understand, please give pointers, why do I want x = 1 to xx - 2for Y = 1 to yy - 2
PI1 & = Picture1.Point (x, y)
PI2 & = Picture1.Point (x a, y b)
Red = ABS ((PI1 & MOD 256) - (PI2 & MOD 256) 128)
Green = ABS ((((PI1 & AND & HFF00) / 256 &) MOD 256 &) (((PI2 & and & HFF00) / 256 &) MOD 256 &) 128)
Blue = ABS ((PI1 & and & HFF0000) / 65536) - ((PI2 & and & HFF0000) / 65536) 128)
Picture1.pset (x, y), RGB (Red, Green, Blue)
Next y
Next X, please help explain, thank you