ContextMenuStrip 至表單。ContextMenuStrip 屬性指向該元件。
3. 程式碼動態加入 ToolStripMenuItem:
contextMenuStrip1.Items.Add(msEditNew);
contextMenuStrip1.Items.Add(msEditBar1); // 分隔線
contextMenuStrip1.Items.Add(msEditCut);
contextMenuStrip1.Items.Add(msEditPaste);
contextMenuStrip1.Items.Add(msEditDelete);
Folder.cs、Txt.cs 封裝檔案/目錄/文字操作。ListView (多檢視模式)、ImageList (圖示資源)、ContextMenuStrip (右鍵選單)。| 屬性 | 用途 |
|---|---|
| View | LargeIcon/SmallIcon/List/Details 四種檢視 |
| LargeImageList / SmallImageList | 綁定 ImageList 提供圖示 |
| MultiSelect | 允許多選 |
| SelectedItems | 取得選取項目集合 |
圖示容器,不直接顯示,透過 ListView.LargeImageList、TreeView.ImageList 等綁定至顯示控件。