如何用鼠标获得价值#c [英] how to get value wıth mouse wıth c #

查看:70
本文介绍了如何用鼠标获得价值#c的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望通过鼠标移动到您想要查看的图像来获取值,并且此值

解决方案

将一个MouseMove事件处理程序添加到控件即显示图像,然后修改处理程序,使其看起来像这样:



  //  'panel1'只是一个示例: - ) 
private void panel1_MouseMove( object sender,MouseEventArgs e)
{
string Coords = e.Location.ToString();
// 然后在此行中将(例如)标签的文本设置为Coords。
}





希望这会有所帮助: - )


使用c#



在你的函数中添加这个



  //  设置当前光标,移动光标的位置 

this .Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(Cursor.Position.X - 50 ,Cursor.Position .Y - 50 );
Cursor.Clip = new Rectangle( this .Location, .Size);


I want to get the value by moving with the mouse on the image you want to see, and this value

解决方案

Add a MouseMove event handler to the control that is displaying the image, then modify the handler so it looks something like this:

//'panel1' is just an example :-)
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
    string Coords = e.Location.ToString();
    //Then in this line set the text of the (eg)label to Coords.
}



Hope this helps :-)


using c#

add this in your function

// Set the Current cursor, move the cursor's Position

   this.Cursor = new Cursor(Cursor.Current.Handle);
   Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50);
   Cursor.Clip = new Rectangle(this.Location, this.Size);


这篇关于如何用鼠标获得价值#c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆