找回密码
 加入
搜索
查看: 1692|回复: 0

[GUI管理] GDI如何清除字符串呢

[复制链接]
发表于 2011-1-5 17:57:19 | 显示全部楼层 |阅读模式
例如我想循环显示毫秒  
帮助里这样写的
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

    ; 创建 GUI
    $hGUI = GUICreate("GDI+ 图形设备接口演示", 400, 300)
    GUISetState()

    ; 绘制字符串
    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
    $hFormat = _GDIPlus_StringFormatCreate ()
    $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
    $hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
    $tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
    _GDIPlus_GraphicsDrawStringEx ($hGraphic, "你好 世界!", $hFont, $tLayout, $hFormat, $hBrush)

    ; 循环到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; 清理资源
    _GDIPlus_FontDispose ($hFont)
    _GDIPlus_FontFamilyDispose ($hFamily)
    _GDIPlus_StringFormatDispose ($hFormat)
    _GDIPlus_BrushDispose ($hBrush)

    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_ShutDown ()

EndFunc   ;==>_Main

但是我把   _GDIPlus_GraphicsDrawStringEx ($hGraphic, "你好 世界!", $hFont, $tLayout, $hFormat, $hBrush)
放到一个循环里就不行了 新的显示了但是旧的也不消失
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-3 04:22 , Processed in 0.076581 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表