All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET技巧:同时对多个文件进行大量写操作对性能优化_[Asp.Net教程]
php中关于处理字符串时效率的讨论_php资料_编程技术
PHP+MYSQL留言本_[PHP教程]
ADO.NET2.0跟ADO.NET3.0的一些新特性简要介绍_.net资料_编程技术
SQL语句中的布尔表达式_[SQL,Server教程]
Visual Studio 2005中Crystal Reports数据源列举
asp.net连接Access数据库_[Asp.Net教程]
asp.net2.0实现语言和主题的切换_[Asp.Net教程]
ASP.NET,防盗链源码_[Asp.Net教程]
ASP.NET,MVC+LINQ开发一个图书销售站点(7)-图书分类管理_[Asp.Net教程]
Reading number is top 10 pictures
Azusa Yamamoto1
Sora aoi on twitter1
The money of more than 100 countries and regions11
NeedWallpaper14
Cesarean section, bloody, silently into it!2
girl of HuNan name is LiXiang(湖南辣姐李湘的写真)
The world's ten biggest attractions of inventory super the moon
一个武林高手的故事
Go to the national museum2
Summer is most suitable for young people to travel in China1
Download software ranking
Such love down(擒爱记)
美女写真3
Kung.Fu.Panda.2
Proficient in Eclipse
徐若瑄成名作“魔鬼天使”
Unix video tutorial19
天龙八部最新服务端
美女写真2
WebService在.NET中的实战应用教学视频 → 第1集
Popkart Cracked versions Mobile phone games
delv published in(发表于) 2014/1/8 7:02:50 Edit(编辑)
C#:从DataGridView控件托放数据到TreeView控件_[Asp.Net教程]

C#:从DataGridView控件托放数据到TreeView控件_[Asp.Net教程]

C#:从DataGridView控件托放数据到TreeView控件_[Asp.Net教程]

实现方法,在datagridview的mousedown事件中开始 托放。
然后在treeview 的 DragEnter 中接收托放。
最后在treeview的 DragDrop 中处理托放结果。
注:treeview的allowdrop属性要设置为 true。

1private void dataGridView1_MouseDown(object sender, MouseEventArgs e)
2 {
3 if (e.Button == MouseButtons.Right)
4 {
5 DataGridView.HitTestInfo info = dataGridView1.HitTest(e.X, e.Y);
6
7 if (info.RowIndex >= 0)
8 {
9 DataGridViewRow dr = (DataGridViewRow)
10 dataGridView1.Rows[info.RowIndex];
11 if (dr != null)
12 dataGridView1.DoDragDrop(dr, DragDropEffects.Copy);
13 }
14 }
15 }
16
17 private void treeView1_DragEnter(object sender, DragEventArgs e)
18 {
19 e.Effect = DragDropEffects.Copy;
20 }
21
22 private void treeView1_DragDrop(object sender, DragEventArgs e)
23 {
24 if (e.Data.GetDataPresent(typeof(DataGridViewRow)))
25 {
26 Point p = treeView1.PointToClient(new Point(e.X, e.Y));
27 TreeViewHitTestInfo index = treeView1.HitTest(p);
28
29 if (index.Node != null)
30 {
31
32 DataGridViewRow drv = (DataGridViewRow)e.Data.GetData(typeof(DataGridViewRow));
33 index.Node.Text = "Drop: " + drv.Cells[0].ToString();
34
35 }
36 }
37 }


来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.