Kurz und Knapp : Wie kann ich GDIPlus vor dem Wegwischen mittels anderer Fenster schützen ?
GDIPlus
-
- [ offen ]
-
nof@ker2 -
23. Januar 2010 um 22:31 -
Geschlossen -
Erledigt
-
-
Mit GUIRegisterMsg vielleicht?
Hier ein Beispiel, das ein Farbverlauf erstellt (ist nicht die beste Methode) und das Fenster entsprechend neu zeichnet:
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
;Coded by UEZ
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>Global Const $width = 640
[/autoit] [autoit][/autoit] [autoit]
Global Const $height = 480
Global $graphics, $backbuffer, $bitmap, $Pen, $i, $pi_div_180 = 4 * ATan(1) / 180Global $title = "GDI+ Color Gradient"
[/autoit] [autoit][/autoit] [autoit]Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]
$hwnd = GUICreate($title, $width, $height, -1, -1) ;, BitOR($WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP))
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUISetState()_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
$pen = _GDIPlus_PenCreate(0xFF000000, 1);you can move this lines below until Do...Until loop to Do...Until loop and make some realtime effects
[/autoit] [autoit][/autoit] [autoit]
$r = 0x00
$g = 0x00
$b = 0xFF
$c = "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
$i = 255 / $width_GDIPlus_GraphicsClear($backbuffer)
[/autoit] [autoit][/autoit] [autoit]For $x = 0 To $width
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($backbuffer, $x, 0, $x, $width, $pen)
_GDIPlus_PenSetColor($pen, $c)
$r += $i
$g += $i
$c = "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
Next_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
[/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg(0x0F, "MY_PAINT"); Register PAINT-Event 0x000F = $WM_PAINT (WindowsConstants.au3)
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg(0x85, "MY_PAINT"); $WM_NCPAINT = 0x0085 (WindowsConstants.au3)Restore after Minimize.$b = 0
[/autoit] [autoit][/autoit] [autoit]Do
[/autoit] [autoit][/autoit] [autoit]Until False * Not Sleep(30)
[/autoit] [autoit][/autoit] [autoit];Func to redraw on PAINT MSG
[/autoit] [autoit][/autoit] [autoit]
Func MY_PAINT($hWnd, $msg, $wParam, $lParam)
; The sequencial order of these two commands is important.
_GDIPlus_GraphicsDrawImage($graphics, $bitmap, 0, 0)
_WinAPI_RedrawWindow($hwnd, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_FRAME)); , $RDW_ALLCHILDREN
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_PAINTFunc Close()
[/autoit]
_GDIPlus_PenDispose($pen)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
WinClose($hwnd)
Exit
EndFuncDie Funktion MY_PAINT() zeichnet das Fenster neu!
Meinst du das?
Gruß,
UEZ -
Ja soetwas meinte ich

Aber wenn ich das Fenster schnell hinundher bewege dann stockt es sehr unangenehm
Hast du dafür auch noch eine Lösung ?
-
Vielleicht so was:
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#AutoIt3Wrapper_UseUpx=n
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]
Opt('MustDeclareVars', 1)Local $iX = 320
[/autoit] [autoit][/autoit] [autoit]
Local $iY = 320
Local $hWnd = GUICreate("GDI+ Test", $iX, $iY)
GUISetState()
GUISetOnEvent(-3, "_Close")_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphics)
Local $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
Local $pen_size = 128
Local $hPen = _GDIPlus_PenCreate(0xFF00FF00, $pen_size)
Local $sleep = 20
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113
[/autoit] [autoit][/autoit] [autoit]
DllCall("User32.dll", "int", "SetTimer", "hwnd", $hwnd, "int", 0, "int", $sleep, "int", 0)While Sleep(30)
[/autoit] [autoit][/autoit] [autoit]WEnd
[/autoit] [autoit][/autoit] [autoit]Func Draw()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsClear($hBackbuffer)
_GDIPlus_GraphicsDrawEllipse($hBackbuffer, $pen_size / 2, $pen_size / 2, $iX - $pen_size, $iY - $pen_size, $hPen)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iX, $iY)
EndFuncFunc _Close()
[/autoit]
_GDIPlus_PenDispose($hPen)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hBackbuffer)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFuncGruß,
UEZ