精易论坛
标题:
动态插入N项数组到框框
[打印本页]
作者:
stillness
时间:
2012-11-30 19:22
标题:
动态插入N项数组到框框
1.png
(29.09 KB, 下载次数: 1)
下载附件
2012-11-30 19:21 上传
2.png
(14.34 KB, 下载次数: 0)
下载附件
2012-11-30 19:21 上传
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)
2012-11-30 19:22 上传
点击文件名下载附件
下载积分: 精币 -2 枚
作者:
猫星人
时间:
2013-3-17 13:13
用了一下,感觉不错,学习了。。
欢迎光临 精易论坛 (https://125.confly.eu.org/)
Powered by Discuz! X3.4