开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 1535|回复: 1
收起左侧

[C#源码] 动态插入N项数组到框框

[复制链接]
结帖率:33% (3/9)
发表于 2012-11-30 19:22:15 | 显示全部楼层 |阅读模式   四川省成都市
1.png

2.png
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. //私の艹 #define Rnd 888; 定不了?
  10. //#define new Rad 888
  11. /* [*] */
  12. namespace 插入N个项目到框框
  13. {
  14.     public partial class _Main : Form
  15.     {
  16.         public _Main()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.         public static int define_随机数 = 8888;   
  21.         private void button1_Click(object sender, EventArgs e)
  22.         {
  23.             string[] Temp_Hwnd = new string[2];
  24.             Temp_Hwnd[1] = this.Text;
  25.             if (listBox1.Items.Count < 1)
  26.             {
  27.                 Random Rnd = new Random();
  28.                 int[] A = new int[2];
  29.                 A[0] = Rnd.Next(1, define_随机数);
  30.                 for (A[2 - 1] = 1; A[2 - 1] <= A[1-1]; A[2-1]++)
  31.                 {
  32.                     listBox1.Items.Add(A[2 - 1].ToString());
  33.                 }
  34.                 System.Console.WriteLine(listBox1.Items.Count.ToString());
  35.                 // 标准输出流
  36.                 // Win32,64下不做任何作用
  37.                 MessgeBoxA(FindWindow(Temp_Hwnd [0],Temp_Hwnd[1]), listBox1.Items.Count.ToString()+"项", "信息:", 64 + 0);
  38.                 // MessageBox.Show(Convert.ToInt32(_Main.ActiveForm.ToString()), listBox1.Items.Count.ToString(), "信息:", 64 + 0);   
  39.             }
  40.             else
  41.             {
  42.                 listBox1.Items.Clear();
  43.                 MessgeBoxA(FindWindow(Temp_Hwnd[0], Temp_Hwnd[1]), "删除完毕", "信息:", 64 + 0);
  44.             }
  45.             object ojb = new object() ;
  46.             EventArgs R = new EventArgs();
  47.             Form1_Load(ojb,R);
  48.         }
  49.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "FindWindow")]
  50.         private static extern int FindWindow(string ClassName, string IpName);
  51.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "MessageBoxA")]
  52.         private static extern int MessgeBoxA(int Hwnd,string Tip,string Text,int val);
  53.         private void Form1_Load(object sender, EventArgs e)
  54.         {
  55.             label1.Text = "";
  56.             this.Text = "动态加入N项到框框";
  57.             if ((this.timer1.Enabled == true) == false)
  58.             {
  59.                 timer1.Enabled = true;
  60.             }
  61.             if (listBox1.Items.Count > 0)
  62.             {
  63.                 this.button1.Text = "删除" + 指针递加符("R",true); // 递加符可为D异可为R
  64.             }
  65.             else
  66.             {
  67.                 this.button1.Text = "添加"+指针递加符("A",Not(false));// 递加符可为A亦可为其他
  68.             }
  69.             // 采集递加﹣异或为英文字符
  70.         }
  71.         bool Not(bool 欲反转逻辑值)
  72.         {
  73.             return !(欲反转逻辑值);
  74.         }
  75.         private void timer1_Tick(object sender, EventArgs e)
  76.         {
  77.             DateTime Time = new DateTime();
  78.             this.label1.Text = Time.TimeOfDay.ToString();
  79.             this.label1.Update();
  80.         }
  81.         string 指针递加符(string Fue,bool val)
  82.         {
  83.             string Ret;
  84.             if (val == true)
  85.             {
  86.                 Ret = ("(&".ToString()) + ((string)Fue) + ")".ToString();
  87.             }
  88.             else
  89.             {
  90.                 Ret = "&" + Fue;
  91.             }
  92.             return Ret;
  93.         }
  94.     }
  95. }

复制代码
插入N个项目到框框.rar (46.84 KB, 下载次数: 3)
结帖率:0% (0/1)
发表于 2013-3-17 13:13:00 | 显示全部楼层   广东省广州市
用了一下,感觉不错,学习了。。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 诚聘英才| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 800073686,邮箱:800073686@b.qq.com
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表