Hi ich arbeite gerade an einer Bitmap Form die es mir erlauben soll Bilder als Form zu haben... Leider funktioniert das ganze noch nicht so ganz und ich kann den Fehler nicht finden ich hoffe ihr könnt mir weiter helfen:
Hier mal der Code:
'Api Deklarationen Laden
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal lngX As _
Long, ByVal lngY As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal _
hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 _
As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As _
Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal _
hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Const RGN_OR = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Public Function BereichHerstellen(objBild As PictureBox) As Long
Dim lngTransparenteFarbe As Long
Dim bolErsterBereich As Boolean
Dim bolEingangsLinie As Boolean
Dim hDC As Long
Dim lngBildWeite As Long
Dim lngBildHoehe As Long
Dim lngX As Long
Dim lngY As Long
Dim lngStartLinie_X As Long
Dim lngGesamtBereich As Long
Dim lngLinienBereich As Long
hDC = objBild.hDC
lngBildWeite = objBild.ScaleWidth
lngBildHoehe = objBild.ScaleHeight
bolErsterBereich = True: bolEingangsLinie = False
lngX = lngY = lngStartLinie_X = 0
'Die transparente Farbe ist die Farbe die sich in der
'PictureBox oben Links befindet...
lngTransparenteFarbe = GetPixel(hDC, 0, 0)
For lngY = 0 To lngBildHoehe - 1
For lngX = 0 To lngBildWeite - 1
If GetPixel(hDC, lngX, lngY) = lngTransparenteFarbe Or _
lngX = lngBildWeite Then
If bolEingangsLinie Then
bolEingangsLinie = False
lngLinienBereich = CreateRectRgn(lngStartLinie_X, _
lngY, lngX, lngY + 1)
If bolErsterBereich Then
lngGesamtBereich = lngLinienBereich
bolErsterBereich = False
Else
CombineRgn lngGesamtBereich, lngGesamtBereich, _
lngLinienBereich, RGN_OR
DeleteObject lngLinienBereich
End If
End If
Else
If Not bolEingangsLinie Then
bolEingangsLinie = True
lngStartLinie_X = lngX
End If
End If
Next
Next
BereichHerstellen = lngGesamtBereich
End Function
Private Sub Form_Load()
Dim FensterBereich As Long
Set Picture1.Picture = LoadPicture(App.Path & "\test.bmp")
Me.Width = Picture1.Width
Me.Height = Picture1.Height
FensterBereich = BereichHerstellen(Picture1)
SetWindowRgn Me.hWnd, FensterBereich, True
End Sub Bei dem Fett gedruckten "Picture1" stopt er die Kompilierung und schmeist mir den Fehler raus: Argumenttyp ByRef unverträglich |