所以我刚刚开始编码,我可能正在使用一种非常基本的方法来做这个,但我想制作一个点击计数器,这样我就可以为Runescape制作一个'Drop Log'。一切都顺利但是我注意到在X量的Clicker计数器编程后按钮开始滞后?调试没有出现任何问题,它只是卡住了?
这是我的代码:
namespace DropLog_v2
{
public partial class Form1 : Form
{
//Pernix Counts
int CountP = 0;
int CountP2 = 0;
int CountP3 = 0;
int CountP4 = 0;
int CountP5 = 0;
int CountP6 = 0;
//Virtus Counts
int CountV = 0;
int CountV2 = 0;
int CountV3 = 0;
int CountV4 = 0;
int CountV5 = 0;
int CountV6 = 0;
int CountV7 = 0;
//Torva Counts
int CountM = 0;
public Form1()
{
InitializeComponent();
}
//Move Window
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Left += e.X - lastPoint.X;
this.Top += e.Y - lastPoint.Y;
}
}
Point lastPoint;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
lastPoint = new Point(e.X, e.Y);
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Left += e.X - lastPoint.X;
this.Top += e.Y - lastPoint.Y;
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
lastPoint = new Point(e.X, e.Y);
}
//Close Window
private void button1_Click(object sender, EventArgs e)
{
Close();
}
//Pernix Buttons
private void Pernix1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
CountP++;
PernixL1.Text = CountP.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountP > 0)
CountP--;
PernixL1.Text = CountP.ToString();
}
}
private void Pernix2_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
CountP2++;
PernixL2.Text = CountP2.ToString();
}
else if (e.Button == MouseButtons.Right)
{
if (CountP2 > 0)
CountP2--;
PernixL2.Text = CountP2.ToString();
}
}
private void Pernix3_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountP3++;
PernixL3.Text = CountP3.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountP3 > 0)
CountP3--;
PernixL3.Text = CountP3.ToString();
}
}
private void Pernix4_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountP4++;
PernixL4.Text = CountP4.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountP4 > 0)
CountP4--;
PernixL4.Text = CountP4.ToString();
}
}
private void Pernix5_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountP5++;
PernixL5.Text = CountP5.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountP5 > 0)
CountP5--;
PernixL5.Text = CountP5.ToString();
}
}
private void Pernix6_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountP6++;
PernixL6.Text = CountP6.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountP6 > 0)
CountP6--;
PernixL6.Text = CountP6.ToString();
}
}
//Virtus Buttons
private void Virtus1_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountV++;
VirtusL1.Text = CountV.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountV > 0)
CountV--;
VirtusL1.Text = CountV.ToString();
}
}
private void Virtus2_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountV2++;
VirtusL2.Text = CountV2.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountV2 > 0)
CountV2--;
VirtusL2.Text = CountV2.ToString();
}
}
private void Virtus3_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountV3++;
VirtusL3.Text = CountV3.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountV3 > 0)
CountV3--;
VirtusL3.Text = CountV3.ToString();
}
}
private void Virtus4_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountV4++;
VirtusL4.Text = CountV4.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountV4 > 0)
CountV4--;
VirtusL4.Text = CountV4.ToString();
}
}
private void Virtus5_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountV5++;
VirtusL5.Text = CountV5.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountV5 > 0)
CountV5--;
VirtusL5.Text = CountV5.ToString();
}
}
private void Virtus6_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountV6++;
VirtusL6.Text = CountV6.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountV6 > 0)
CountV6--;
VirtusL6.Text = CountV6.ToString();
}
}
private void Virtus7_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountV7++;
VirtusL7.Text = CountV7.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountV7 > 0)
CountV7--;
VirtusL7.Text = CountV7.ToString();
}
}
//Torva Buttons
private void Torva1_MouseMove(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
CountM++;
TorvaL1.Text = CountM.ToString();
}
else if(e.Button==MouseButtons.Right)
{
if (CountM > 0)
CountM--;
TorvaL1.Text = CountM.ToString();
}
}
}
}
所有工作都很好,直到我尝试为第一个'torva'点击器执行下一行代码,现在它变得迟钝了..
感谢所有帮助(新手,所以请轻松一下)
答案 0 :(得分:0)
你有MouseMove而不是MouseDown