Her har du CreateRectRgn i VB format, det tog 5 sekunder at finde dem vha. ovenstående program.
Public Declare Function CreateRectRgn Lib \"gdi32\" Alias \"CreateRectRgn\" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
\"Api Viewer\" Hvordan bruger man den, jeg kan ikke loade andet en .txt .mbd filer og .mbd har fatter jeg ikke noget af.
hvordan bruger jeg:
Public Declare Function CreateRectRgn Lib \"gdi32\" Alias \"CreateRectRgn\" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
jeg ved godt at den skal intastes i et \"Module\" men ellers ved jeg ikke hvordan jeg skal bruge den :-)
Jeg har et lille program der kan lave en rgnfilr men jeg kan ikke få den til at virke under visual Basic men den er også lavet til et program der hedder \"Multimedia Builder\" men hvis man kunne lave et program der kunne gøre det på samme måde som det kan så ville det værere meget nemmer http://members.xoom.com/etetz/CreateRegion.zip
Jeg kender ikke funktionen CreateRectRgn, så det kan jeg ikke hjælpe med.... Dog ser det ud som om du gør sådan her.
Dim Left As Long, Top As Long, Right As Long, Bottom As Long, ReturnValue As Long Left = 10 Top = 20 Right = 20 Bottom = 30 ReturnValue = CreateRectRgn(Left, Top, Right, Bottom)
I Api Viewer skal du bare loade WIN32API.TXT den indeholder de fleste declerations, constants og types i WinAPI\'en, så det skulle være lige til derfra.
winkill: næsten alt hvad jeg spørge om her på eksperten, skal kun bruges som eksempel så jeg kan hive det frem når jeg skal bruge det, da jeg nok aldrig bliver færtig mad alle de programmer jeg snart har lavet.
PS: hvis du har lydst til at lave dem færtig er du meget velkommen til det. ;o)
Som jeg skrev: \"Men jeg finder nok ud af det på et sener tidspunt.\" nu er det tidspunt kommet, og jeg ville lige vise en nem måde at lave \"CreateRectRgn\" som jeg søgte.
\'----------------------------------- CreateRectRgn ------------------------------------ \'Start med at lave et bitmap billed, eks: hvid baggrund og en sort cirkel \'åbne billedet i \"Form Picture\" og set \"Form BorderStyle\" til \"0 - None\" \'nu skulle du få en sort cirkel når du køre dit program \'----------------------------------- CreateRectRgn ------------------------------------
\'--------- CreateRectRgn --------- Private Sub Form_Load() If hRgn Then DeleteObject hRgn \'------------------------------------ Fjern farve ------------------------------------- \'Her kan man lave en anden baggrunds farve hvis man bruger en hvid farve i sit billed \'html farvekode \"#000000\" \"-#\" \"+&H\" \"=&H000000\" fjerner alt det sorte i billedet \'Paint Shop Pro kan nemt bruges til at finde farvekoden. hRgn = GetBitmapRegion(Me.Picture, &HFFFFFF) \'------------------------------------ Fjern farve ------------------------------------- SetWindowRgn Me.hwnd, hRgn, True End Sub \'--------- CreateRectRgn ---------
\'--------- Move window --------- Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then FormDrag Me End If End Sub \'--------- Move window ---------
\'--------- Exit button --------- Private Sub Exit_button_Click() Unload Me End Sub \'--------- Exit button --------- \'----------------------------------------------- (Form Kode) -----------------------------------------------
\'---------------------------------------------- (Module Kode) ---------------------------------------------- \'Koden her skal indtastes i et Module
\'--------- CreateRectRgn --------- Public Declare Function SetWindowRgn Lib \"user32\" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long Public Declare Function DeleteObject Lib \"gdi32\" (ByVal hObject As Long) As Long Public Declare Function ReleaseCapture Lib \"user32\" () As Long Public Declare Function SendMessage Lib \"user32\" Alias \"SendMessageA\" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Declare Function CreateCompatibleDC Lib \"gdi32\" (ByVal hDC As Long) As Long Public Declare Function SelectObject Lib \"gdi32\" (ByVal hDC As Long, ByVal hObject As Long) As Long Public Declare Function GetObject Lib \"gdi32\" Alias \"GetObjectA\" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long Public Declare Function CreateRectRgn Lib \"gdi32\" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Public Declare Function CombineRgn Lib \"gdi32\" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long Public Declare Function DeleteDC Lib \"gdi32\" (ByVal hDC As Long) As Long Public Declare Function GetPixel Lib \"gdi32\" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Public 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 \'--------- CreateRectRgn ---------
\'--------- CreateRectRgn --------- Public Function GetBitmapRegion(cPicture As StdPicture, cTransparent 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 \'--------- CreateRectRgn ---------
\'--------- Move window --------- Public Sub FormDrag(TheForm As Form) ReleaseCapture Call SendMessage(TheForm.hwnd, &HA1, 2, 0&) End Sub \'--------- Move window --------- \'---------------------------------------------- (Module Kode) ----------------------------------------------
Det kan næsten ikke være nemmer. (Jeg har kun testede det i Visual Basic 5.0)
Jeg må lige se på det i den nærmeste fremtid - har desværre ikke tid lige nu. - men det ser rigtigt interessant ud :-)
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.