|
|
|
ขอความช่วยเหลือ การทำ NavBarDragDrop (Devexpress) on C# |
|
|
|
|
|
|
|
ลองไปอ่าน tutorial ของ dev ที่เว็บหลักจะดีกว่าครับ
|
|
|
|
|
Date :
2014-12-22 10:22:48 |
By :
deksoke |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (C#)
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
NavBarGroup _hittedGroup;
public NavBarGroup HittedGroup
{
get { return _hittedGroup; }
set { _hittedGroup = value; }
}
Point _hittedPoint;
private void navBarControl1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left )
{
NavBarControl navBarControl = sender as NavBarControl;
NavBarHitInfo info = navBarControl.CalcHitInfo(new Point(e.X, e.Y));
if (info.HitTest == NavBarHitTest.GroupClient)
navBarControl.Cursor = Cursors.SizeNS;
else
navBarControl.Cursor = Cursors.Default;
if (HittedGroup != null)
{
HittedGroup.GroupClientHeight += (e.Location.Y - _hittedPoint.Y);
_hittedPoint = e.Location;
((NavBarControl)sender).DoDragDrop(navBarControl1.SelectedLink, DragDropEffects.Copy);
}
}
}
private void navBarControl1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && Control.ModifierKeys == Keys.None)
{
NavBarControl navBarControl = sender as NavBarControl;
NavBarHitInfo info = navBarControl.CalcHitInfo(e.Location);
if (info.HitTest == NavBarHitTest.GroupClient)
{
HittedGroup = info.Group;
_hittedPoint = e.Location;
}
}
}
private void navBarControl2_DragOver(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void navBarControl2_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void navBarControl2_DragDrop(object sender, DragEventArgs e)
{
NavBarControl nb = sender as NavBarControl;
NavBarItem nodes = (NavBarItem)e.Data.GetData(typeof(NavBarItem));
if (nodes != null)
{
Point pt = nb.PointToClient(new Point(e.X, e.Y));
NavBarHitInfo hi = nb.CalcHitInfo(pt);
if (hi.InGroup)
{
NavBarItemLink itemLink = hi.Group.AddItem();
itemLink.Item.Caption = "xx";
/* for (int i = 0; i < nodes.LinkClicked; i++)
{
string dragString = GetStringByNode(nodes[i]);
NavBarItemLink itemLink = hi.Group.AddItem();
itemLink.Item.Caption = dragString;
}*/
}
}
}
}
ติดตรงวางแล้วไม่มีข้อมูลมา ตรง method navBarControl2_DragDrop nodes == null ตลอดเลย ไม่รู้ว่ามัน Get ค่ามายังไง
|
|
|
|
|
Date :
2014-12-22 16:18:21 |
By :
ipstarone |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|