#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>
#include <APIConstants.au3>
#include <WinAPIEx.au3>
AutoItSetOption("GUIOnEventMode", 1)
Global Const $psize = "500"
Global $pen1,$hBitmap1,$hBackbuffer1
Global $hBrush,$hBitmap2,$hBackbuffer2
Global $mGui = GUICreate("GDI+TEST 1", $psize + 20, $psize + 20)
Global $pic1 = GUICtrlCreatePic("", 10, 10, $psize, $psize)
Global $hpic1 = GUICtrlGetHandle($pic1)
Global $pic2 = GUICtrlCreatePic("", 10, 10, $psize, $psize)
Global $hpic2 = GUICtrlGetHandle($pic2)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
_gdi_first()
Sleep(1000)
_gdi_second()
;第一个画布画同心圆
Func _gdi_first()
Local $move = $psize / 20
Local $hGraphics1 = _GDIPlus_GraphicsCreateFromHWND($hpic1)
$hBitmap1 = _GDIPlus_BitmapCreateFromGraphics($psize, $psize, $hGraphics1)
$hBackbuffer1 = _GDIPlus_ImageGetGraphicsContext($hBitmap1)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer1, 2)
_GDIPlus_GraphicsClear($hBackbuffer1, 0xFF000000 + 0x303030)
Local $pen1 = _GDIPlus_PenCreate(0x9C00FF00)
For $i = 0 To 9
_GDIPlus_GraphicsDrawEllipse ($hBackbuffer1, ($i) * $move, ($i) * $move, $psize - ($i) * 2 * $move, $psize - ($i) * 2 * $move, $pen1) ;draw the egg
Next
;画XY线
_GDIPlus_GraphicsDrawLine($hBackbuffer1, 0, $psize /2, $psize, $psize / 2, $Pen1)
_GDIPlus_GraphicsDrawLine($hBackbuffer1, $psize /2, 0, $psize / 2, $psize, $Pen1)
;草稿好了,绘图
_GDIPlus_GraphicsDrawImageRect($hGraphics1, $hBitmap1, 0, 0, $psize, $psize)
Sleep(20)
EndFunc;==>到此结束第一个画布
Func _gdi_second()
Local $hGraphics2 = _GDIPlus_GraphicsCreateFromHWND($hpic2)
$hBitmap2 = _GDIPlus_BitmapCreateFromGraphics("500", "500", $hGraphics2)
$hBackbuffer2 = _GDIPlus_ImageGetGraphicsContext($hBitmap2)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer2, 2)
;~ $hBrush = _GDIPlus_LineBrushCreate(0, 0, $psize / 2, $psize / 2, 0xFFFFFFFF, 0xFFFF0000, 3);线性笔刷方向钉死后好像不闪烁了?
For $angel = 0 To 360
If $angel = 360 Then $angel = 0
;~ _GDIPlus_GraphicsClear($hBackbuffer2, 0xFFFFFFFF + 0x303030)
;~ _GDIPlus_GraphicsClear($hGraphics2, 0xFFFFFFFF + 0x303030)
;~ _GDIPlus_BrushDispose($hBrush)
If $angel > 180 And $angel < 360 Then
$hBrush = _GDIPlus_LineBrushCreate($psize / 2, $psize / 2, 250 - Cos($angel) * $psize / 2, 250 - Sin($angel) * $psize / 2, 0x9C00FF00, 0x9A000000, 3)
Else
$hBrush = _GDIPlus_LineBrushCreate($psize / 2, $psize / 2, 250+ Cos($angel) * $psize / 2, 250+ Sin($angel) * $psize / 2, 0x9C00FF00, 0x9A000000, 3)
EndIf
_GDIPlus_GraphicsFillPie ($hBackbuffer2, 0, 0, $psize, $psize,$angel,45, $hBrush) ;draw the egg
_GDIPlus_GraphicsDrawImageRect($hGraphics2, $hBitmap2, 0, 0, 500, 500)
_GDIPlus_BrushDispose($hBrush)
Next
EndFunc;==>到此结束第二个画布
While 1
Sleep(20)
WEnd
Func _Exit() ;
_GDIPlus_PenDispose($pen1)
_GDIPlus_BitmapDispose($hBitmap1)
_GDIPlus_BitmapDispose($hBitmap2)
_GDIPlus_Shutdown
GUIDelete($mGui)
Exit
EndFunc ;==>_Exit
好忧伤,,技术不够不知道咋办了