帮我看看代码,并修改一下
Func _Button1()
GUICtrlSetState($Checkbox1a, 1)
$zhang_danwei = GUICtrlRead($Input1)
$zhang_jiaodu = _GUICtrlSlider_GetPos($qishijiao)
$zhang_name = GUICtrlRead($Input3)
$zhang_r = _GUICtrlSlider_GetPos($banjing)
$zhang_jj = _GUICtrlSlider_GetPos($jiajiao)
wjx($zhang_danwei, $zhang_jiaodu, $zhang_name, $zhang_r, $zhang_jj)
EndFunc ;==>_Button1
Func wjx($zhang_danwei, $zhang_jiaodu, $zhang_name, $zhang_r, $zhang_jj);绘制五角星
GUICtrlSendMsg($pic, 0x0172, 0, 0)
_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromScan0a(480, 480, 0, $GDIP_PXF32ARGB)
$Graphic = _GDIPlus_ImageGetGraphicsContext($hImage)
;设置里程表的高和宽
$Width = 480
$Height = 480
;设置图形对象的渲染质量,设置文本输出外观
_GDIPlus_GraphicsSetSmoothingMode($Graphic, 2)
;将绘图平面的坐标原点移到窗口中心
_GDIPlus_GraphicsTranslateTransforma($Graphic, $Width / 2, $Height / 2)
$zecc = GUICtrlRead($zec)
;绘制外圆
$pen = _GDIPlus_PenCreate(0xFFff0000, $zecc)
_GDIPlus_GraphicsDrawEllipse($Graphic, -($zhang_r / 2), -($zhang_r / 2), $zhang_r, $zhang_r, $pen)
;输出五角星
Dim $r = Int($zhang_r * -0.15)
Dim $PI = 3.1415926535897932384626433832795;$PI = 3.14159265358979;3.1415926
Local $aPoints[13][2] = [ _
[12], _
[0, $r], _
[Int(Tan(36 * $PI / 180) * Cos(72 * $PI / 180) * $r), Int(Cos(72 * $PI / 180) * $r)], _
[Int(Cos(18 * $PI / 180) * $r), Int(Sin(18 * $PI / 180) * $r)], _
[Int(Sin(72 * $PI / 180) * Cos(72 * $PI / 180) * $r / Cos(36 * $PI / 180)), -(Int(Sin(18 * $PI / 180) * Cos(72 * $PI / 180) * $r / Cos(36 * $PI / 180)))], _
[Int(Sin(36 * $PI / 180) * $r), Int(-(Cos(36 * $PI / 180) * $r))], _
[0, Int(-(Cos(72 * $PI / 180) * $r / Cos(36 * $PI / 180)))], _
[Int(-(Sin(36 * $PI / 180) * $r)), Int(-(Cos(36 * $PI / 180) * $r))], _
[-(Int(Sin(72 * $PI / 180) * Cos(72 * $PI / 180) * $r / Cos(36 * $PI / 180))), -(Int(Sin(18 * $PI / 180) * Cos(72 * $PI / 180) * $r / Cos(36 * $PI / 180)))], _
[-(Int(Cos(18 * $PI / 180) * $r)), Int(Sin(18 * $PI / 180) * $r)], _
[-(Int(Tan(36 * $PI / 180) * Cos(72 * $PI / 180) * $r)), Int(Cos(72 * $PI / 180) * $r)], _
[0, $r]]
$Brush = _GDIPlus_BrushCreateSolid(0xFFff0000)
_GDIPlus_GraphicsFillPolygon($Graphic, $aPoints, $Brush)
;输出文本
$zeaa = GUICtrlRead($zea)
$zebb = GUICtrlRead($zeb)
$zedd = GUICtrlRead($zed)
$zedx = GUICtrlRead($banjingx1)
$zhang_rx = _GUICtrlSlider_GetPos($banjingx)
$Family = _GDIPlus_FontFamilyCreate($zedd)
$Font = _GDIPlus_FontCreate($Family, $zeaa, 1, 2);创建字体对象
$Font1 = _GDIPlus_FontCreate($Family, $zebb, 1, 2);字体
$Font2 = _GDIPlus_FontCreate($Family, $zedx, 1, 2)
$Brush = _GDIPlus_BrushCreateSolid(0xFFDD2200);0xFFff0000)
$Format = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($Format, 1)
$zhang_w = _GUICtrlSlider_GetPos($zhang_l)
$zhang_gg = _GUICtrlSlider_GetPos($zhang_g)
$zhang_rx1 = _GUICtrlSlider_GetPos($banjingx)
$zhang_rx2 = _GUICtrlSlider_GetPos($banjingx2)
$zhang_r = _GUICtrlSlider_GetPos($banjing)
$Layout = _GDIPlus_RectFCreate(-($zhang_r / 2) + (_GDIPlus_FontGetSizea($Font)) * 1 + 1, ($zhang_r + _GDIPlus_FontGetSizea($Font)) / 1.23 - $zhang_rx + 5, $zhang_r - (_GDIPlus_FontGetSizea($Font)) * 2, _GDIPlus_FontGetSizea($Font))
$BA1 = $zhang_r / 3.5 - $zhang_r + $zhang_rx2 - 18
$BA2 = $zhang_r / 2 - $zhang_r + $zhang_rx1
$BA3 = $zhang_rx2
$BA4 = $zhang_gg
$Layout3 = _GDIPlus_RectFCreate($BA1, $BA2, $BA3, $BA4)
$Layout2 = _GDIPlus_RectFCreate(-55, 60, 120, 100)
_GDIPlus_GraphicsDrawStringEx($Graphic, $zhang_name, $Font2, $Layout, $Format, $Brush)
_GDIPlus_GraphicsResetTransforma($Graphic)
_GDIPlus_GraphicsTranslateTransforma($Graphic, $Width / 2, $Height / 2)
_GDIPlus_GraphicsRotateTransforma($Graphic, $zhang_jiaodu)
Dim $sp = StringSplit($zhang_danwei, "")
For $i = 1 To $sp[0]
$Brush = _GDIPlus_BrushCreateSolid(0xFFff0000)
$Layout = _GDIPlus_RectFCreate(-10, $zhang_r / (-2) + (_GDIPlus_FontGetSizea($Font)) / 2)
_GDIPlus_GraphicsDrawStringEx($Graphic, $sp[$i], $Font, $Layout, $Format, $Brush)
_GDIPlus_GraphicsRotateTransforma($Graphic, $zhang_jj)
Next
_GDIPlus_GraphicsResetTransforma($Graphic)
$Bmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$OldBmp = GUICtrlSendMsg($pic, 0x0172, 0, $Bmp)
$CLSID = _GDIPlus_EncodersGetCLSID("PNG")
_WinAPI_DeleteObject($OldBmp)
_WinAPI_DeleteObject($hImage)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($Graphic)
_GDIPlus_PenDispose($pen)
_GDIPlus_FontDispose($Font)
_GDIPlus_FontFamilyDispose($Family)
_GDIPlus_StringFormatDispose($Format)
_GDIPlus_BrushDispose($Brush)
_GDIPlus_Shutdown()
EndFunc ;==>wjx
|