当前位置:网站首页>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 .
边栏推荐
- SQL server, MySQL master-slave construction, EF core read-write separation code implementation
- 数据库高级学习笔记--系统包
- Method parameter transfer mechanism of C #
- Database core system
- SD卡介绍(基于SPEC3.0)
- 使用 OpenSSL 创建ssl证书
- 数据库高级学习笔记--对象类型
- 数据库那么多概念性的东西怎么学?求方法
- Analysis of the internal principle of ArrayList
- 《PyTorch深度学习实践》第九课多分类问题(手写数字MNIST)
猜你喜欢

Talk to the father of MySQL: code completion at one time is a good programmer

MySQL master-slave architecture. After the master database is suspended and restarted, how can the slave database automatically connect to the master database

My vivado practice - single cycle CPU instruction analysis

Seeing clearly is more important than walking fast, because you can go far only when you walk right

JS array is de duplicated, the ID is the same, and a value is added and merged

时序分析41 - 时序预测 TBATS模型

学个锤子 | .Net零基础逆向教程 第三课(壳与作业)

Machine learning (10) -- hypothesis testing and regression analysis

ECCV 2022 | can be promoted without fine adjustment! Registration based anomaly detection framework for small samples

译文推荐 | 调试 BookKeeper 协议 - 无界 Ledger
随机推荐
Oracle creates users with query permission only
Arouter source code analysis (III)
数据库高级学习笔记--存储函数
路由器固件解密思路
ShardingSphere简介(一)
常用工具函数 持续更新
实验五:用户与用户组管理
What is cross domain? How to solve the cross domain problem?
go语言切片Slice和数组Array对比panic runtime error index out of range问题解决
Leetcode - hashtable topic
[summary of leetcode weekly competition] the 83rd fortnight competition of leetcode (7.23)
OSS直连上传-Rails服务实践
Opencv4.60 installation and configuration
Hexadecimal representation of negative numbers
Retrofit source code analysis
Window源码解析(一):与DecorView的那些事
Scalable search bar, imitating Huawei application market
[JVM] JVM refers to floating point number
【AUTOSAR-RTE】-2-Composition,Component和VFB的介绍
2.9.5 Ext JS的Object类型处理及便捷方法