shweii 发表于 2010-7-6 19:14:40

复制一个窗口的两个控件类值到另一个窗口的对应的两个类里

不知道标题表达的清不清楚
获取一个窗口的两个控件里的值,填充到另一个窗口的对应的两个控件里。
给个例子看下也好,谢谢

ghl781258 发表于 2010-7-10 11:45:03

具体什么控件?

3mile 发表于 2010-7-10 14:50:35

#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)
$Debug_LV = False ; 检查传递给函数的类名, 设置为真并使用另一控件句柄观察其工作

Global $hListView, $edit, $sa, $txit, $a, $Check

Local $GUI, $hImage
$GUI = GUICreate("(UDF Created) ListView Create", 500, 380)
$hListView = GUICtrlCreateListView('文件', 2, 2, 200, 330, $WS_BORDER)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER))
_GUICtrlListView_SetView($hListView, 3);设置样式,可选(1、2、3、4)
$edit = GUICtrlCreateEdit("", 250, 2, 240, 330)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
GUISetState()

;GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; 添加列
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 180)

; 添加项
For $i = 0 To 10
      _GUICtrlListView_AddItem($hListView, "项目-" & $i, $i)
Next

; 循环至用户退出
While 1
      $a = _GUICtrlListView_GetItemCount($hListView)
      For $i = 0 To $a
                $Check = _GUICtrlListView_GetItemChecked($hListView, $i)
                If $Check = True Then
                        $txit &= _GUICtrlListView_GetItemText($hListView, $i) & @CRLF
                EndIf
      Next
      If $txit <> $sa Then
                GUICtrlSetData($edit, '')
                GUICtrlSetData($edit, $txit, 1)
                $sa = $txit
      EndIf
      $txit = ''

      Switch GUIGetMsg()
                Case -3
                        Exit
      EndSwitch
WEnd
页: [1]
查看完整版本: 复制一个窗口的两个控件类值到另一个窗口的对应的两个类里