18. november 2001 - 12:23
#2
du har vel WinAmp, ikk? Så hvis du vælger et skin til winamp, kan du få et skin som er gennemsigtigt, så du fx. både kan se skrivebordet, og winamp på én gang, fårstået?
19. november 2001 - 01:10
#3
\'--------------------------- Form1 ---------------------------
\'Set Form1.BorderStyle = 0
\'-------------------------------------------------------------
Option Explicit
Private Declare Function ReleaseCapture Lib \"user32\" () 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 SetWindowRgn Lib \"user32\" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib \"gdi32\" (ByVal hObject As Long) As Long
Private Declare Function CreateCompatibleDC Lib \"gdi32\" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib \"gdi32\" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function GetObject Lib \"gdi32\" Alias \"GetObjectA\" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) 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 CombineRgn Lib \"gdi32\" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function DeleteDC Lib \"gdi32\" (ByVal hdc As Long) As Long
Private Declare Function GetPixel Lib \"gdi32\" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Private Function GetBitmapRegion(cPicture As StdPicture, cTransparent As Long) As Long
Dim hRgn As Long, tRgn As Long
Dim X As Integer, Y As Integer, X0 As Integer
Dim hdc As Long, BM As BITMAP
hdc = CreateCompatibleDC(0)
If hdc Then
SelectObject hdc, cPicture
GetObject cPicture, Len(BM), BM
hRgn = CreateRectRgn(0, 0, BM.bmWidth, BM.bmHeight)
For Y = 0 To BM.bmHeight
For X = 0 To BM.bmWidth
While X <= BM.bmWidth And GetPixel(hdc, X, Y) <> cTransparent
X = X + 1
Wend
X0 = X
While X <= BM.bmWidth And GetPixel(hdc, X, Y) = cTransparent
X = X + 1
Wend
If X0 < X Then
tRgn = CreateRectRgn(X0, Y, X, Y + 1)
CombineRgn hRgn, hRgn, tRgn, 4
DeleteObject tRgn
End If
Next X
Next Y
GetBitmapRegion = hRgn
DeleteObject SelectObject(hdc, cPicture)
End If
DeleteDC hdc
End Function
Private Sub Form_Load()
Dim hRgn As Long
Me.Picture = LoadPicture(\"C:\\WINDOWS\\Skrivebord\\test.bmp\") \'Load billede
hRgn = GetBitmapRegion(Me.Picture, &HFF00FF) \'&HFF00FF< Transparent Farve
SetWindowRgn Me.hwnd, hRgn, True
DeleteObject hRgn
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
\'--------- Move window ---------
ReleaseCapture
Call SendMessage(Me.hwnd, &HA1, 2, 0&)
\'--------- Move window ---------
End If
End Sub
\'--------------------------- Form1 ---------------------------