一、窗体的事件

每一个窗体都有一个事件,这个窗体加载完成之后执行哪一段代码

位置:(1)右键属性→事件→load 双击进入。(2)双击窗体任意一个位置进入

  1. public partial class Form1 : Form//构造方法
  1. {
  2.  
  3. public Form1()
    {
    InitializeComponent();
    }

控件在工具箱里面找,找到之后双击即可添加进来,也可以点住拖进来

每个工具,控件,窗体都有一个name,相当于id,用来标识该对象的名称,name值不允许重复

六大常用控件

1、Label -- 文本显示工具

Text:需要显示的文字——属性

Label的取值赋值:

  1. private void Form1_Load(object sender, EventArgs e)
  2. {
  3. label1.Text = "请输入你需要购买的东西:";
  4. MessageBox.Show(label1.Text);
  5. }

2、TextBox -- 文本框

TextBox的取值赋值:

  1. private void Form1_Load(object sender, EventArgs e)
  2. {
  3. textBox1.Text = "请输入配菜";
  4. MessageBox.Show(textBox1.Text);
  5. }

3、radioButton -- 单选按钮

text:文字

Checked:是否选中

  1. //
  2. // radioButton1
  3. //
  4. this.radioButton1.AutoSize = true;
  5. this.radioButton1.BackColor = System.Drawing.Color.Transparent;
  6. this.radioButton1.Checked = true;//决定是否先选中其中一个
  7. this.radioButton1.Font = new System.Drawing.Font("微软雅黑", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
  8. this.radioButton1.Location = new System.Drawing.Point(, );
  9. this.radioButton1.Name = "radioButton1";
  10. this.radioButton1.Size = new System.Drawing.Size(, );
  11. this.radioButton1.TabIndex = ;
  12. this.radioButton1.TabStop = true;
  13. this.radioButton1.Text = "薯条";
  14. this.radioButton1.UseVisualStyleBackColor = false;

4 combobox--下拉列表

用于制作下拉菜单

  1. //
  2. // comboBox1
  3. //
  4. this.comboBox1.BackColor = System.Drawing.SystemColors.Info;
  5. //决定着默认无法输入文字,为灰色区域DropDownList
  6. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  7. this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 8F);
  8. this.comboBox1.FormattingEnabled = true;
  9. this.comboBox1.Items.AddRange(new object[] {
  10. "香辣鸡腿堡",
  11. "半鸡半虾堡",
  12. "BBQ手撕猪肉堡",
  13. "老北京鸡肉卷",
  14. "黑椒牛柳饭",
  15. "日式咖喱饭"});
  16. this.comboBox1.Location = new System.Drawing.Point(, );
  17. this.comboBox1.Margin = new System.Windows.Forms.Padding();
  18. this.comboBox1.Name = "comboBox1";
  19. this.comboBox1.Size = new System.Drawing.Size(, );
  20. this.comboBox1.TabIndex = ;

5、checkbox -- 复选框组

Checked属性:是否选中

Tag属性:可以存储自定义数,用户自己定义

设置全选或者全都不选

  1. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  2. {
  3. foreach (Control ctr in panel2.Controls)
  4. {
  5. if (ctr is CheckBox)
  6. {
  7. CheckBox ck = ctr as CheckBox;
  8. ck.Checked = checkBox3.Checked;
  9. }
  10. }
  11. }

6、Button 按钮 

name:设置按钮名

Text:设置按钮显示的文字

双击进入设置按钮的事件(默认为点击事件)

练习:肯德基订餐

  1. namespace WindowsFormsApplication1
  2. {
  3. partial class Form1
  4. {
  5. /// <summary>
  6. /// 必需的设计器变量。
  7. /// </summary>
  8. private System.ComponentModel.IContainer components = null;
  9.  
  10. /// <summary>
  11. /// 清理所有正在使用的资源。
  12. /// </summary>
  13. /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
  14. protected override void Dispose(bool disposing)
  15. {
  16. if (disposing && (components != null))
  17. {
  18. components.Dispose();
  19. }
  20. base.Dispose(disposing);
  21. }
  22.  
  23. #region Windows 窗体设计器生成的代码
  24.  
  25. /// <summary>
  26. /// 设计器支持所需的方法 - 不要
  27. /// 使用代码编辑器修改此方法的内容。
  28. /// </summary>
  29. private void InitializeComponent()
  30. {
  31. System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
  32. this.label1 = new System.Windows.Forms.Label();
  33. this.label2 = new System.Windows.Forms.Label();
  34. this.comboBox1 = new System.Windows.Forms.ComboBox();
  35. this.label3 = new System.Windows.Forms.Label();
  36. this.radioButton1 = new System.Windows.Forms.RadioButton();
  37. this.radioButton2 = new System.Windows.Forms.RadioButton();
  38. this.radioButton3 = new System.Windows.Forms.RadioButton();
  39. this.label4 = new System.Windows.Forms.Label();
  40. this.checkBox1 = new System.Windows.Forms.CheckBox();
  41. this.checkBox2 = new System.Windows.Forms.CheckBox();
  42. this.checkBox3 = new System.Windows.Forms.CheckBox();
  43. this.checkBox4 = new System.Windows.Forms.CheckBox();
  44. this.checkBox5 = new System.Windows.Forms.CheckBox();
  45. this.checkBox6 = new System.Windows.Forms.CheckBox();
  46. this.label5 = new System.Windows.Forms.Label();
  47. this.label6 = new System.Windows.Forms.Label();
  48. this.textBox1 = new System.Windows.Forms.TextBox();
  49. this.textBox2 = new System.Windows.Forms.TextBox();
  50. this.button1 = new System.Windows.Forms.Button();
  51. this.SuspendLayout();
  52. //
  53. // label1
  54. //
  55. this.label1.AutoSize = true;
  56. this.label1.BackColor = System.Drawing.Color.Transparent;
  57. this.label1.Font = new System.Drawing.Font("微软雅黑", 20F);
  58. this.label1.ForeColor = System.Drawing.Color.Yellow;
  59. this.label1.Location = new System.Drawing.Point(, );
  60. this.label1.Margin = new System.Windows.Forms.Padding(, , , );
  61. this.label1.Name = "label1";
  62. this.label1.Size = new System.Drawing.Size(, );
  63. this.label1.TabIndex = ;
  64. this.label1.Text = "肯德基点餐系统";
  65. this.label1.Click += new System.EventHandler(this.label1_Click);
  66. //
  67. // label2
  68. //
  69. this.label2.AutoSize = true;
  70. this.label2.BackColor = System.Drawing.Color.Transparent;
  71. this.label2.Font = new System.Drawing.Font("微软雅黑", 10F);
  72. this.label2.ForeColor = System.Drawing.Color.White;
  73. this.label2.Location = new System.Drawing.Point(, );
  74. this.label2.Margin = new System.Windows.Forms.Padding(, , , );
  75. this.label2.Name = "label2";
  76. this.label2.Size = new System.Drawing.Size(, );
  77. this.label2.TabIndex = ;
  78. this.label2.Text = "请选择主食:";
  79. this.label2.Click += new System.EventHandler(this.label2_Click);
  80. //
  81. // comboBox1
  82. //
  83. this.comboBox1.BackColor = System.Drawing.SystemColors.Info;
  84. //决定着默认无法输入文字,为灰色区域DropDownList
  85. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  86. this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 8F);
  87. this.comboBox1.FormattingEnabled = true;
  88. this.comboBox1.Items.AddRange(new object[] {
  89. "香辣鸡腿堡",
  90. "半鸡半虾堡",
  91. "BBQ手撕猪肉堡",
  92. "老北京鸡肉卷",
  93. "黑椒牛柳饭",
  94. "日式咖喱饭"});
  95. this.comboBox1.Location = new System.Drawing.Point(, );
  96. this.comboBox1.Margin = new System.Windows.Forms.Padding();
  97. this.comboBox1.Name = "comboBox1";
  98. this.comboBox1.Size = new System.Drawing.Size(, );
  99. this.comboBox1.TabIndex = ;
  100. //
  101. // label3
  102. //
  103. this.label3.AutoSize = true;
  104. this.label3.BackColor = System.Drawing.Color.Transparent;
  105. this.label3.Font = new System.Drawing.Font("微软雅黑", 10F);
  106. this.label3.ForeColor = System.Drawing.Color.White;
  107. this.label3.Location = new System.Drawing.Point(, );
  108. this.label3.Name = "label3";
  109. this.label3.Size = new System.Drawing.Size(, );
  110. this.label3.TabIndex = ;
  111. this.label3.Text = "请选择配餐:";
  112. //
  113. // radioButton1
  114. //
  115. this.radioButton1.AutoSize = true;
  116. this.radioButton1.BackColor = System.Drawing.Color.Transparent;
  117. this.radioButton1.Checked = true;//决定是否先选中其中一个
  118. this.radioButton1.Font = new System.Drawing.Font("微软雅黑", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
  119. this.radioButton1.Location = new System.Drawing.Point(, );
  120. this.radioButton1.Name = "radioButton1";
  121. this.radioButton1.Size = new System.Drawing.Size(, );
  122. this.radioButton1.TabIndex = ;
  123. this.radioButton1.TabStop = true;
  124. this.radioButton1.Text = "薯条";
  125. this.radioButton1.UseVisualStyleBackColor = false;
  126. //
  127. // radioButton2
  128. //
  129. this.radioButton2.AutoSize = true;
  130. this.radioButton2.BackColor = System.Drawing.Color.Transparent;
  131. this.radioButton2.Font = new System.Drawing.Font("微软雅黑", 10F);
  132. this.radioButton2.Location = new System.Drawing.Point(, );
  133. this.radioButton2.Name = "radioButton2";
  134. this.radioButton2.Size = new System.Drawing.Size(, );
  135. this.radioButton2.TabIndex = ;
  136. this.radioButton2.Text = "玉米棒";
  137. this.radioButton2.UseVisualStyleBackColor = false;
  138. this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
  139. //
  140. // radioButton3
  141. //
  142. this.radioButton3.AutoSize = true;
  143. this.radioButton3.BackColor = System.Drawing.Color.Transparent;
  144. this.radioButton3.Font = new System.Drawing.Font("微软雅黑", 10F);
  145. this.radioButton3.Location = new System.Drawing.Point(, );
  146. this.radioButton3.Name = "radioButton3";
  147. this.radioButton3.Size = new System.Drawing.Size(, );
  148. this.radioButton3.TabIndex = ;
  149. this.radioButton3.Text = "鸡米花";
  150. this.radioButton3.UseVisualStyleBackColor = false;
  151. this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
  152. //
  153. // label4
  154. //
  155. this.label4.AutoSize = true;
  156. this.label4.BackColor = System.Drawing.Color.Transparent;
  157. this.label4.Font = new System.Drawing.Font("微软雅黑", 10F);
  158. this.label4.ForeColor = System.Drawing.Color.White;
  159. this.label4.Location = new System.Drawing.Point(, );
  160. this.label4.Name = "label4";
  161. this.label4.Size = new System.Drawing.Size(, );
  162. this.label4.TabIndex = ;
  163. this.label4.Text = "请选择饮品:";
  164. this.label4.Click += new System.EventHandler(this.label4_Click);
  165. //
  166. // checkBox1
  167. //
  168. this.checkBox1.AutoSize = true;
  169. this.checkBox1.BackColor = System.Drawing.Color.Transparent;
  170. this.checkBox1.Font = new System.Drawing.Font("微软雅黑", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
  171. this.checkBox1.ForeColor = System.Drawing.Color.Black;
  172. this.checkBox1.Location = new System.Drawing.Point(, );
  173. this.checkBox1.Name = "checkBox1";
  174. this.checkBox1.Size = new System.Drawing.Size(, );
  175. this.checkBox1.TabIndex = ;
  176. this.checkBox1.Text = "奶茶";
  177. this.checkBox1.UseVisualStyleBackColor = false;
  178. //
  179. // checkBox2
  180. //
  181. this.checkBox2.AutoSize = true;
  182. this.checkBox2.BackColor = System.Drawing.Color.Transparent;
  183. this.checkBox2.Font = new System.Drawing.Font("微软雅黑", 10F);
  184. this.checkBox2.ForeColor = System.Drawing.Color.Black;
  185. this.checkBox2.Location = new System.Drawing.Point(, );
  186. this.checkBox2.Name = "checkBox2";
  187. this.checkBox2.Size = new System.Drawing.Size(, );
  188. this.checkBox2.TabIndex = ;
  189. this.checkBox2.Text = "可乐";
  190. this.checkBox2.UseVisualStyleBackColor = false;
  191. //
  192. // checkBox3
  193. //
  194. this.checkBox3.AutoSize = true;
  195. this.checkBox3.BackColor = System.Drawing.Color.Transparent;
  196. this.checkBox3.Font = new System.Drawing.Font("微软雅黑", 10F);
  197. this.checkBox3.Location = new System.Drawing.Point(, );
  198. this.checkBox3.Name = "checkBox3";
  199. this.checkBox3.Size = new System.Drawing.Size(, );
  200. this.checkBox3.TabIndex = ;
  201. this.checkBox3.Text = "豆浆";
  202. this.checkBox3.UseVisualStyleBackColor = false;
  203. //
  204. // checkBox4
  205. //
  206. this.checkBox4.AutoSize = true;
  207. this.checkBox4.BackColor = System.Drawing.Color.Transparent;
  208. this.checkBox4.Font = new System.Drawing.Font("微软雅黑", 10F);
  209. this.checkBox4.Location = new System.Drawing.Point(, );
  210. this.checkBox4.Name = "checkBox4";
  211. this.checkBox4.Size = new System.Drawing.Size(, );
  212. this.checkBox4.TabIndex = ;
  213. this.checkBox4.Text = "圣代";
  214. this.checkBox4.UseVisualStyleBackColor = false;
  215. this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
  216. //
  217. // checkBox5
  218. //
  219. this.checkBox5.AutoSize = true;
  220. this.checkBox5.BackColor = System.Drawing.Color.Transparent;
  221. this.checkBox5.Font = new System.Drawing.Font("微软雅黑", 10F);
  222. this.checkBox5.Location = new System.Drawing.Point(, );
  223. this.checkBox5.Name = "checkBox5";
  224. this.checkBox5.Size = new System.Drawing.Size(, );
  225. this.checkBox5.TabIndex = ;
  226. this.checkBox5.Text = "蔬菜汤";
  227. this.checkBox5.UseVisualStyleBackColor = false;
  228. //
  229. // checkBox6
  230. //
  231. this.checkBox6.AutoSize = true;
  232. this.checkBox6.BackColor = System.Drawing.Color.Transparent;
  233. this.checkBox6.Font = new System.Drawing.Font("微软雅黑", 10F);
  234. this.checkBox6.Location = new System.Drawing.Point(, );
  235. this.checkBox6.Name = "checkBox6";
  236. this.checkBox6.Size = new System.Drawing.Size(, );
  237. this.checkBox6.TabIndex = ;
  238. this.checkBox6.Text = "牛奶";
  239. this.checkBox6.UseVisualStyleBackColor = false;
  240. //
  241. // label5
  242. //
  243. this.label5.AutoSize = true;
  244. this.label5.BackColor = System.Drawing.Color.Transparent;
  245. this.label5.Font = new System.Drawing.Font("微软雅黑", 10F);
  246. this.label5.ForeColor = System.Drawing.Color.White;
  247. this.label5.Location = new System.Drawing.Point(, );
  248. this.label5.Name = "label5";
  249. this.label5.Size = new System.Drawing.Size(, );
  250. this.label5.TabIndex = ;
  251. this.label5.Text = "请输入地址:";
  252. //
  253. // label6
  254. //
  255. this.label6.AutoSize = true;
  256. this.label6.BackColor = System.Drawing.Color.Transparent;
  257. this.label6.Font = new System.Drawing.Font("微软雅黑", 10F);
  258. this.label6.ForeColor = System.Drawing.Color.White;
  259. this.label6.Location = new System.Drawing.Point(, );
  260. this.label6.Name = "label6";
  261. this.label6.Size = new System.Drawing.Size(, );
  262. this.label6.TabIndex = ;
  263. this.label6.Text = "请输入电话:";
  264. this.label6.Click += new System.EventHandler(this.label6_Click);
  265. //
  266. // textBox1
  267. //
  268. this.textBox1.Font = new System.Drawing.Font("微软雅黑", 10F);
  269. this.textBox1.Location = new System.Drawing.Point(, );
  270. this.textBox1.Multiline = true;
  271. this.textBox1.Name = "textBox1";
  272. this.textBox1.Size = new System.Drawing.Size(, );
  273. this.textBox1.TabIndex = ;
  274. //
  275. // textBox2
  276. //
  277. this.textBox2.Font = new System.Drawing.Font("微软雅黑", 10F);
  278. this.textBox2.Location = new System.Drawing.Point(, );
  279. this.textBox2.Multiline = true;
  280. this.textBox2.Name = "textBox2";
  281. this.textBox2.Size = new System.Drawing.Size(, );
  282. this.textBox2.TabIndex = ;
  283. //
  284. // button1
  285. //
  286. this.button1.BackColor = System.Drawing.Color.Transparent;
  287. this.button1.Font = new System.Drawing.Font("微软雅黑", 15F);
  288. this.button1.Location = new System.Drawing.Point(, );
  289. this.button1.Name = "button1";
  290. this.button1.Size = new System.Drawing.Size(, );
  291. this.button1.TabIndex = ;
  292. this.button1.Text = "提交";
  293. this.button1.UseVisualStyleBackColor = false;
  294. this.button1.Click += new System.EventHandler(this.button1_Click);
  295. //
  296. // Form1
  297. //
  298. this.AutoScaleDimensions = new System.Drawing.SizeF(16F, 35F);
  299. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  300. this.BackgroundImage = global::WindowsFormsApplication1.Properties.Resources._81093c0c839ca9eff9a92b5c38ad3686;
  301. this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
  302. this.ClientSize = new System.Drawing.Size(, );
  303. this.Controls.Add(this.button1);
  304. this.Controls.Add(this.textBox2);
  305. this.Controls.Add(this.textBox1);
  306. this.Controls.Add(this.label6);
  307. this.Controls.Add(this.label5);
  308. this.Controls.Add(this.checkBox6);
  309. this.Controls.Add(this.checkBox5);
  310. this.Controls.Add(this.checkBox4);
  311. this.Controls.Add(this.checkBox3);
  312. this.Controls.Add(this.checkBox2);
  313. this.Controls.Add(this.checkBox1);
  314. this.Controls.Add(this.label4);
  315. this.Controls.Add(this.radioButton3);
  316. this.Controls.Add(this.radioButton2);
  317. this.Controls.Add(this.radioButton1);
  318. this.Controls.Add(this.label3);
  319. this.Controls.Add(this.comboBox1);
  320. this.Controls.Add(this.label2);
  321. this.Controls.Add(this.label1);
  322. this.Font = new System.Drawing.Font("微软雅黑", 20F);
  323. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  324. this.Margin = new System.Windows.Forms.Padding(, , , );
  325. this.Name = "Form1";
  326. this.Text = "KFC";
  327. this.ResumeLayout(false);
  328. this.PerformLayout();
  329.  
  330. }
  331.  
  332. #endregion
  333.  
  334. private System.Windows.Forms.Label label1;
  335. private System.Windows.Forms.Label label2;
  336. private System.Windows.Forms.ComboBox comboBox1;
  337. private System.Windows.Forms.Label label3;
  338. private System.Windows.Forms.RadioButton radioButton1;
  339. private System.Windows.Forms.RadioButton radioButton2;
  340. private System.Windows.Forms.RadioButton radioButton3;
  341. private System.Windows.Forms.Label label4;
  342. private System.Windows.Forms.CheckBox checkBox1;
  343. private System.Windows.Forms.CheckBox checkBox2;
  344. private System.Windows.Forms.CheckBox checkBox3;
  345. private System.Windows.Forms.CheckBox checkBox4;
  346. private System.Windows.Forms.CheckBox checkBox5;
  347. private System.Windows.Forms.CheckBox checkBox6;
  348. private System.Windows.Forms.Label label5;
  349. private System.Windows.Forms.Label label6;
  350. private System.Windows.Forms.TextBox textBox1;
  351. private System.Windows.Forms.TextBox textBox2;
  352. private System.Windows.Forms.Button button1;
  353. }
  354. }
  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.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. comboBox1.SelectedIndex = ;//设置下拉框的默认值为第一行数据而不是为空;
  19. }
  20.  
  21. private void label1_Click(object sender, EventArgs e)
  22. {
  23.  
  24. }
  25.  
  26. private void radioButton3_CheckedChanged(object sender, EventArgs e)
  27. {
  28.  
  29. }
  30.  
  31. private void radioButton2_CheckedChanged(object sender, EventArgs e)
  32. {
  33.  
  34. }
  35.  
  36. private void label4_Click(object sender, EventArgs e)
  37. {
  38.  
  39. }
  40.  
  41. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  42. {
  43.  
  44. }
  45.  
  46. private void label6_Click(object sender, EventArgs e)
  47. {
  48.  
  49. }
  50.  
  51. private void button1_Click(object sender, EventArgs e)
  52. {
  53. //主食
  54. string zs = comboBox1.SelectedItem.ToString();
  55. //配餐
  56. string pc = "";
  57. if (radioButton1.Checked)//判断是否选中
  58. pc = radioButton1.Text;
  59. else if (radioButton2.Checked)
  60. pc = radioButton2.Text;
  61. else
  62. pc = radioButton3.Text;
  63. //饮品
  64. string yp = "";
  65. if (checkBox1.Checked)//判断饮品1是否选中
  66. yp += checkBox1.Text;
  67. if (checkBox2.Checked)
  68. {
  69. if (yp != "")//如果前面已经有选择过的饮品就加逗号
  70. {
  71. yp += ",";
  72. }
  73. yp += checkBox2.Text;
  74. }
  75. if (checkBox3.Checked)
  76. {
  77. if (yp != "")
  78. {
  79. yp += ",";
  80. }
  81. yp += checkBox3.Text;
  82. }
  83. if (checkBox4.Checked)
  84. {
  85. if (yp != "")
  86. {
  87. yp += ",";
  88. }
  89. yp += checkBox4.Text;
  90. }
  91. if (checkBox5.Checked)
  92. {
  93. if (yp != "")
  94. {
  95. yp += ",";
  96. }
  97. yp += checkBox5.Text;
  98. if (checkBox6.Checked)
  99. {
  100. if (yp != "")
  101. {
  102. yp += ",";
  103. }
  104. yp += checkBox6.Text;
  105. }
  106. }
  107. //地址
  108. string dz = textBox1.Text;
  109. //电话
  110. string tel = textBox2.Text;
  111. MessageBox.Show("您选的的主食是:" + zs + "\r您选择的配餐是:" + pc + "\r您选择的饮品是:" + yp + "\r配送地址:" + dz + "\r联系电话:" + tel);
  112. }
  113.  
  114. private void label2_Click(object sender, EventArgs e)
  115. {
  116.  
  117. }
  118. }
  119. }

Button控制操作

Winform窗体的基本控件的更多相关文章

  1. C# 中对WinForm窗体中的控件快速设置TableIndex次序

    点击“视图”--“Tab键顺序”,然后便可设置.

  2. winform 窗体中 Time 控件的用法

    作用: 用于背景进程中.通过引发Timer事件,Timer控件可以有规律的隔一段时间执行一次代码.也就是,你可以根据你自己的需要,给Timer控件设置时间,Timer每隔这段时间,就执行一次代码. 属 ...

  3. WinForm窗体中窗口控件的生成

    1:button控件的生成方式 Button button = new Button(); button.Size = new Size(80, 80); button.Location = new ...

  4. winform窗体中查找控件

    private RichTextBox FindControl()        { RichTextBox ret = null;            try            {       ...

  5. WPF中不规则窗体与WindowsFormsHost控件的兼容问题完美解决方案

    首先先得瑟一下,有关WPF中不规则窗体与WindowsFormsHost控件不兼容的问题,网上给出的解决方案不能满足所有的情况,是有特定条件的,比如  WPF中不规则窗体与WebBrowser控件的兼 ...

  6. WPF中不规则窗体与WebBrowser控件的兼容问题解决办法

    原文:WPF中不规则窗体与WebBrowser控件的兼容问题解决办法 引言 这几天受委托开发一个网络电视项目,要求初步先使用内嵌网页形式实现视频播放和选单,以后再考虑将网页中的所有功能整合进桌面程序. ...

  7. WPF中嵌入WinForm中的webbrowser控件

    原文:WPF中嵌入WinForm中的webbrowser控件 使用VS2008创建WPF应用程序,需使用webbrowser.从工具箱中添加WPF组件中的webbrowser发现其中有很多属性事件不能 ...

  8. winform 自定义控件:半透明Loading控件

    winform  自定义控件:半透明Loading控件 by wgscd date:2015-05-05 效果: using System;using System.Drawing;using Sys ...

  9. 富客户端 wpf, Winform 多线程更新UI控件

    前言 在富客户端的app中,如果在主线程中运行一些长时间的任务,那么应用程序的UI就不能正常相应.因为主线程要负责消息循环,相应鼠标等事件还有展现UI. 因此我们可以开启一个线程来格外处理需要长时间的 ...

随机推荐

  1. SSRF安全威胁在JAVA代码中的应用

    如上图所示代码,在进行外部url调用的时候,引入了SSRF检测:ssrfChecker.checkUrlWithoutConnection(url)机制. SSRF安全威胁:   很多web应用都提供 ...

  2. Java关于Properties用法(二)——替换配置文件中的参数

    上一章讲了配置文件的基本用法,虽然上一章已经可以解决一些需求,但还不些不足之处.假如,配置文件里面的字符串有一部分需要经常变动,另外一些不需要,上一章的方法就不方便了,所以这章主要讲如何在配置文件中使 ...

  3. 解决WIN7与虚拟机CentOS的文件夹共享问题

    一.系统与软件 WIN7 64bit.VirtualBox 5.0.14.CentOS 6.5.SecureCRT 7.2.3 二.使用文件夹共享需要安装增强功能,但是安装时无法读取光盘iso文件 三 ...

  4. ABP导航源码分析

    按步骤看: 1,在Global.asax中执行: base.Application_Start(sender, e); 2,在AbpWebApplication类的Application_Start( ...

  5. 如何用ORM支持SQL语句的CASE WHEN?

    OQL如何支持CASE WHEN? 今天,一个朋友问我,OQL可否支持CASE WHEN语句?他给的示例SQL如下: then '启用' else '停用' from tb_User OQL是SOD框 ...

  6. jQuery获取Table-Input控件值封装

  7. 获取OpenFileDialog的文件名和文件路径

    得到文件名 string fileName = ofd.SafeFileName; 得到路径 string filePath = System.IO.Path.GetDirectoryName(ofd ...

  8. 基本排序算法——基数排序java实现

    基数排序 package basic.sort; import java.util.Arrays; import java.util.Random; public class RadixSort { ...

  9. SharePoint Permission Extension

    SharePoint Permission Extension 项目很久没维护了,也没有迁移到sp2013上(貌似只要把2013的Form的RenderMode设置为Server后也是可以用的). 在 ...

  10. JSON解析和XML解析对比

    JSON解析和XML解析是较为普遍的两种解析方式,其中JSON解析的市场分额更大.本文系统的分析两种解析方式的区别,为更好地处理数据作准备.由于目前阶段主要是做移动开发,所以本文所描述的JSON解析和 ...