当前位置:网站首页>C countdown tool
C countdown tool
2022-07-28 09:47:00 【biyusr】
Recently, a friend was playing an online game , There are games 10 Several small leaders , After the death of the little head, every 10 Minutes to refresh . There are many players fighting against monsters , Who was hurt for the first time ,boss Who owns the goods after death , Friends suffer from not being able to count small leaders boss Time to refresh . Always can't win others . I want to help him get a multi-point countdown time software . I feel bored and feasible , Do as you say .
The software interface is provided by :2 Button ( add to 、 Delete )、 One listView, One pictureBox, One timer The clock of .

Dotnet Industrial control
Focus on sharing DotNET Programming experience , Mining programmers' excellent learning resources .
7 Original content
official account

Design when starting listView Column : You can only select the whole line to be designed listView1.FullRowSelect by True, Design timer To count down , In seconds .
private void Form1_Load(object sender, EventArgs e){comboBox1.SelectedIndex = 0;listView1.Columns.Add(" count down / second ",80,HorizontalAlignment.Left);listView1.Columns.Add(" Set the time ");listView1.Columns.Add(" Picture address ", 100, HorizontalAlignment.Left);listView1.FullRowSelect = true;// Only one line can be selectedtimer1.Interval = 1000;timer1.Start();}
2. Add a button , Load pictures and save pictures , Convenient to check next time .
private void button1_Click(object sender, EventArgs e){pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;// The picture is pulled up or down , To adapt to picture Controlstring url; Save the picture addresspictureBox1.Image = GetScreenCapture(out url); // Use the method to load the mapListViewItem listViewItem = new ListViewItem();string timeritem = System.Text.RegularExpressions.Regex.Replace(comboBox1.Text, @"[^0-9]+", ""); // Ask for numberslistViewItem.Text = (int.Parse(timeritem)*60).ToString();listViewItem.SubItems.Add($"{comboBox1.Text}");listViewItem.SubItems.Add(url);listView1.Items.Add(listViewItem);}private Bitmap GetScreenCapture(out string url){Rectangle tScreenRect = new Rectangle(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);Bitmap tSrcBmp = new Bitmap(tScreenRect.Width, tScreenRect.Height); // Used to save the original picture of the screenGraphics gp = Graphics.FromImage(tSrcBmp);gp.CopyFromScreen(0, 0, 0, 0, tScreenRect.Size);gp.DrawImage(tSrcBmp, 0, 0, tScreenRect, GraphicsUnit.Pixel);Random ran = new Random();url = @$"temp\{ran.Next(1, 999)}.jpg";tSrcBmp.Save(url);return tSrcBmp;}
3. Need to update the countdown by seconds , stay timer Update all the countdown in the clock ,
private void timer1_Tick(object sender, EventArgs e){this.listView1.BeginUpdate(); // Data update ,UI Hang up for a while , until EndUpdate Draw control , Can effectively avoid flashing and greatly improve the loading speedforeach (ListViewItem item in listView1.Items){item.SubItems[0].Text = (int.Parse(item.SubItems[0].Text) - 1).ToString();}this.listView1.EndUpdate(); // End of data processing ,UI The interface is drawn once .}/// <summary>/// Double click to display the picture/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void listView1_MouseDoubleClick(object sender, MouseEventArgs e){pictureBox1.ImageLocation = listView1.SelectedItems[0].SubItems[2].Text;}/// <summary>/// Delete/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void button2_Click(object sender, EventArgs e){File.Delete(listView1.SelectedItems[0].SubItems[2].Text);listView1.SelectedItems[0].Remove();}
4. design sketch : Friends are very satisfied , Can calculate to small head second refresh . The countdown is 10 Seconds, hurry to the place to refresh and wait for the little leader . Always able to grab the small leader

5. Afterwards, he asked me if I could help him get a script for automatically fighting monsters and grabbing heads , I'm afraid of him

, Tell him directly that he won't .
边栏推荐
猜你喜欢

Pytorch deep learning practice lesson 9 multi classification problems (handwritten numeral MNIST)

多线程一定能优化程序性能吗?

力扣376-摆动序列——贪心

pycharm使用conda调用远程服务器

Create SSL certificate using OpenSSL

ECCV 2022 | 无需微调即可推广!基于配准的少样本异常检测框架

IJCAI 2022 | 图结构学习最新综述:研究进展与未来展望

树上启发式合并

IDC script file running

WPF布局之控件随着窗口等比放大缩小,适应多分辨率满屏填充应用
随机推荐
Leetcode - hashtable topic
LeetCode(剑指 Offer)- 50. 第一个只出现一次的字符
Opencv4.60 installation and configuration
How promise instance solves hell callback
ARouter源码解析(一)
Create SSL certificate using OpenSSL
2.9.5 Ext JS的Object类型处理及便捷方法
Oracle creates users with query permission only
pycharm使用conda调用远程服务器
Seeing clearly is more important than walking fast, because you can go far only when you walk right
C signed and unsigned byte variables
2022 supplementary questions for the first session of Niuke multi school
ShardingSphere简介(一)
《PyTorch深度学习实践》第九课多分类问题(手写数字MNIST)
SQL server, MySQL master-slave construction, EF core read-write separation code implementation
[JVM] JVM refers to floating point number
译文推荐 | 调试 BookKeeper 协议 - 无界 Ledger
ShardingSphere之分库分表概念介绍(二)
[multithreading] non atomic agreement of long and double
Inside database system distributed system