




已阅读5页,还剩243页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1 WindowsCE程式設計實務 使用eMbeddedVisualBasic Chapter5 2 Outline CommonDialogControlFileandFileSystemControlsAppandClipboardObjectsMenuBarandImageListControlsTreeViewandListViewControlsGridControlTabStripControl 3 CommonDialogControl 一般檔案處理程式中 我們要開啟舊檔或另存新檔等 處理這些動作的對話框即是CommonDialog 4 CommonDialogProperties CancelError 設定一個使用者按下 取消 按鈕時 會不會產生錯誤代碼 預設是False 即不會 Color 傳回或設定CommonDialog的顏色 DefaultExt 設定預設的副檔名 DialogTitle 設定對話框的標題 當我們要開啟的對話框是 Color 或 Font 時 這個屬性不會作用 object DialogTitle title 5 CommonDialogProperties Cont FileName 傳回或設定所選取檔案的路徑和檔案名稱 object FileName pathname pathname表示特定的路徑和檔案名稱 如果在 Open 對話框結束之後 FileName 則代表使用者沒有選取任何一個檔案 FileTitle 和FileName很像 但FileTitle只包含檔案名稱 不包含檔案的路徑 6 CommonDialogProperties Cont Filter 比如我們希望找的檔案是 bmp檔 則可以把 bmp副檔名設定在Filter中 Object Filter description1 filter1 description2 filter2 CommonDialog1 Filter CommonDialog1 Filter Allfiles CommonDialog1 Filter Textfiles txt CommonDialog1 Filter Bitmaps 2bp bmp TextFiles txt 7 CommonDialogProperties Cont FilterIndex 設定或傳回一個內定的filterfor Open 或 SaveAs 內定是1 Flags 設定對話框中的選項object Flags Value 8 CommonDialogProperties Cont Open和SaveAs對話框 9 CommonDialogProperties Cont FontBold FontItalic FontUnderline FontName FontSizeHelpCommand returnsandsetsthetypeofHelprequestedobject HelpCommand value 10 CommonDialogProperties Cont HelpContext returnsandsetsthecontextidentifierofarequestedHelptopic object HelpContext value HelpFile 應用程式如果有Help檔 可以將Help檔的檔名和路徑指定給這個屬性 InitDir 設定預設的目錄Max Min 可選取字形的最大和最小值 MaxFileSize returnsandsetsthemaximumsizeofthefilenameopenedusingtheCommonDialogcontrol 範圍是1 32KB 11 CommonDialogMethods ShowOpen 顯示Open對話框 12 CommonDialogMethods Cont ShowSave 顯示 SaveAs 對話框 13 CommonDialogMethods Cont ShowColor 顯示 Color 對話框 14 CommonDialogMethods Cont ShowFont 15 CommonDialogMethods Cont ShowHelp 16 MiniSee ImageCtlName imgShow CheckBoxName chkStretch cmdOpen lblFileName CommonDialogName dlgPictureOpen 17 MiniSee Cont 18 FileandFileSystemControls 在eVB中關於檔案處理有兩個元件 File與FileSystem File提供應用程式建立檔案 讀寫檔案的功能 FileSystem提供應用程式刪除 複製 搬移檔案及建立 刪除目錄的功能 19 FileControlProperties Attr 取得FileControl開啟檔案的模式 並記錄關於下次fileread write的起點位置 file Attr 20 FileControlProperties Cont EOF 判斷是否已在檔案的結尾 Loc 傳回以開啟的檔案中 目前的讀取或寫入的位置 Seek 設定開啟的檔案中 下一個要讀取或寫入資料位置 file Seek position Seek值會一直比Loc多1 但如果剛開啟一個檔案 Seek Loc 1 Seek值不可為0或負數 21 FileControlMethods Close Get 讀取已開啟的檔案file GetData Recnumber Recnumber 用來指定讀取檔案的位置 如果是Random模式 所用的單位就是recordnumber 如果檔案以binary模式開啟 則指定的單位便是byte Input 如果檔案是以 輸入 或 binary 模式開啟時 我們可以使用這個方法來讀取資料 file Input number number 指定要讀取的字元數 傳回是字串形式的值 通常我們使用Input讀取檔案時 會使用LinePrint寫入資料 22 FileControlMethods Cont InputB 如果檔案是以 輸入 或 binary 模式開啟時 我們可以使用這個方法來讀取資料 file Input number number 指定要讀取的byte數 傳回是陣列形式的值 通常我們使用InputB讀取檔案時 會使用LinePrint或Put寫入資料 23 FileControlMethods Cont InputFields 讀取已開啟的循序檔 輸入 或 binary 模式 InputFields number number 要讀取欄位之數目 欄位之間以頓號做區隔 傳回型態為variant的一維陣列 通常我們使用InputField讀取檔案時 會使用WriteField寫入資料 InputField讀取內容和資料形式有關 24 FileControlMethods Cont LineInputString 一次會從循序檔案中讀取一行資料 直到復位 Chr 13 或 復位加上換行 Chr 13 Chr 10 字元為止 file LineInputStringDatareadwithLineInputStringusuallyiswrittenfromafilewithLinePrint LinePrint writesasinglelinetoanopensequentialfile file LinePrintoutputoutput 要寫到檔案中的字串自動在字串後面加上換行與復位符號 25 FileControlMethods Cont Open file Openpathname mode access lock reclength mode 開啟檔案的模式 1 input 2 output 4 Random 8 Append 32 binary access 存取的模式 讀 1 寫 2 讀寫 3 預設值 lock Operationspermittedontheopenfilebyotherprocesses Shared LockRead LockWrite Default andLockReadWrite 1 2 3 0 reclength 指定資料記錄的長度 32767byte 如果檔案是隨機存取檔 這個數值指的是record的長度 如果是一般的循序檔 指的便是字元數 26 FileControlMethods Cont Put 將一個變數內容寫進檔案中 file Putdata recnumber recnumber Recordnumber Randommodefiles orbytenumber Binarymodefiles Put與Get是一對WriteFields 把資料寫入循序檔中File WriteFields data 沒有 data 時會寫入一個空行 27 FileSystemControlMethods Dir 依據我們設定的條件和屬性 把符合的檔案名稱列出來 file Dir pathname attributes pathname Stringexpressionthatspecifiesafilenameorpath 檔案的屬性選項 28 FileSystemControlMethods Cont FileCopy 複製檔案filesystem FileCopyPathName NewPathNameFileDateTime 傳回檔案建立的時間 或者檔案最近修改的時間filesystem FileDateTime pathname FileLen 查詢檔案的長度filesystem FileLen pathname 29 FileSystemControlMethods Cont GetAttr 取得檔案或目錄的屬性filesystem GetAttr pathname Kill 刪除檔案filesystem KillPathnameMkDir 建立新目錄filesystem MkDirPathnameMoveFile 更改檔案或目錄名稱filesystem MoveFilePathname NewPathName 30 FileSystemControlMethods Cont RmDir 移除目錄filesystem RmDirPathNameSetAttr 設定檔案的屬性filesystem SetAttrpathname attributes 31 FileSystemControlMethods Cont 32 AppProperties Comments 傳回或設定應用程式的註解 型態為字串 執行階段為唯讀 object CommentsCompanyName 傳回或設定應用程式的所屬的公司名稱或作者姓名 執行階段為唯讀 object CompanyNameEXEName 傳回執行檔的名稱 不包含副檔名 Object EXENameFileDescription 傳回或設定應用程式的檔案說明資訊 型態為字串 執行階段為唯讀 LegalCopyRight 傳回或設定應用程式的著作權資訊 型態為字串 執行階段為唯讀 33 AppProperties Cont LegalTrademarks 傳回或設定應用程式的商標資訊 型態為字串 執行階段為唯讀 Major Minor 傳回或設定專案版本編號的主要編號與次要編號 執行階段為唯讀 Thispropertyprovidesversioninformationabouttherunningapplication Thevaluesrangefrom0through9 999 Path 以字串形式傳回或設定應用程式目前的路徑ProductName 傳回或設定應用程式的產品名稱 型態為字串 執行階段為唯讀 34 AppProperties Cont Revision 傳回或設定專案版本編號當中的修訂資訊 執行階段為唯讀 ThevalueoftheRevisionpropertyisintherangefrom0through9 999 TaskVisible 設定應用程式在執行時是否會出現在Windows的工作清單當中 預設值是True Title 傳回或設定應用程式的標題 35 AppMethods End 結束應用程式app EndWaitForEvents 使應用程式暫停 一直到事件發生才繼續執行 app WaitForEventsEndWaitForEvents 使因WaitForEvents而暫停的應用程式繼續執行 36 ClipboardMethods Clear 清除Clipboard內容object ClearGetText 傳回一字串 取得Clipboard文字內容clipboard GetText format SetText 把字串放到Clipboard中 clipboard SetTextData format 37 ImageListControlProperties ImageListControl物件可看程式管理小圖形檔的元件 提供其他物件使用小圖示的功能 大部分是和其他控制項一併使用 像是TreeView CommandBar和TabStripCount 傳回ImageList物件當中的圖檔數量 object CountImageWidth ImageHeighthImageList returnsahandletoanImageListcontrol 如果其他物件想要使用ImageList物件的話 可以使用此屬性來取得ImageList物件的控制權 38 ImageListControlMethods Add ImageList 把圖形加到ImageList物件中 imagelist Add filename 在eVB的ImageList物件所支援的圖檔格式只有bmp dib及2bp Imagescanbedifferentsizes butafteryouaddthefirstimage allsubsequentlyaddedimagesaresizedidenticallytothefirst Removeobject Remove index index 要被移除的圖檔之索引值 39 ImageListControlMethods Cont RemoveAll ImageList imageList RemoveAllReplace 更換ImageList物件中的一個圖檔 imagelist Replace index filename Reset 移除所有圖形檔 並重新設定所有的資料 imagelist ResetResetclearstheImageWidthandImageHeightentries enablingthecontroltobeusedwithdifferentlysizedimages NotethatthisalsoreleasestheWin32ImageListhandle 40 ImageListExample imglst1 PictureBox1 Command1 41 ImageListExample Cont 42 MenuBarControlProperties ControlsCollection MenuBar中所有正在使用物件的集合 在eVB中 MenuBar物件使用MenuControlsCollection集合物件來管理MenuBar物件中所有的Menu和Button 我們可以藉由MenuControlsCollection來替MenuBar加上Menu或Button object Controls index index Integerwitharangefrom0tothenumberofcontrols 1 43 MenuBarControlProperties Cont ImageList 指定要使用的ImageList物件 object ImageList hImagelist himagelist ImageListobject的屬性 在MenuBar中提供兩種Menu型式 一種是一般選單式的Menu 另一種是類似工具列的Button型式的Menu 在Button型式的MenuBar型式有兩種 一種是CommandButton 文字按鈕 另一種是可以使用ImageList物件提供小圖示的按鈕 SeeExample MiniWord 44 MenuBarControlProperties Cont Example SetMenuBar ImageList ImageList1 hImageList 45 MenuBarControlProperties Cont NewButton object NewButton Boolean True 我們沒有對Menu做任何設定就自動會有一個Menu項目 如果不需要這個Menu項目的話 把這個屬性設為False 46 MenuBarControlEvents ButtonClick ThiseventoccurswhenauserclicksonabuttononaMenuBarcontrol PrivateSubmenubar ButtonClick button button CopyofaneditedButtonobjectonaMenuBar 47 MenuBarControlEvents Cont MenuClick ThiseventoccurswhenauserchoosesanItemobjectfromamenuonaMenuBarcontrol PrivateSubobject MenuClick menu menu CopyofthechosenItemobject NewClick Thiseventoccurswhenthe New buttononaMenuBarcontrolisclicked PrivateSubMenuBar NewClick 48 MenuControlsCollectionProperties Item 在MenuControlscollection當中的項目 eVB使用ItemsCollection來管理Item object Item index Count 物件的總數 49 MenuControlsCollectionMethods AddButton addsaMenuControlbuttontotheMenuControlscollectionofaMenuBarcontrol MenuBar Controls AddButton key key UniquestringfortheKeypropertyofthenewButton Example DimBAsMenuBarButtonSetB MenuBar1 Controls AddButton B Style mbrCheck 50 MenuControlsCollectionMethods Cont AddMenu 在MenuControlscollection當中加入一個Menu物件 MenuBar Controls AddMenu caption key Example DimMAsMenuBarMenuSetM MenuBar1 Controls AddMenu M Style mbrMenuSeparatorClear 清除MenuControlscollection中所有的物件 MenuControlsObject Clear 51 ItemsCollectionProperties Caption Checked 布林值 Thispropertyreturnsandsetsavaluethatdetermineswhetheracheckmarkisdisplayednexttoamenuitem Enabled Thispropertyreturnsandsetsavaluethatdetermineswhetheraformorcontrolcanrespondtouser generatedevents Index Thispropertyreturnsthenumberthatuniquelyidentifiesanobjectinacollection Key String Returnsandsetsastringthatuniquelyidentifiesamemberinacollection 52 ItemsCollectionProperties Cont Parent Thispropertyreturnstheform object orcollectionthatcontainsacontrol Style ThispropertyreturnsandsetstheappearanceofabuttononaMenuBarcontroloramenuitemonaMenuBarcontrol object Style Value 53 ItemsCollectionProperties Cont ThefollowingtableshowsthesettingsfortheStylepropertyforaButtononaMenuBarcontrol 54 ItemsCollectionProperties Cont ThefollowingtableshowsthesettingsfortheStylepropertyforaMenuItemonaMenuBarcontrol 55 ItemsCollectionProperties Cont SubItems ThispropertyreturnsanItemscollectionfromanItemonaMenuBarcontrol EachItemhasaSubItemspropertythatreturnsanItemscollectionthatcontainsthesubmenusoftheItem TheSubItemspropertyenablestheMenuBartohavemenuswithsubmenus 56 ItemsCollectionProperties Cont Tag Thispropertyreturnsandsetsanexpressionthatstoresanyextradataneededforanapplication Visible Thispropertyreturnsandsetsavaluethatindicateswhetheranobjectisvisibleorhidden 57 ItemsCollection ThisobjectrepresentsacollectionofMenuobjectsforaMenuBarorCommandBarMenuBarcontrol Example MenuBar Items index Count 集合物件中的物件總數Item 集合物件當中的資料項目Add 在集合物件當中加入一個資料項目object Add index type key caption style Key 獨一無二的字串 用來代表該資料項目Style 該資料項目的形式 58 ItemsCollection Cont ThepossiblevaluesforthetypeparameterExample DimBAsCommandBarButtonSetB CommandBar1 Controls Add cbrButton B Style cbrCheck 59 ItemsCollection Cont Add ThismethodaddsamenubarItemobjecttotheMenuItemscollectionofaMenuBarcontrol items Add index key Caption style style 資料項目的形式 60 ItemsCollection Cont Clear ThismethodclearsthecontentsofaListBoxobject ComboBoxobject orthesystemClipboardobject object ClearRemove 移除一項資料項目object Remove index 61 MenuBarButtonObjectProperties Image setstheimageassociatedwithanobject object Image value value 指定要使用ImageList物件當中的第幾張圖Style 設定MenuBarButtonObject的型態object Style value value 按鈕型態 62 MenuBarButtonObjectProperties Cont 63 MenuBarButtonObjectProperties Cont MixedState ThispropertycausesaButtonobjecttoappearshaded object MixedState value boolean ToolTip 設定當滑鼠移動到按鈕上方時會顯示的提示文字 object ToolTip String Value 取得或設定按鈕目前的狀況object Value value 64 MenuBarButtonObjectProperties Cont 65 MenuBar範例 menubar 66 MenuBar範例 Cont items 67 MenuBar範例 Cont subitems 68 MenuBar範例 Cont MenuBarName mnuMenu 69 MenuBar範例 Cont 70 MenuBar範例 Cont 在MenuBar上有三個Menu 為New File和Edit 因為New是預設的項目 所以我們只要再新增另兩個Menu項目即可 接著在File這個Menu項目下加入4個資料項目 Open Add 分隔線及delete 同樣我們在Edit這個Menu項目下加入Copy Cut Paste和find 在Paste資料項目下加入兩個子項目 subitem 也是用Add 71 MenuBar範例 Cont 72 MenuBar範例 Cont 我們用的是Menu型式的MenuBar 所以使用者選擇資料項目引發的事件是MenuClick 參數Item型態為MenuBar Item 指的是使用者所選擇的項目 73 範例 Button型式的Menu 74 範例 Button型式的Menu Cont 75 範例 Button型式的Menu Cont 76 範例 Button型式的Menu Cont MenuBarName mnbButton 77 範例 Button型式的Menu Cont 78 範例 Button型式的Menu Cont 我們使用AddButton在MenuBar中加入按鈕 因為加到MenuBar物件的是按鈕 所以使用者引發的事件為ButtonClick 參數Button為使用者按下的按鈕 79 Example MiniWord 80 Example MiniWord Cont 81 Example MiniWord Cont FileName File1 FileSystemName FileSystem1 MenuBarName mnbButton ImageListName ilsALLICons CommonDialogName dlgFile TextBoxName texText LabelName lblFileName 82 Example MiniWord Cont 83 Example MiniWord Cont 84 Example MiniWord Cont 85 Example MiniWord Cont 86 Example MiniWord Cont 87 Example MiniWord Cont 88 Example MiniWord Cont 89 Example MiniWord Cont 90 Example MiniWord Cont 使用ilsALLICons物件的Add把所要顯示的圖檔加到ImageList物件當中 將ilsALLICons的hImageList屬性設定給MenuBar物件mnbButton的ImageList屬性 利用AddButton把按鈕一個一個加入MenuBar中 順便設定Button的Image屬性 用來指定所使用的圖檔 mbuButton Controls AddButton Enabled False 產生一個按鈕空格 如果我們只想產生一個分隔線的話 可以把ButtonStyle設成mbrSeparator 這樣就可以在按鈕間產生分隔線 91 Example MiniWord Cont 當使用者按下 開新檔案 按鈕時 如果文字框中還有文字 必須提醒使用者存檔 然後再開啟新檔 ShowSave ThismethoddisplaystheSaveAsdialogboxoftheCommonDialogcontrol 如果使用者在對話框中輸入檔名 strFileName不是空字串 則進行存檔的動作 呼叫自己寫的SaveFile 若沒有輸入檔名 則將文字框內容清除 若本來就有檔名存在 則直接呼叫SaveFile 92 Example MiniWord Cont 當使用者按下 開舊檔案 按鈕時 如果文字框中有文字 則我們必須先處理存檔的問題 才能再開啟舊檔 處理完後呼叫OpenFile開啟舊檔 首先先使用對話框讓使用者選擇要開啟的文字檔 開檔讀檔的動作交給File1來處理 我們使用fsModeInput模式開啟舊檔 使用LineInputString一行一行讀資料 把讀到的資料先暫存在strTempRead字串當中 再加上換行和復位字元 最後strTemp所存放的便是被讀取的文字檔之所有內容 93 Example MiniWord Cont 當使用者按下 儲存檔案 按鈕時 如果原本使用者沒有輸入檔名 則跳出SaveAs對話框讓使用者可以輸入檔名 如果原本就有檔名 則直接呼叫SaveFile程序 當使用者按下 複製 按鈕時 先用Clear把Clipboard原先內容清掉 而TextBox物件的SelText就是使用者所選取的文字 當使用者按下 剪下 按鈕時 動作與按下 複製 按鈕時差不多 94 Example MiniWord Cont 當使用者按下 貼上 按鈕時 我們使用Clipboard的GetText方法把存放在Clipboard的文字取出 SaveFile程序用來儲存檔案 如果先前同名的檔案存在 則先呼叫Kill刪除以前的檔案 儲存檔案時把文字框txtText內容先放在strTemp中 再用fsModeOutput開啟檔案 使用LinePrint把字串strTemp寫到檔案中 95 Example MiniWord Cont 當使用者按下右上角 OK 按鈕時 我們要注意文字框中的文字是否已經存檔 處理步驟類似按下 開新檔案 當使用者有啟動輸入面版 SIP 時 我們把文字框的高度縮短 方便使用者輸入資料 輸入面版才不會擋到文字框 反之則放大文字框 這在SIPChange程序中執行 bSIPVisible TRUE 代表使用者啟動SIP面版 96 TreeViewControlProperties TreeViewControls使用NodesCollection來管理當中的資料項目 Node物件 HideSelection 決定當物件失焦時 原本選取的文字是否要繼續以明顯的方式顯示 TRUE代表當物件失去焦點時 便不再以明顯的方式顯示原本選取的文字 object HideSelectionImageList 指定所要使用的ImageList物件 object ImageList hImagelist 97 TreeViewControlProperties Cont Identation 傳回或設定TreeViewControl物件的縮排寬度object Identation number LabelEdit 設定使用者是否可以自行更改TreeView物件當中的資料項目的標籤 object LabelEdit integer 98 TreeViewControlProperties Cont LabelEdit屬性和StartLabelEdit方法常並用 我們可以設定什麼時候可以更改資料項目的標籤 LineStyle 設定資料項目間的線條型式object LineStyle number 99 TreeViewControlProperties Cont PathSeparator 用來設定分隔路徑的字串 預設值是 object PathSeparator string SelectedItem 這個屬性會傳回被選取物件的reference object SelectedItemSorted 設定TreeView物件當中的資料項目要不要依英文字母次序排列 object Sorted Boolean 100 TreeViewControlProperties Cont Style 設定物件的顯示型態object Style number 101 TreeViewControlMethods GetVisibleCount 用來設定TreeView顯示區域當中可以顯示資料項目的個數 treeview GetVisibleCountNotethatthereturnvalueisthenumberofitemsthatcanbefullyvisible Ifyoucanseeallof20itemsandpartofonemoreitem thereturnvalueis20 StartLabelEdit 讓使用者開始編輯TreeView物件當中資料項目的標籤 control2 StartLabelEdit 102 TreeViewControlEvents BeforeLabelEdit 當使用者要開始修改資料項目的標籤時會引發此事件 AfterLabelEdit 當使用者始修改資料項目的標籤後會引發此事件 Expand 當使用者展開一個父節點下面的資料項目時會引發此事件 Collapse 當使用者關閉 折疊 一個父節點下面所有的資料項目時會引發此事件 NodeClick 當使用者選擇Node物件時會引發此事件 103 NodesCollectionProperties TreeViewObject使用NodesCollection物件來管理眾多的資料項目 NodesCollection屬性Count 傳回NodesCollection物件當中存放的物件總數object CountItem 物件當中的資料項目 object Item index 104 NodesCollectionMethods Add 在NodesCollection中加入一個Node物件 資料項目 Nodes Add relative relationship key text image selectedimage relative Thekeyofapre existingNodeobjectoraNodeobject Therelationshipbetweenthenewnodeandthispre existingnodeisfoundintherelationshipparameter 105 NodesCollectionMethods Cont relationship 即將要加入的心結點與舊節點的關係 106 NodesCollectionMethods Cont key Uniquestringexpressionthatcanbeusedtoaccessamember 資料項目 oftheNodescollection text 顯示的文字image 用來指定所要用的圖檔 圖檔存放在ImageList中 IntegerthatsetstheicontobedisplayedfromtheImageListcontrolassociatedwiththeTreeViewcontrol selectedimage 用來指定當使用者選擇此節點時要顯示的圖檔 圖檔存放在ImageList中 107 NodesCollectionMethods Cont Clear 移除collection中所有資料項目object ClearRemove 一次只移除一個資料項目object Remove index index 所要移除物件的索引值 108 NodeObjectProperties Child 取得子節點當中 第一個子節點的reference node ChildChildren 傳回子點的個數treeview ChildrenExpanded 設定或取得物件展開的狀況 當這個屬性值為True 代表這個物件被展開 node Expanded value 109 NodeObjectProperties Cont ExpandedImage 設定或取得當這節點被展開時 要使用ImageList物件當中的哪一個圖檔 object ExpandedImage value value integer 用來指定要使用ImageList物件當中的哪一張圖 FirstSibling 傳回同一個階層中的第一個Node物件的reference node FirstSibling 110 NodeObjectProperties Cont FullPath 傳回物件在TreeView當中的完整路徑 Thepropertyreturnsastringthatrepresentsthepathfromtherootnodetonode node FullPathImage 傳回或設定要使用ImageList中的哪一個圖檔 object Image value Key Returnsandsetsastringthatuniquelyidentifiesamemberinacollection object Key string 111 NodeObjectProperties Cont LastSibling 傳回同一個階層中的最後一個Node物件的reference node LastSiblingNext 傳回或設定同一階層中的下一個Node物件的reference object NextParent 傳回上一階層 父節點 中的Node物件的reference object NextPrevious ThispropertyreturnsareferencetotheprevioussiblingNodeofaTreeViewcontrol sNodeobjects object Previous 112 NodeObjectProperties Cont Root 傳回根節點的referenceSelected 用來判定或設定這個節點物件的選取狀況 當值是True 代表這個節點被選取 預設值是False object Selected index Boolean index indexnumberoftheitemintheListBoxcontrol SelectedImage 用來指定當使用者選取此節點時要顯示的圖檔 object SelectedImage value value NumberthatspecifiesanimageinanImageListcontrol 113 NodeObjectProperties Cont Sorted 設定節點是否要按照英文字母順序排列 object Sorted Boolean Text 顯示給使用者看的文字object Text String 114 NodeObjectMethods EnsureVisible 用來保證使用者在TreeView物件當中一定可以看到這個節點物件 Node 如果情況需要的話 會自行捲動捲軸以確保可以顯示出來 所以如果我們要讓一個深藏在TreeView物件當中的節點顯示出來 就可以使用這個方法 object EnsureVisible 115 TreeViewControlExample 116 TreeViewControlExample Cont 117 TreeViewControlExample Cont 118 TreeViewControlExample Cont 119 TreeViewControlExample Cont 120 TreeViewControlExample Cont 121 TreeViewControlExample Cont 122 TreeViewControlExample Cont 123 TreeViewControlExample Cont ImageListName imlProject LabelName lblSelect TreeViewName tvcProject CommandButtonName cmdAddGroup CommandButtonName cmdAddItem CommandButtonName cmdRemove 124 TreeViewControlExample Cont 125 TreeViewControlExample Cont 節點物件分為兩種 一種是可以有子節點的 群組 節點 另外一種是 項目 節點 不再有其他的子節點 strSelectKey 儲存被選擇資料項目的Key屬性值 strSelectText 儲存被選擇資料項目的Text屬性值 IngSelectIndex 儲存被選擇資料項目的索引值 把所要顯示的圖形加入ImageList物件imlProject中 群組關閉 群組開啟 資料項目 把imlProject的hImageList設定給TreeView物件 使TreeView物件可以使用ImageList物件當中的圖檔 126 TreeViewControlExample Cont 將TreeView物件的LabelEdit屬性設為tvwManual 使得使用者無法自行變更節點的標籤 使用Add方法 在TreeView物件中加入第一個節點 Project 127 TreeViewControlExample Cont 128 TreeViewControlExample Cont 當使用者在TreeView物件上做瀏覽時 會引發NodeClick事件 在NodeClick程序中有一個傳入參數Ind
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 文化创意产品研发资金申请2025年政策扶持与产业升级策略报告
- 2025年新能源汽车废旧电池回收处理技术及案例分析报告
- 2025年生物科技行业可持续发展目标(SDGs)实践与产业融合报告
- 煤炭清洁高效燃烧技术在煤炭洗选加工中的应用与发展报告
- 医疗器械临床试验质量管理与规范化2025年发展趋势研究报告
- 2025年建筑信息模型(BIM)在施工全过程精细化管理中的应用策略报告
- 工业互联网平台量子密钥分发技术在智慧医疗领域的应用与挑战报告
- 2025年电商平台内容营销与种草经济产业链研究报告
- 深度解析:2025年工业互联网平台AR交互技术在制造领域的应用创新报告
- 绿色环保产业资金申请政策变化与应对策略报告2025
- 分体空调施工方案及分体空调施工组织设计
- 隧道微台阶开挖施工工法实用文档
- 朝代歌幼儿园教案
- TCL股份有限公司股份组织架构
- 管 制 刀 具课件
- 文学翻译及实例
- 生物多样性保护与建设项目可行性研究报告
- 健康减肥调脂降糖
- VSM价值流图析-图形和步骤11
- LaTeX科技排版课件
- 高考激情教育主题班会课件
评论
0/150
提交评论