Kannst du mal das Script zeigen, oder einen relevanten Ausschnitt daraus? Ich weiß im Moment nämlich nicht einmal wie du was auf die GUI zeichnest...
Beiträge von name22
-
-
Ich glaube er meint
[autoit]_GDIPlus_GraphicsClear()
[/autoit]
Mit _GDIPlus_imageDispose entfernst du ein mit GDI+ geladenes Bild aus dem Arbeitsspeicher, und das wäre in diesem Fall eher geringfügig sinnvoll.
-
BadBunny hat mich in der Shoutbox gefragt wie man Kreise auf ein transparentes Fenster malen könnte, um so wie bei Paint o.Ä. zu malen. (Ich hoffe ich hab das richtig verstanden
).
Naja, hier ist das Script. Gezeichnet wird übrigens durch Gedrückthalten der Strg Taste, während ihr mit Entfernen alles löschen könnt. Viel Spaß :D!Edit: P.S: Mit Escape könnt ihr das Script beenden
...Spoiler anzeigen
[autoit]#include <GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <Misc.au3>; - Author: name22 (http://www.autoit.de)
[/autoit] [autoit][/autoit] [autoit]Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]
OnAutoItExitRegister("_Close")$vUser32DLL = DllOpen("User32.dll")
[/autoit] [autoit][/autoit] [autoit]$iGUIWidth = @DesktopWidth
[/autoit] [autoit][/autoit] [autoit]
$iGUIHeight = @DesktopHeight$tSize = DllStructCreate($tagSIZE)
[/autoit] [autoit][/autoit] [autoit]
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $iGUIWidth)
DllStructSetData($tSize, "Y", $iGUIHeight)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", 255)
DllStructSetData($tBlend, "Format", 1)$hWnd = GUICreate("", $iGUIWidth, $iGUIHeight, 0, 0, BitOR(0x80000000, 0x08000000), BitOR(0x00080000, 0x00000008, 0x00000080))
[/autoit] [autoit][/autoit] [autoit]
GUISetState()$hDC_Window = _WinAPI_GetDC($hWnd)
[/autoit] [autoit][/autoit] [autoit]
$hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC_Window)
$hBitmap_Buffer = _WinAPI_CreateCompatibleBitmap($hDC_Window, $iGUIWidth, $iGUIHeight)
_WinAPI_SelectObject($hDC_Buffer, $hBitmap_Buffer)_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)$hPen_Draw = _GDIPlus_PenCreate(0xFF000000, 15)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PenSetLineCap($hPen_Draw, 0x02, 0x02, 2)GUISetOnEvent($GUI_EVENT_CLOSE, "_Close", $hWnd)
[/autoit] [autoit][/autoit] [autoit]
HotKeySet("{DELETE}", "_Erase")
HotKeySet("{ESC}", "_Close")$aMousePos = MouseGetPos()
[/autoit] [autoit][/autoit] [autoit]
$aMousePos_Old = MouseGetPos()While Sleep(15)
[/autoit] [autoit][/autoit] [autoit]
$aMousePos = MouseGetPos()
Switch True
Case _IsPressed("11", $vUser32DLL)
Switch True
Case $aMousePos[0] <> $aMousePos_Old[0] Or $aMousePos[1] <> $aMousePos_Old[1]
_GDIPlus_GraphicsDrawLine($hGraphics, $aMousePos_Old[0], $aMousePos_Old[1], $aMousePos[0], $aMousePos[1], $hPen_Draw)
EndSwitch
EndSwitch$aMousePos_Old = $aMousePos
[/autoit] [autoit][/autoit] [autoit]_WinAPI_UpdateLayeredWindow($hWnd, $hDC_Window, 0, $pSize, $hDC_Buffer, $pSource, 0, $pBlend, 2)
[/autoit] [autoit][/autoit] [autoit]
WEndFunc _Erase()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsClear($hGraphics, 0x00000000)
EndFuncFunc _Close()
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_ReleaseDC($hWnd, $hDC_Window)
_WinAPI_DeleteDC($hDC_Buffer)
_WinAPI_DeleteObject($hBitmap_Buffer)_GDIPlus_GraphicsDispose($hGraphics)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PenDispose($hPen_Draw)
_GDIPlus_Shutdown()DllClose($vUser32DLL)
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFunc#region "GDIP.au3 Functions"
[/autoit] [autoit][/autoit] [autoit]
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_PenSetLineCap
; Description ...: Sets the cap styles for the start, end, and dashes in a line drawn with the pen
; Syntax.........: _GDIPlus_PenSetLineCap($hPen, $iStartCap, $iEndCap, $iDashCap)
; Parameters ....: $hPen - Pointer to a Pen object
; $iStartCap - Line cap style for the start cap:
; |0x00 - Line ends at the last point. The end is squared off
; |0x01 - Square cap. The center of the square is the last point in the line. The height
; +and width of the square are the line width.
; |0x02 - Circular cap. The center of the circle is the last point in the line. The diameter
; +of the circle is the line width.
; |0x03 - Triangular cap. The base of the triangle is the last point in the line. The base
; +of the triangle is the line width.
; |0x10 - Line ends are not anchored.
; |0x11 - Line ends are anchored with a square. The center of the square is the last point in
; +the line. The height and width of the square are the line width.
; |0x12 - Line ends are anchored with a circle. The center of the circle is at the last point
; +in the line. The circle is wider than the line.
; |0x13 - Line ends are anchored with a diamond (a square turned at 45 degrees). The center of the diamond is at
; +the last point in the line. The diamond is wider than the line.
; |0x14 - Line ends are anchored with arrowheads. The arrowhead point is located at the last
; +point in the line. The arrowhead is wider than the line.
; |0xff - Line ends are made from a CustomLineCap object
; $iEndCap - Line cap style for the end cap (same values as $iStartCap)
; $iDashCap - Start and end caps for a dashed line:
; |0 - A square cap that squares off both ends of each dash
; |2 - A circular cap that rounds off both ends of each dash
; |3 - A triangular cap that points both ends of each dash
; Return values .: Success - True
; Failure - False and either:
; |@error and @extended are set if DllCall failed
; |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: None
; Related .......: _GDIPlus_PenSetDashCap, _GDIPlus_PenSetEndCap, _GDIPlus_PenSetStartCap
; Link ..........; @@MsdnLink@@ GdipSetPenLineCap197819
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_PenSetLineCap($hPen, $iStartCap, $iEndCap, $iDashCap)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetPenLineCap197819", "hwnd", $hPen, "int", $iStartCap, "int", $iEndCap, "int", $iDashCap)If @error Then Return SetError(@error, @extended, False)
[/autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_PenSetLineCap
#endregion "GDIP.au3 Functions" -
Mach es halt so...
Spoiler anzeigen
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstants.au3>
#include <WindowsConstants.au3>$hMain = GUICreate("Test", 400, 400, 200, 200)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()$hChild = GUICreate("", 100, 100, 250, 250, $WS_POPUP, Default, $hMain)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()
GUISwitch($hMain)_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hChild)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)_GDIPlus_GraphicsClear($hGraphics, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsFillEllipse($hGraphics, 10, 10, 80, 70)_GDIPlus_GraphicsDispose($hGraphics)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_Shutdown()GUIRegisterMsg($WM_MOVE, "_Move")
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEndFunc _Move($hWnd, $Msg, $wParam, $lParam)
[/autoit]
If $hWnd = $hMain Then WinMove($hChild, "", Int(BinaryMid($lParam, 1, 2)) + 50, Int(BinaryMid($lParam, 3, 4)) + 50)
EndFunc -
Zitat
wie kann ich ne Grafik, die ich zuvor mit _GDIPlus gezeichnet hab, wieder entfernen?
[autoit]
Mit einer anderen Farbe (z.B. Weiß) drüberzeichnen._GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
[/autoit].
-
@nightfire0110 Das war jetzt nicht auf dich bezogen, ich wollte nur Skilkor darüber informieren, dass unser Forum ihn keineswegs veurteilen wird nur weil er einem Neuankömmling die Lösung zu seinem Problem geliefert hat. Puh, langer Satz
.... -
Zitat
Und Sorry an die Anderen dass ich einem neuling die evt lösung auf dem Silberteller Pressentiere
Darüber wird sich keiner beschweren, nur wenn jemand ein Script verlangt ohne auch nur versucht zu haben es selbst zu machen verweisen wir ihn meist auf die Jobbörse ;). -
Mit GUICtrlRead kannst du den Inhalt eines Controls auslesen.
ZitatDesweiteren wollte ich wissen wie ich ein Feld aktivieren kann über checkbox, und dies soll soll dann in die Berechnung mit einfließen.
Wie bitte? Welches Feld? Und wie soll das in die Berechnung einfließen? Außerdem scheinst du Artikel vor Substantiv vergessen zu haben. -
Mit
[autoit]GUISetFont
[/autoit]kannst du die Standardschriftart für die GUI festlegen, aber das geht nur bevor du die Elemente erzeugst...
-
Wir bräuchten mal so eine Art "Aufräum-Team"
... Damit alles schön ordentlich an seinen Platz kommt. 
-
Zitat
Der Beitrag »Bitte um Hilfe! If WinExists error beim Compelieren« von »Schully« (Heute, 20:26) wurde aus folgendem Grund vom Autor selbst gelöscht: Danke für die schell Hilfe (Heute, 20:36)
*facepalm* Wieso löschst du dann den Beitrag :pinch:? Wenn jeder seinen Beitrag löschen würde nachdem sein Problem gelöst wurde, versteht keiner mehr worum es hier eigentlich ging... -
1. Vielleicht mit StringRegExp, aber ich hab leider nicht genau verstanden was du willst...
[autoit]
2. MitFileSetAttrib
[/autoit] -
Erstell doch aus dem Gerätekontext mit der Bitmap eine GDI+ Grafik. Dann kannst du mit _GDIPlus_GraphicsClear die Bitmap transparent setzen. Somit musst du auch nicht jedesmal eine neue Bitmap erstellen.
[autoit]
$hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Bitmap)
[/autoit]
_GDIPlus_GraphicsClear($hGraphics, 0x00000000) -
Zitat
Was meinst du mit visuellen Effekten?
Naja... Es wäre übersichtlicher wenn sich die Spielfiguren bewegen und nicht teleportieren würden ;). Außerdem Könnte man die Würfel auch grafisch anzeigen anstatt in einer MsgBox. -
Bei mir steht MONOPCDIGITA1.0... Schriftgröße 15 würde bei mir passen.
-
Direkt am Anfang innerhalb von 4 Zügen alle Bahnhöfe eingesackt... Das Spiel gefällt mir, könnte aber noch ein paar visuelle Effekte vertragen ^^.
-
Wir haben für dich doch jetzt wirklich mehr als genug Beispiele geschrieben, oder? Eigentlich solltest du das doch jetzt nach 2 (3?) Threads zum selben Thema verstanden haben...
-
Beenden könnte man das so:
Spoiler anzeigen
[autoit]#include <GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate("Test", 200, 35)
[/autoit] [autoit][/autoit] [autoit]
$cInput = GUICtrlCreateInput("", 5, 5, 190, 25)
GUISetState()$iOldNumber = ""
[/autoit] [autoit][/autoit] [autoit]While True
[/autoit]
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
If GUICtrlRead($cInput) <> $iOldNumber Then
$iOldNumber = GUICtrlRead($cInput)
If StringRegExp($iOldNumber, "[^0-9]", 0) Then Exit
EndIf
WEnd -
Erstens ist das hier im falschen Unterforum (Es sei denn dieser Thread hat auch nur im entferntesten etwas mit Galenda zu tun), zweitens solltest du nicht 2 mal den gleichen Thread in verschiedenen Unterforen erstellen.
-
Zitat
Der oneventmode ist in diesem Fall glaube ich eher ungeeignet, viel zu viele Elemente für die man dann jeweils ne Funktion braucht. Wobei man denke ich die Alphabets Buttons sehr viel gescheiter erzeugen und den Code dadurch um etliche Zeilen kürzen könnte. Ein Array für die Buttons wäre da wohl angesagt.
Aha
.....Spoiler anzeigen
[autoit]#include <GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $aButtons[11] = [10]
[/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate("Test", 410, 50)
[/autoit] [autoit][/autoit] [autoit]
For $i = 1 To $aButtons[0]
$aButtons[$i] = GUICtrlCreateButton(Chr($i + 64), ($i - 1) * 40 + 5, 5, 40, 40)
GUICtrlSetOnEvent(-1, "_ButtonClicked")
Next
GUISetState()GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hWnd)
[/autoit] [autoit][/autoit] [autoit]While Sleep(1000)
[/autoit] [autoit][/autoit] [autoit]
WEndFunc _Exit()
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFuncFunc _ButtonClicked()
[/autoit]
MsgBox(64, "Button Pressed", GUICtrlRead(@GUI_CtrlId))
EndFunc