#include <GDIPlus.au3>
Dim $aHzBs[5]
;宋体笔顺库
$aHzBs[1] = "0:(612,24) (648,48) (528,72) (390,90) (282,102) (120,114)#1:(144,138) (204,204) (228,252)#2:(330,126) (384,192) (402,246)#3:(564,114) (600,132) (528,216) (462,282)#4:(78,252) (72,330) (60,372) (30,414)#5:(78,282) (696,282) (642,366) (696,282) (726,264)#6:(66,408) (672,408) (630,390) (588,408)#7:(312,294) (348,312) (318,384) (288,444) (246,510) (186,582) (132,630) (36,684)#8:(252,504) (540,504) (570,486) (540,504) (462,600) (408,654) (330,702) (264,726) (204,744) (114,756)#9:(258,504) (306,576) (354,624) (420,672) (504,708) (564,726) (654,744) (720,750)"
$aHzBs[2] = "0:(324,54) (360,90) (234,120) (60,150)#1:(30,282) (726,282) (672,264) (618,282)#2:(240,120) (240,678) (234,708) (198,750) (114,678)#3:(30,486) (54,522) (396,360)#4:(408,36) (444,60) (450,312) (456,408) (468,492) (480,528) (498,570) (528,618) (570,666) (618,708) (660,732) (708,750) (714,582)#5:(612,336) (648,366) (576,462) (522,522) (474,570) (402,624) (312,678)#6:(522,90) (594,150) (642,210)"
$aHzBs[3] = "0:(144,24) (204,96) (216,120) (228,174)#1:(30,204) (276,204) (312,180) (276,204) (222,282) (174,342) (132,390) (90,438) (42,486) (6,522)#2:(180,336) (180,762)#3:(192,342) (246,384) (276,414) (306,450)#4:(318,102) (744,102) (696,84) (648,102)#5:(402,162) (402,360)#6:(402,192) (648,192) (672,168) (648,192) (648,360)#7:(648,324) (402,324)#8:(336,390) (336,750)#9:(336,426) (702,426) (726,408) (702,426) (702,744)#10:(702,558) (336,558)#11:(522,426) (522,702)#12:(336,702) (702,702)"
$aHzBs[4] = "0:(270,132) (618,132) (648,108) (618,132) (618,378)#1:(234,240) (738,240) (690,222) (642,240)#2:(618,348) (270,348)#3:(276,456) (666,456) (618,438) (570,456)#4:(234,570) (714,570) (666,552) (618,570)#5:(426,24) (456,36) (456,720)#6:(36,132) (228,132) (258,114) (228,132) (78,348) (48,366) (78,348) (222,348) (246,324) (222,348) (204,438) (186,522) (168,576) (132,642) (90,690) (18,750)#7:(60,438) (90,510) (114,564) (150,618) (198,666) (246,702) (294,726) (366,744) (456,756) (732,756)"
$hGUI = GUICreate("汉字笔顺演示", @DesktopWidth, @DesktopHeight, 0, 0, 0x80000000);$WS_POPUP = 0x80000000
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
;_GDIPlus_GraphicsClear ($hGraphic, 0xFFFFFFFF)
;_SetCursor(@ScriptDir & "\data\default.cur", 32512)
For $i=1 To 4
_DrawHzBs($aHzBs[$i], $hGraphic, 4*$i, ($i-1)* 200)
;_GDIPlus_GraphicsClear ($hGraphic, 0xFFFFFFFF)
Next
MsgBox(4096,"ok","结束")
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
GUIDelete($hGUI)
Func _DrawHzBs($sHzBs, $hGraphic, $iZoom = 1, $x0=0)
$iZoom = Int($iZoom)
If $iZoom<1 Then $iZoom=1
If $iZoom>32 Then $iZoom=32
Local $iPen = Int(32/$iZoom)
Local $aBs = StringSplit($sHzBs, '#', 2);每一个笔画
Local $aXy1, $aXy2, $aCoordinate, $iTemp
$hPen = _GDIPlus_PenCreate(0xffFF0000,$iPen);红色,重量1
For $i=0 To UBound($aBs)-1
$aCoordinate = StringRegExp($aBs[$i], "\((\d+,\d+)\)", 3);x,y坐标
For $j = 0 To UBound($aCoordinate)-2
$aXy1 = StringSplit($aCoordinate[$j],",",2)
$aXy2 = StringSplit($aCoordinate[$j+1],",",2)
;按单个笔划演示
$aXy1[0]=Int($aXy1[0])
$aXy1[1]=Int($aXy1[1])
$aXy2[0]=Int($aXy2[0])
$aXy2[1]=Int($aXy2[1])
Select;修正阿福宋体笔划顺序库Bug,为从上到下,从左到右
Case $aXy1[0]=$aXy2[0] And $aXy1[1]>$aXy2[1]
$iTemp = $aXy1[1]
$aXy1[1] = $aXy2[1]
$aXy2[1] = $iTemp
Case $aXy1[1]=$aXy2[1] And $aXy1[0]>$aXy2[0]
$iTemp = $aXy1[0]
$aXy1[0] = $aXy2[0]
$aXy2[0] = $iTemp
EndSelect
MouseMove(Int($aXy1[0]/$iZoom)+$x0, Int($aXy1[1]/$iZoom))
_GDIPlus_GraphicsDrawLine ($hGraphic, Int($aXy1[0]/$iZoom)+$x0, Int($aXy1[1]/$iZoom), Int($aXy2[0]/$iZoom)+$x0, Int($aXy2[1]/$iZoom), $hPen) MouseMove(Int($aXy2[0]/$iZoom)+$x0, Int($aXy2[1]/$iZoom))
Next
Sleep(50);每一个笔划之间延时,演示用
Next
EndFunc