|
|
@@ -149,7 +149,9 @@ namespace WPFDemo |
|
|
|
DropPopup.HorizontalOffset = ptLeftUp.X + x - ((FrameworkElement)ChildElement).ActualWidth / 2; |
|
|
|
DropPopup.VerticalOffset = ptLeftUp.Y + y - ((FrameworkElement)ChildElement).ActualHeight / 2; |
|
|
|
} |
|
|
|
MoveListBoxStyle(e,true); |
|
|
|
|
|
|
|
//蒙层打开,表明拖拽开始,设置透明度和显示状态 |
|
|
|
MoveListBoxStyle(e, true); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
@@ -159,7 +161,7 @@ namespace WPFDemo |
|
|
|
/// 移动效果 |
|
|
|
/// </summary> |
|
|
|
/// <param name="boxItem"></param> |
|
|
|
private void MoveListBoxStyle(MouseEventArgs e,bool isBool) |
|
|
|
private void MoveListBoxStyle(MouseEventArgs e, bool isBool) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
@@ -170,12 +172,10 @@ namespace WPFDemo |
|
|
|
{ |
|
|
|
if (item != ChildListBoxItem)//这就是其他控件 |
|
|
|
{ |
|
|
|
double item_width = item.ActualWidth; |
|
|
|
double item_height = item.ActualHeight; |
|
|
|
double item_x = e.GetPosition(item).X; |
|
|
|
double item_y = e.GetPosition(item).Y; |
|
|
|
double Child_x = e.GetPosition(ChildElement).X; |
|
|
|
double Child_y = e.GetPosition(ChildElement).Y; |
|
|
|
double item_width = item.ActualWidth; //当前行宽 |
|
|
|
double item_height = item.ActualHeight; //当前行高 |
|
|
|
double item_x = e.GetPosition(item).X; //鼠标相对当前行X位移 |
|
|
|
double item_y = e.GetPosition(item).Y; //鼠标相对当前行Y位移 |
|
|
|
|
|
|
|
if (item_y <= item_height && item_y > 0 && item_x > 0 && item_x <= item_width)//鼠标进入哪一行,则将那一行变灰 |
|
|
|
{ |
|
|
|