![]() |
Tipp 0103
|
Grafiken mit Filter kopieren
|
 |
|
Autor/Einsender: Datum: |
|
Christian Lotmann 15.07.2001 |
|
Entwicklungsumgebung: |
|
VB 6 |
|
|
Mit der universellen und äußerst starken API-Funktion BitBlt ist es möglich, unter
Verwendung verschiedener Konstanten, Grafiken mit unterschiedlichen Filtern
schnell und einfach mit nur einigen wenigen Codezeilen zu kopieren, wie es dieser Tipp recht anschaulich zeigt.
|
|
Code im Codebereich des Moduls |
|
|
Option Explicit
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC _
As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth _
As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As _
Long) As Long
Public Const DESTINVERT = &H550009
Public Const MERGPAINT = &HBB0226
Public Const NOTSRCCOPY = &H330008
Public Const SRCCOPY = &HCC0020
Public Const SRCAND = &H8800C6
Public Const SRCERASE = &H440328
Public Const SRCINVERT = &H660046
Public Const SRCPAINT = &HEE0086
|
|
|
Code im Codebereich der Form |
|
|
Option Explicit
Dim CopyWert(6) As String
Private Sub Form_Load()
CopyWert(0) = "&HBB0226"
CopyWert(1) = "&H330008"
CopyWert(2) = "&HCC0020"
CopyWert(3) = "&H8800C6"
CopyWert(4) = "&H440328"
CopyWert(5) = "&H660046"
CopyWert(6) = "&HEE0086"
pic2.Width = pic1.Width
pic2.Height = pic1.Height
pic1.Picture = LoadPicture(App.Path & "\Geier.jpg")
optFilter(2).Value = True
End Sub
Private Sub optFilter_Click(Index As Integer)
pic2.Cls
pic2.AutoRedraw = False
Call BitBlt(pic2.hDC, 0, 0, pic1.Width, pic1.Height, _
pic1.hDC, 0, 0, CopyWert(Index))
End Sub
Private Sub pic2_Paint()
Dim i As Integer
For i = 0 To 6
If optFilter(i).Value = True Then Exit For
Next i
Call BitBlt(pic2.hDC, 0, 0, pic1.Width, pic1.Height, _
pic1.hDC, 0, 0, CopyWert(i))
End Sub
|
|
|
|
|
Windows-Version |
95 |
 |
|
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
VB-Version |
VBA 5 |
 |
|
VBA 6 |
 |
|
VB 4/16 |
 |
|
VB 4/32 |
 |
|
VB 5 |
 |
|
VB 6 |
 |
|
|
|
Download (59,8
kB)
|
Downloads bisher: [ 1548 ]
|
|
|