降低鼠标的速度 [英] reduce speed of mouse

查看:110
本文介绍了降低鼠标的速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有移动鼠标的机器,这台机器工作在2米高和2米宽的大尺寸我想用这台机器用于电影鼠标......我只想要一个降低鼠标速度的程序,我写了这段代码...

i有2个问题

1-鼠标每10 px跳9 px我只想停止鼠标直到用户移动鼠标10 px然后移动mose 1 px ..让我解释更多,如果我的机器移动鼠标10 px鼠标移动1 px在scree上...



2-当我以非常快的速度移动鼠标我的程序没有工作是因为timer1_Tick每0.001秒就得到我的鼠标位置而且它会产生更大的问题PLZ帮助:((



 {
[DllImport( user32.dll,CharSet = CharSet.Auto),]
public static extern < span class =code-keyword> int SystemParametersInfo( uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
}
public Int32 xcolb = 10 ;
public Int32 ycolb = 10 ;
private void Form1_Load( object sender,EventArgs e)
{
timer1.Interval = 1 ;
timer1.Enabled = true ;
uint SPEED = 1 ;
int res = WinAPI.SystemParametersInfo( 113 0 ,SPEED, 0 );
textBox3.Text = SPEED.ToString();
x = Cursor.Position.X;
y = Cursor.Position.Y;
prevx = Cursor.Position.X;
prevy = Cursor.Position.Y;
Screen Srn = Screen.PrimaryScreen;
tempHeight = Convert.ToInt32(Srn.Bounds.Height);
tempWidth = Convert.ToInt32(Srn.Bounds.Width);
label9.Text = tempWidth.ToString()+ x + tempHeight.ToString( );
// MessageBox.Show(分辨率将更改为+1024+X +768);
// Resolution.CResolution ChangeRes = new Resolution.CResolution( 1024,768);
SetCursorPos(-1, 0 );

}

private void timer1_Tick(< span class =code-keyword> object
sender,EventArgs e)
{


x = Cursor.Position.X;
y = Cursor.Position.Y;
textBox1.Text = x.ToString();
textBox2.Text = y.ToString();
如果(x > prevx)
{

if (x - prevx > xcolb)
{
SetCursorPos( x -9,y);
prevx = x -9;
}
}
其他 如果(x < prevx)
{
if (prevx - x > xcolb)
{
SetCursorPos(x + 9 ,y);
prevx = x +5;
}

}
/// ///// ///////////////////////////
如果 (y> prevy)
{
if (y - prevy > ycolb )
{
SetCursorPos(x,y - 9 );
prevy = y -9;
}
}
其他 如果(y < prevy)
{
if (prevy - y > ycolb)
{
SetCursorPos(x,y + 5);
prevy = y +9;
}

}

/// / //////////////////////////////
if (flag)
{
button1.Text = 将鼠标移动到口径< /跨度>;
如果(x > prevx)
{

textBox5.Text = x.ToString();
}
if (y> prevy)
{

textBox4.Text = y.ToString( );
}
}
其他
{

button1.Text = caliber;
}
}

私有 void Form1_FormClosed( object sender,FormClosedEventArgs e)
{
int res = WinAPI.SystemParametersInfo( 113 0 10 0 );
}

private void button1_Click( object sender,EventArgs e)
{
Form2 frm = new Form2();
frm.ShowDialog();
}
public bool flag = ;
private void button1_Click_1( object sender,EventArgs e)
{
flag = true ;


}

解决方案

降低鼠标速度?我不知道你为什么要这样做,但是你不能只打开鼠标控制面板,点击指针选项选项卡并改变速度吗? :困惑:

i have machine that move mouse ,this machine work in large scale 2m height and 2m width i want use this machine for movie mouse ... i just want a program to reduce mouse speed , i wrote this code ...
i have 2 problem
1- mouse jump 9 px back every 10 px i just want stop the mouse until user move mouse 10 px and then move mose 1 px .. let me explain more if my machine move mouse 10 px the mouse move 1 px on the scree...

2- when i move mouse with very fast speed my program doesn''t work because timer1_Tick get my mouse position every 0.001 second and it''s make a bigger problem plz help :((

{
           [DllImport("user32.dll", CharSet = CharSet.Auto),]
           public static extern int SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
       }
       public Int32 xcolb = 10;
       public Int32 ycolb = 10;
       private void Form1_Load(object sender, EventArgs e)
       {
           timer1.Interval = 1;
           timer1.Enabled = true;
           uint SPEED = 1;
           int res = WinAPI.SystemParametersInfo(113, 0, SPEED, 0);
           textBox3.Text = SPEED.ToString();
           x = Cursor.Position.X;
           y = Cursor.Position.Y;
           prevx = Cursor.Position.X;
           prevy = Cursor.Position.Y;
           Screen Srn = Screen.PrimaryScreen;
           tempHeight =Convert.ToInt32(Srn.Bounds.Height);
           tempWidth =Convert.ToInt32( Srn.Bounds.Width);
           label9.Text = tempWidth.ToString() + " x " + tempHeight.ToString();
          // MessageBox.Show("Resolution is going to change to " + "1024" + " X " + "768");
          // Resolution.CResolution ChangeRes = new Resolution.CResolution(1024, 768);
           SetCursorPos(-1, 0);

       }

       private void timer1_Tick(object sender, EventArgs e)
       {


           x = Cursor.Position.X;
           y = Cursor.Position.Y;
           textBox1.Text = x.ToString();
           textBox2.Text = y.ToString();
           if (x > prevx)
           {

               if (x - prevx > xcolb)
               {
                   SetCursorPos(x -9, y);
                   prevx = x -9;
               }
           }
           else if (x < prevx)
           {
               if (prevx - x > xcolb)
               {
                   SetCursorPos(x + 9, y);
                   prevx = x +5;
               }

           }
           ///////////////////////////////////
           if (y> prevy)
           {
               if (y - prevy > ycolb)
               {
                   SetCursorPos(x ,y - 9 );
                   prevy = y -9;
               }
           }
           else if (y < prevy)
           {
               if (prevy - y > ycolb)
               {
                   SetCursorPos(x, y+5);
                   prevy = y +9;
               }

           }

           //////////////////////////////////
           if (flag)
           {
               button1.Text = "Move Mouse To calibre";
               if (x > prevx)
               {

                   textBox5.Text = x.ToString();
               }
               if (y> prevy)
               {

                   textBox4.Text = y.ToString();
               }
           }
           else
           {

               button1.Text = "calibre";
           }
       }

       private void Form1_FormClosed(object sender, FormClosedEventArgs e)
       {
           int res = WinAPI.SystemParametersInfo(113, 0, 10, 0);
       }

       private void button1_Click(object sender, EventArgs e)
       {
           Form2 frm = new Form2();
           frm.ShowDialog();
       }
       public bool flag = false;
       private void button1_Click_1(object sender, EventArgs e)
       {
           flag = true;


       }

解决方案

Reduce mouse speed?? I have no idea why you''re doing this, but couldn''t you just open the Mouse control panel, click on the Pointer Options tab and change the speed that way?? :confused:


这篇关于降低鼠标的速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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