karlpopper 发表于 2011-1-5 17:57:19

GDI如何清除字符串呢

例如我想循环显示毫秒
帮助里这样写的
#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)
放到一个循环里就不行了 新的显示了但是旧的也不消失
页: [1]
查看完整版本: GDI如何清除字符串呢