|
Преобразование цветного рисунка в черно-белый |
|
|
Вам понадобятся 2 PictureBox и CommandButton. Загрузите в первый PictureBox любую цветную картинку, запустите проект на выполнение, нажмите на кнопку. Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As
Long, ByVal hMem As Long) As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Private Const CF_BITMAP = 2
Private Declare Function CopyImage Lib "user32" (ByVal handle As Long, ByVal
imageType As Long, ByVal newWidth As Long, ByVal newHeight As Long, ByVal lFlags As Long)
As Long
Private Const IMAGE_BITMAP = 0
Private Const LR_COPYRETURNORG = &H4
Private Const LR_MONOCHROME = &H1
Private Sub Command1_Click()
Dim hNew As Long
hNew = CopyImage(Picture1.Picture, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG &
LR_MONOCHROME)
OpenClipboard Me.hwnd
EmptyClipboard
SetClipboardData CF_BITMAP, hNew
CloseClipboard
Picture2.Picture = Clipboard.GetData(vbCFBitmap)
End Sub
|
|
|
|
|
|
|