我有一刀切的申请,有些Thumb控制把物品放在车上。 我想发现,当这些umb子被拖到另一部分时。 然而,拖拉进入被拖走的部件并未发射。 我知道,这部法典是作为拖拉式的物品而设计的,这些物品并不th火。
th的拖拉事件难道不是其他组成部分所听到的一场拖拉事件吗?
如何做到这一点的想法?
我有一刀切的申请,有些Thumb控制把物品放在车上。 我想发现,当这些umb子被拖到另一部分时。 然而,拖拉进入被拖走的部件并未发射。 我知道,这部法典是作为拖拉式的物品而设计的,这些物品并不th火。
th的拖拉事件难道不是其他组成部分所听到的一场拖拉事件吗?
如何做到这一点的想法?
如果 object子在另一部分被移动,则模拟拖拉机进入活动,就必须这样做:
th rag
EventManager.RegisterClassHandler(typeof(Thumb), Thumb.DragDeltaEvent, new RoutedEventHandler(Thumb_DragDeltaEvent), true);
接着,手里看看,拖拉的元件是否超过了聆听移动部分的内容。
void Thumb_DragDeltaEvent(object sender, RoutedEventArgs e)
{
UIElement src = e.Source as UIElement ;
if (src != null)
{
Point srcPositionTopLeft = new Point(Canvas.GetLeft(src), Canvas.GetTop(src));
Point srcPositionBottomRight = new Point(srcPositionTopLeft.X + src.ActualWidth, srcPositionTopLeft.Y + ActualHeight);
Rect srcRect = new Rect(srcPositionTopLeft, srcPositionBottomRight);
Rect transformedSrcRect = src.TransformToAncestor(this.Parent).TransformBounds(srcRect);
Point trgPositionTopLeft = new Point(Canvas.GetLeft(this), Canvas.GetTop(this));
Point trgPositionBottomRight = new Point(trgPositionTopLeft.X + this.ActualWidth, trgPositionTopLeft.Y + this.ActualHeight);
Rect trgRect = new Rect(srcPositionTopLeft, srcPositionBottomRight);
Rect transformedTrgRect = this.TransformToAncestor(this.Parent).TransformBounds(trgRect);
if (transformedSrcRect.Contains(transformedTrgRect) ||
transformedSrcRect.IntersectsWith(transformedTrgRect))
{
//drag is over element
}
}
}
之后再去除事件处理员等。
希望有助于未来的人。
显然没有。 唯一与Thumb有关的事件是DragStarted、DragCompleted和DragDelta。 其他事件是Drag和下降,如你的德拉克·恩特活动。 这些事件特别针对Drag和下游,例如从勘探者手中拖到与Thumb毫无关系的申请中。 姓名相似,但事实上差别很大。
您可以尝试的一件事是使用。 在拖拉时进行手工试验,但记住,拖拉、下 drop和拖umb花 takes,占用了花.,使其他课堂上的投入活动脱节。
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...