請問拖曳功能的寫法.... |
尚未結案
|
akccbh
一般會員 發表:32 回覆:30 積分:12 註冊:2004-07-07 發送簡訊給我 |
以下是Help的範例,但是只針對某一個Item而已,小弟需要複選的,
不知該如何去做...
請幫幫我吧..謝謝.. private void listBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
// Determines which item was selected.
ListBox lb =( (ListBox)sender);
Point pt = new Point(e.X,e.Y);
int index = lb.IndexFromPoint(pt); // Starts a drag-and-drop operation with that item.
if(index>=0)
{
lb.DoDragDrop(lb.Items[index].ToString(), DragDropEffects.Link);
}
} private void richTextBox1_DragEnter(object sender, DragEventArgs e)
{
// If the data is text, copy the data to the RichTextBox control.
if(e.Data.GetDataPresent("Text"))
e.Effect = DragDropEffects.Copy;
} private void richTextBox1_DragDrop(object sender, DragEventArgs e)
{
// Loads the file into the control.
richTextBox1.LoadFile((String)e.Data.GetData("Text"), System.Windows.Forms.RichTextBoxStreamType.RichText);
} 他是再滑鼠點下去選取某一個Item,但是我是需要多個Item複選,所以在
e.Data.GetData 中,他用 e.Data.GetData("Text") 是取一個文字的值,
那我要取 SelectItems 的 Object, 該怎麼做呢 ??? 請幫幫我吧..謝謝..
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |