找回密码
 加入
搜索
查看: 1047|回复: 2

ControlMove对GUICtrlCreateObj控件无效

[复制链接]
发表于 2009-5-21 17:13:35 | 显示全部楼层 |阅读模式
本帖最后由 sd007 于 2009-5-21 22:04 编辑

用GUICtrlCreateObj创建的控件不能用ControlMove调整大小,移动位置,请问有什么办法解决?
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Example()

; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
;
; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
Func Example()
    Local $Form1, $oIE, $GUIActiveX, $GUI_Button_Back, $GUI_Button_Forward
    Local $GUI_Button_Home, $GUI_Button_Stop, $GUI_Button_Move, $msg
    
    $oIE = ObjCreate("Shell.Explorer.2")

   ; Create a simple GUI for our output
    $Form1=GUICreate("Embedded Web control Test", 800, 600, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $GUIActiveX = GUICtrlCreateObj ($oIE, 10, 40, 600, 360)
    $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 520, 100, 30)
    $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 520, 100, 30)
    $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 520, 100, 30)
    $GUI_Button_Stop = GUICtrlCreateButton("Stop", 330, 520, 100, 30)
        $GUI_Button_Move = GUICtrlCreateButton("移动控件", 430, 520, 100, 30)

    GUISetState()      ;Show GUI

    $oIE.navigate("http://www.baidu.com")

   ; Waiting for user to close the window
    While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $GUI_Button_Home
                $oIE.navigate("http://www.autoitscript.com")
            Case $msg = $GUI_Button_Back
                $oIE.GoBack
            Case $msg = $GUI_Button_Forward
                $oIE.GoForward
            Case $msg = $GUI_Button_Stop
                $oIE.Stop
            Case $msg = $GUI_Button_Move
                            ControlMove($Form1, "", $GUIActiveX, 1, 1, 700, 500);不起作用
                                                    ControlMove($Form1, "", "Internet Explorer_Server1", 0, 0, 700, 500);宽高缩小时有用,宽高放大没用
                             _WinAPI_ShowWindow($Form1, @SW_HIDE)
                            _WinAPI_ShowWindow($Form1, @SW_SHOW)
        EndSelect
        
    WEnd

    GUIDelete()
EndFunc  ;==>Example
发表于 2009-5-21 18:52:55 | 显示全部楼层
本帖最后由 cnsnc 于 2009-5-21 18:55 编辑

觉得楼主应该把帮助里“GUI相关”里的内容看一下,随便看看就能解决你的问题了。_WinAPI_ShowWindow也没有必要用,GUI里有简单的方法。
 楼主| 发表于 2009-5-21 22:04:13 | 显示全部楼层
谢谢指点,GUICtrlSetPos确实好用
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-10 13:38 , Processed in 0.076756 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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