|
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- //私の艹 #define Rnd 888; 定不了?
- //#define new Rad 888
- /* [*] */
- namespace 插入N个项目到框框
- {
- public partial class _Main : Form
- {
- public _Main()
- {
- InitializeComponent();
- }
- public static int define_随机数 = 8888;
- private void button1_Click(object sender, EventArgs e)
- {
- string[] Temp_Hwnd = new string[2];
- Temp_Hwnd[1] = this.Text;
- if (listBox1.Items.Count < 1)
- {
- Random Rnd = new Random();
- int[] A = new int[2];
- A[0] = Rnd.Next(1, define_随机数);
- for (A[2 - 1] = 1; A[2 - 1] <= A[1-1]; A[2-1]++)
- {
- listBox1.Items.Add(A[2 - 1].ToString());
- }
- System.Console.WriteLine(listBox1.Items.Count.ToString());
- // 标准输出流
- // Win32,64下不做任何作用
- MessgeBoxA(FindWindow(Temp_Hwnd [0],Temp_Hwnd[1]), listBox1.Items.Count.ToString()+"项", "信息:", 64 + 0);
- // MessageBox.Show(Convert.ToInt32(_Main.ActiveForm.ToString()), listBox1.Items.Count.ToString(), "信息:", 64 + 0);
- }
- else
- {
- listBox1.Items.Clear();
- MessgeBoxA(FindWindow(Temp_Hwnd[0], Temp_Hwnd[1]), "删除完毕", "信息:", 64 + 0);
- }
- object ojb = new object() ;
- EventArgs R = new EventArgs();
- Form1_Load(ojb,R);
- }
- [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "FindWindow")]
- private static extern int FindWindow(string ClassName, string IpName);
- [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "MessageBoxA")]
- private static extern int MessgeBoxA(int Hwnd,string Tip,string Text,int val);
- private void Form1_Load(object sender, EventArgs e)
- {
- label1.Text = "";
- this.Text = "动态加入N项到框框";
- if ((this.timer1.Enabled == true) == false)
- {
- timer1.Enabled = true;
- }
- if (listBox1.Items.Count > 0)
- {
- this.button1.Text = "删除" + 指针递加符("R",true); // 递加符可为D异可为R
- }
- else
- {
- this.button1.Text = "添加"+指针递加符("A",Not(false));// 递加符可为A亦可为其他
- }
- // 采集递加﹣异或为英文字符
- }
- bool Not(bool 欲反转逻辑值)
- {
- return !(欲反转逻辑值);
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- DateTime Time = new DateTime();
- this.label1.Text = Time.TimeOfDay.ToString();
- this.label1.Update();
- }
- string 指针递加符(string Fue,bool val)
- {
- string Ret;
- if (val == true)
- {
- Ret = ("(&".ToString()) + ((string)Fue) + ")".ToString();
- }
- else
- {
- Ret = "&" + Fue;
- }
- return Ret;
- }
- }
- }
复制代码
插入N个项目到框框.rar
(46.84 KB, 下载次数: 3)
|
|