Home > Software engineering >  The identification of vb pixel color
The identification of vb pixel color

Time:11-19

VB use point identification picture pixel color, what attribute need to be adjusted?
Picture control high and wide based on pixel unit?

CodePudding user response:

The default in twips, 15 twips=1 pixel
ScaleHeight ScaleWidth and are available for the internal region of the high and wide
The Height and Width are outside the overall high and wide
The difference is whether frame size into consideration,

CodePudding user response:

Give you a case, to deal with a piece of the left side of the picture
 

Option Explicit

Private Sub Command1_Click ()
The Picture1. ScaleMode=3 'container units set into pixels within the coordinate system
Picture1. AutoRedraw=True
The Set Picture1. Picture=LoadPicture (" B: \ test. JPG ") 'import a Picture test

Dim x As Long
Dim As Long y

For x=0 To Picture1. ScaleWidth/2 'traversal pictures of all the pixels left side
For y=0 To Picture1. ScaleHeight
'one pixel color, then invert, make negative effect
Picture1. PSet (x, y), Not Picture1. Point (x, y)
DoEvents
Next
Next
End Sub



  • Related