我列出文件從目錄上點擊該特定的文件夾名稱,當文件顯示在datagridview。現在使用上下文菜單,我想在該上下文菜單中添加此sendto選項,並希望將該文件發送到任何可移動媒體。如何使用Windows的SendTo選項在我的C#應用程序中使用datagridview
1
A
回答
0
嘗試midify這個例子中,它能夠在不同的列不同的選擇:
//Define different context menus for different columns
private ContextMenu contextMenuForColumn1 = new ContextMenu();
private ContextMenu contextMenuForColumn2 = new ContextMenu();
Add the following line of code in the form load event:
private void Form_Load(object sender, EventArgs e)
{
// Load all default values of controls
populateDataGridView();
// Add context mneu items
contextMenuForColumn1.MenuItems.Add("Make Active", new EventHandler(MakeActive));
contextMenuForColumn2.MenuItems.Add("Delete", new EventHandler(Delete));
contextMenuForColumn2.MenuItems.Add("Register", new EventHandler(Register));
}
Add the following code to mouseup event of the gridview:
private void dataGridView_MouseUp(object sender, MouseEventArgs e)
{
// Load context menu on right mouse click
DataGridView.HitTestInfo hitTestInfo;
if (e.Button == MouseButtons.Right)
{
hitTestInfo = dataGridView.HitTest(e.X, e.Y);
// If column is first column
if (hitTestInfo.Type == DataGridViewHitTestType.Cell && hitTestInfo.ColumnIndex == 0)
contextMenuForColumn1.Show(dataGridView, new Point(e.X, e.Y));
// If column is second column
if (hitTestInfo.Type == DataGridViewHitTestType.Cell && hitTestInfo.ColumnIndex == 1)
contextMenuForColumn2.Show(dataGridView, new Point(e.X, e.Y));
}
}
上如此相似的問題:
2
的快捷方式你在Windows發送的程序「到」菜單存儲在%APPDATA%\Microsoft\Windows\SendTo
文件夾中。
閱讀此文件夾的內容並顯示網格上下文菜單中的選項。
快捷方式是.LNK
文件。解決從LNK文件中的EXE的名稱和呼叫使用System.Diagnostics.Process.Run
下面是EXE如何可以從LNK解決EXE位置上的文件
相關問題
- 1. 的DataGridView不更新(使用C#Windows應用程序)
- 2. 如何在windows應用程序中獲取DataGridView中的組合框選定項?
- 3. 如何做到在使用C#中的Windows應用程序
- 4. 如何在windows應用程序中使用VB.NET項目中的C#類?
- 5. 如何在C/C++應用程序中使用Windows窗體?
- 6. 我如何在我的應用程序中使用選取框?
- 7. 如何在我的Windows Forms應用程序中使用串口?
- 8. 在Web應用程序中使用c#windows應用程序項目
- 9. 我如何從列表框中使用c的windows phone應用程序中獲取所選項目的值#
- 10. 顯示在DataGridView中的C#Windows應用程序陣列的串
- 11. 如何使用Pywinauto在Windows應用程序中選擇圖標
- 12. 如何在我的應用程序中使用c#.net
- 13. 如何在我的C#應用程序中使用SharpNlp
- 14. 如何在C#windows服務應用程序中使用PRISM?
- 15. c#如何在Windows窗體應用程序中使用方法?
- 16. 如何使應用程序顯示爲選項應用程序?
- 17. 使用Windows應用程序c關閉瀏覽器中的單個選項卡#
- 18. 我如何在windows 8商店應用程序中使用backbonejs?
- 19. 我如何使用appcelerator運行我的Windows應用程序?
- 20. 在DataGridView中隱藏任何列標題C#Windows應用程序
- 21. 在DataGridView中使用C#.NET自動完成組合框。Windows應用程序
- 22. 使用C#的Windows窗體中的DataGridView
- 23. 如何在Android應用程序中使用付款選項?
- 24. 允許用戶在Windows 8應用程序的RichEditBox中使用選項卡?
- 25. 如何禁用dataGridView中不可點擊的按鈕(c#windows應用程序)
- 26. 如何使我的應用程序中使用我的變量?
- 27. 使用C#從我的應用程序
- 28. 發佈使用wxWidgets的C++ Linux應用程序的選項
- 29. 使用C#Windows窗體應用程序
- 30. 如何在C#中使用Windows應用程序禁用ComboBox上的快捷鍵?
其實我想移動從網格視圖文件到可移動媒體。 – Mujtaba