|
发表于 2014-9-27 19:52:01
|
显示全部楼层
[au3]#include <Math.au3>
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()
Local $hGUI, $hWnd, $hGraphic, $hBrush, $hAsymPen, $hFormat, $hFamily, $hFont, $tLayout, $hPen
Local $aPoint[10000][3], $aPoint2[10000][3], $j = 1
; 创建界面
$hGUI = GUICreate("Parabola", 400, 300)
$hWnd = WinGetHandle("Parabola")
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 8, 2)
$tLayout = _GDIPlus_RectFCreate(200, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, 'O(0,0)', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(20, 20, 200, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(100, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '-1', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(300, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '1', $hFont, $tLayout, $hFormat, $hBrush)
$hPen = _GDIPlus_PenCreate()
_GDIPlus_GraphicsDrawLine($hGraphic, 0, 150, 400, 150, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, 200, 0, 200, 300, $hPen)
$hAsymPen = _GDIPlus_PenCreate()
_GDIPlus_PenSetDashStyle($hAsymPen, $GDIP_DASHSTYLEDASH)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, 0, 100, 300, $hAsymPen)
_GDIPlus_GraphicsDrawLine($hGraphic, 300, 0, 300, 300, $hAsymPen)
$aPoint[0][0] = 200
$aPoint2[0][0] = 200
For $i = 0 To 200 Step 1
$aPoint[$j][0] = $i * 2 + 200
$aPoint[$j][1] = 150 - Sqrt($i * 2)
$aPoint2[$j][0] = $i * 2 + 200
$aPoint2[$j][1] = 150 + Sqrt($i * 2)
$j += 1
Next
_GDIPlus_GraphicsDrawCurve($hGraphic, $aPoint)
_GDIPlus_GraphicsDrawCurve($hGraphic, $aPoint2)
; 循环至用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; 清除资源
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hAsymPen)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>_Main
[/au3] |
|