找回密码
 加入
搜索
查看: 4453|回复: 13

[GUI管理] 想去掉一个窗口的边框和改变按钮的颜色,请问如果操作?

  [复制链接]
发表于 2015-1-11 15:10:39 | 显示全部楼层 |阅读模式
我想把下段代码的边框,窗口标题等内容去掉,只下中间的编辑区,并且改变按钮颜色,请高手指教,谢谢.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

$hWnd = GUICreate("GDI+ 示例", 400, 300)
GUISetState()

_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsClear($hGraphics)

$hBrush = _GDIPlus_BrushCreateSolid(0xFF009900)
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 36)
$hLayout = _GDIPlus_RectFCreate(0, 0, 400, 300)
$hStringFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hStringFormat, 1)
_GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks", $hFont, $hLayout, $hStringFormat, $hBrush)

$btn=GUICtrlCreateButton ("确定",  235, 220, 50)

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
           Case $msg = $btn
               exitloop
       EndSelect
Wend


_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_FontDispose($hFont)
_GDIPlus_StringFormatDispose($hStringFormat)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2015-1-11 15:32:27 | 显示全部楼层
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hWnd = GUICreate("GDI+ 示例", 400, 300,-1,-1,$WS_POPUP)
GUISetState()

_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsClear($hGraphics)

$hBrush = _GDIPlus_BrushCreateSolid(0xFF009900)
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 36)
$hLayout = _GDIPlus_RectFCreate(0, 0, 400, 300)
$hStringFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hStringFormat, 1)
_GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks", $hFont, $hLayout, $hStringFormat, $hBrush)

$btn=GUICtrlCreateButton ("确定",  235, 220, 50)

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
           Case $msg = $btn
               exitloop
       EndSelect
Wend


_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_FontDispose($hFont)
_GDIPlus_StringFormatDispose($hStringFormat)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
发表于 2015-1-11 15:37:35 | 显示全部楼层
在按钮下面加上GUICtrlSetBkColor (-1, 0xff0000)可以设置按钮背景颜色
GUICtrlSetColor ( 控件ID, 文本颜色)可以设置按钮文本颜色
发表于 2015-1-12 10:01:03 | 显示全部楼层
回复 2# zhouhaijin
这样去不掉边框
发表于 2015-1-12 11:23:31 | 显示全部楼层
回复 4# netegg


    应该版本问题,我去掉了
发表于 2015-1-12 12:12:11 | 显示全部楼层
本帖最后由 netegg 于 2015-1-12 12:13 编辑

回复 5# zhouhaijin
发个图上来,边框不止像lz说的有宽度的,包括外边线
发表于 2015-1-12 15:58:42 | 显示全部楼层
学习了,感谢分享!
发表于 2015-1-12 17:26:36 | 显示全部楼层
回复 6# netegg


    边线就不知道了,改颜色还没试。现在在外面,等下回去试试
发表于 2015-1-13 10:42:02 | 显示全部楼层
我是来学习的。。
发表于 2015-1-14 11:18:29 | 显示全部楼层
回复 6# netegg





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2015-1-14 11:19:42 | 显示全部楼层
回复 6# netegg


    应该版本问题,我边线也没有
发表于 2015-1-14 11:21:03 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
_Main()

Func _Main()
        Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
        Local $sString = "Hello world", $aInfo

        ; 创建 GUI
        $hGUI = GUICreate("GDI+", 400, 300,@DesktopWidth-450,@DesktopHeight-350,$WS_POPUP)
        GUISetBkColor(0x000000)
        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, 0, 0)
        $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat)
        _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $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
发表于 2015-1-14 15:34:35 | 显示全部楼层
支持,进来学习下
发表于 2015-1-15 09:11:55 | 显示全部楼层
学习学习。。。。。。。。。。。。。。。。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-28 22:19 , Processed in 0.085049 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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