📄 inter.cs
字号:
try
{
//MessageBox.Show(recievetext);
recievetext = recievetext.Substring(recievetext.IndexOf("e") + 1).Trim();
//MessageBox.Show(recievetext);
temp = recievetext.Substring(0, recievetext.IndexOf(":")).Trim();
//MessageBox.Show(temp);
recievetext = recievetext.Substring(recievetext.IndexOf(":")+1).Trim();
recievetext = recievetext.Substring(0, recievetext.IndexOf(":")).Trim();
if (recievetext.IndexOf("mouse") >0)
{
recievetext = recievetext.Substring(0,recievetext.IndexOf("mouse")).Trim();
}
//MessageBox.Show(recievetext);
//recievetext = recievetext.Substring(0,recievetext.IndexOf(":")).Trim();
//MessageBox.Show(recievetext);
int x = int.Parse(temp);
int y = int.Parse(recievetext);
Cursor.Position = new Point(x, y);
}
catch (Exception eeee)
{
//MessageBox.Show(eeee.StackTrace);
}
}
//recievetext = recievetext.Substring(0, recievetext.IndexOf(Environment.NewLine));
//MessageBox.Show(recievetext+"a");
//MessageBox.Show(recievetext);
else
{
recievetext = recievetext + Environment.NewLine;
txtDataReceived.AppendText(recievetext);
txtDataReceived.ScrollToCaret();
}
}
int mouse_flag = 0;
private void Inter_MouseMove(object sender, MouseEventArgs e)
{
if (mouse_flag == 1)
{
try
{
serialPort.Write("mouse" + e.X.ToString() + ":" + e.Y.ToString());
txtDataToSend.Text = string.Empty;
}
catch (Exception er)
{
MessageBox.Show(er.Message);
}
}
}
public void SetImage(string filename)
{
//MessageBox.Show(filename);
// SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, filename, SPIF_UPDATEINIFILE);
}
Bitmap bmp;
private void button1_Click(object sender, EventArgs e)
{
bmp = new Bitmap(ScreenCapturing.GetDesktopWindowCaptureAsBitmap(),pictureBox1.Width,pictureBox1.Height);
//Bitmap bmp2 = new Bitmap(pictureBox1.Width,pictureBox1.Height);
//thread.Interrupt();
try
{
}
catch (Exception eee)
{
MessageBox.Show("asdasdasd"+eee.Message);
}
}
bool thredR = false;
String str = "";
public void threadRun()
{
try{
Bitmap bmp1 = new Bitmap(ScreenCapturing.GetDesktopWindowCaptureAsBitmap(), pictureBox1.Width, pictureBox1.Height);
int rgb = 0;
//while (true)
//{
bmp1 = new Bitmap(ScreenCapturing.GetDesktopWindowCaptureAsBitmap(), pictureBox1.Width, pictureBox1.Height);
str = "|";
//MessageBox.Show(str.Length + "Starting");
for (int i = 0; i < bmp1.Width;)
{
for (int j = 0; j < bmp1.Height;)
{
rgb = bmp1.GetPixel(i, j).ToArgb();
str = str + "" + i + "," + j + " " + rgb + "|";
j++;
j++;
}
i++;
i++;
}
//MessageBox.Show(str.Length + "Starting");
while (str.Length > 500)
{
String sss = str.Substring(0, str.IndexOf("|", 500));
str = str.Substring(str.IndexOf("|", 500)+ 1);
serialPort.Write("setPic " + sss);
//MessageBox.Show(sss);
}
//MessageBox.Show(str.Length + "Starting");
serialPort.Write("setPic " + str);
//richTextBox1.Text = str;
str = "";
pictureBox1.Image = bmp1;
Thread.Sleep(1000);
//Thread.CurrentThread.Suspend();
// }
}catch(Exception adasdas)
{
MessageBox.Show(adasdas.Message+" "+adasdas.StackTrace);
}
}
//Bitmap bmp = new Bitmap
String pic = "";
void picArrange(String str)
{
pic = str + pic;
}
public void setPic(String str)
{
String s, pos;
while (str.Length != 0)
{
try
{
s = str.Substring(0, str.IndexOf("|"));
pos = s.Substring(0, s.IndexOf(" "));
//int.Parse(pos.Substring(0,pos.IndexOf(",")).Trim())
s = s.Substring(s.IndexOf(" ") + 1);
//MessageBox.Show(int.Parse(pos.Substring(0, pos.IndexOf(",")).Trim())+ " "+ int.Parse(pos.Substring(pos.IndexOf(",") + 1).Trim())+" "+ Color.FromArgb(int.Parse(s)));
bmp.SetPixel(int.Parse(pos.Substring(0, pos.IndexOf(",")).Trim()), int.Parse(pos.Substring(pos.IndexOf(",") + 1).Trim()), Color.FromArgb(int.Parse(s)));
str = str.Substring(str.IndexOf("|") + 1);
}
catch (Exception ert)
{
}
}
pictureBox2.Image = bmp;
}
private void button2_Click(object sender, EventArgs e)
{
Image im = Image.FromFile("c:\\b.jpg");
Bitmap bmp = new Bitmap(im, pictureBox1.Size);
pictureBox1.Image = im;
}
private void button3_Click(object sender, EventArgs e)
{
try
{
MessageBox.Show(thread.ThreadState+"");
thread.Suspend();
MessageBox.Show(thread.ThreadState+"");
}
catch (Exception ere)
{
MessageBox.Show(ere.Message);
}
}
private void threadPicShow()
{
Bitmap bmp1;
while (true)
{
thread.Suspend();
bmp1 = bmp;
pictureBox1.Image = bmp1;
thread.Resume();
Thread.Sleep(100);
}
}
private void button4_Click(object sender, EventArgs e)
{
try
{
MessageBox.Show(thread.ThreadState + "");
thread.Resume();
MessageBox.Show(thread.ThreadState + "");
}
catch (Exception ere)
{
MessageBox.Show(ere.Message);
}
}
private void button5_Click(object sender, EventArgs e)
{
Thread tr = new Thread(new ThreadStart(threadRun));
tr.Start();
}
bool flagPic = false;
private void button6_Click(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
threadRun();
}
private void button7_Click(object sender, EventArgs e)
{
System.Diagnostics.Process process1;
process1 = new System.Diagnostics.Process();
process1.EnableRaisingEvents = false;
string strCmdLine;
strCmdLine = "/C " + "pappu";
System.Diagnostics.Process.Start("CMD.exe", strCmdLine);
// System.Diagnostics.Process.Start("CMD.exe","/C MD 00New_Folder");
//process1.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -