การแสดงภาพบน GUI
ผมจะเเสดงตัวอย่างการนำภาพขึ้นมาแสดงบน GUI ภาษา Autoit กันนะครับ
; Load PNG image
_GDIPlus_StartUp()
$hImage = _GDIPlus_ImageLoadFromFile("ที่อยู่ไฟล์")
; Create GUI
$hGUI = GUICreate("title",
_GDIPlus_ImageGetWidth($hImage),
_GDIPlus_ImageGetHeight($hImage))
GUISetState()
; Draw PNG image
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
; Loop until user exits
do
;do somthing
until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ShutDown()
เท่านี้ก็ได้แล้ว

อธิบายเพิ่มเติม
1.ใช้ _GDIPlus_ImageLoadFromFile ในการโหลดภาพโดยส่ง parameter ที่อยู่ไฟล์
2. _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) จากนั้นเอามาแสดงใน GUI ที่สร้างไว้
ความคิดเห็น
แสดงความคิดเห็น