
PatBlt or CopyImage help...please?
PatBlt() I've never used, but here's a code snippet I have used to convert
a color picture to monochrome. As written, it takes a colored image from
picture1 and blits a black and white copy to picture2 on form1.
btmp = CreateBitmap(Form1.Picture1.ScaleWidth,
Form1.Picture1.ScaleHeight, 1, 1, 0&)
chdc = CreateCompatibleDC(Form1.Picture1.hDC)
x = SelectObject(chdc, btmp)
l = BitBlt(chdc, 0, 0, Form1.Picture1.ScaleWidth,
Form1.Picture1.ScaleHeight, Form1.Picture1.hDC, 0, 0, SRCCOPY)
l = BitBlt(Form1!Picture2.hDC, 0, 0, Form1.Picture1.ScaleWidth,
Form1.Picture1.ScaleHeight, chdc, 0, 0, SRCCOPY)
Form1.Picture2.Refresh
btmp = SelectObject(chdc, x)
k = DeleteObject(btmp)
retval = DeleteDC(chdc)
Jim Deutch
Quote:
> Help!
> I would like to take a picturebox and convert the image to a monochrome
> image on another picturebox. I read that the CopyImage API may be able
to
> do this but I could not get it to work. I would also like to take a
> picturebox image and overlay a pattern on it or invert the image. I
think
> the PatBlt API will do it but I can't get this working either!
> If anyone has any examples please reply or email.
> Thanks in advance,
> Sam