返回首页

大家好,

请原谅我以前的帖子。问题的部分解决,但出现了一个新的问题。当WPF窗口周围用下面的方法移动快速,窗口的鼠标光标离开!有什么想法?请指导我。

public myWindow()

{

this.InitializeComponent();

 

Body3D.MouseLeftButtonDown += new MouseButtonEventHandler(Body3D_MouseLeftButtonDown);

Body3D.MouseLeftButtonUp += new MouseButtonEventHandler(Body3D_MouseLeftButtonUp);

Body3D.MouseMove += new MouseEventHandler(Body3D_MouseMove);

}

bool inDrag;

Point dragPoint;

 

private void Body3D_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)

{ 

	dragPoint = e.GetPosition(this);

	inDrag = true; 

}

 

private void Body3D_MouseMove(object sender, MouseEventArgs e) 

{

	if (inDrag)

	{

		Point pointMoveTo;

 

		// Find the current mouse position in screen coordinates.

		pointMoveTo = this.PointToScreen(e.GetPosition(this));

 

		// Compensate for the position the control was clicked.

		pointMoveTo.Offset(-dragPoint.X, -dragPoint.Y);

 

		// Compensate for the non-client region (title bar).

		// This code is not necessary if you explicitly hide the title bar 

		// by setting the form's BorderStyle to None.

		//pointMoveTo.Offset(0, -25); //Move the window.



		this.Left  = pointMoveTo.X;

		this.Top = pointMoveTo.Y; 

	} 

} 

 

private void Body3D_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)

{

	inDrag = false;

}} 
公告:Body3D ModelUIElement3D通过
&# 160;窗口
NViewbox的
NViewport3D的
N的ModelVisual3D
NmodelUIelement3d(body3D)
一些窗口属性设置为背景="{NULL}"。AllowsTransparency ="真",WindowStyle ="无"

谢谢提前很多。| hzawary |标记Salsbery

回答