博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
VS2012窗口操作简单演示
阅读量:7091 次
发布时间:2019-06-28

本文共 5314 字,大约阅读时间需要 17 分钟。

呵呵,终于进入到我感兴趣的窗口方面的操作啦。。

三个窗口的SHOW和HIDE。。。

PROGRAM.CS中记录第一个加载的窗口FORM

using System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication1{    static class Program    {        ///         /// The main entry point for the application.        ///         [STAThread]        static void Main()        {            Application.EnableVisualStyles();            Application.SetCompatibleTextRenderingDefault(false);            Application.Run(new Form1());        }    }}

FORM1.CS的主要代码如下:

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 WindowsFormsApplication112 {13     public partial class Form1 : Form14     {15         public Form1()16         {17             InitializeComponent();18         }19 20         private void label1_Click(object sender, EventArgs e)21         {22 23         }24 25         private void button1_Click(object sender, EventArgs e)26         {27             Form2 frm2 = new Form2();28             frm2.Show();29         }30 31         private void button2_Click(object sender, EventArgs e)32         {33             Form3 frm3 = new Form3();34             frm3.Show();35         }36 37         private void Form1_Load(object sender, EventArgs e)38         {39         }40     }41 }

至于下面这个代友乾坤,以后要慢慢研究的。

好像不建议手工更改,都是通过界面设置属性的。

1 namespace WindowsFormsApplication1 2 { 3     partial class Form1 4     { 5         ///  6         /// Required designer variable. 7         ///  8         private System.ComponentModel.IContainer components = null; 9 10         /// 11         /// Clean up any resources being used.12         /// 13         /// true if managed resources should be disposed; otherwise, false.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 Form Designer generated code24 25         /// 26         /// Required method for Designer support - do not modify27         /// the contents of this method with the code editor.28         /// 29         private void InitializeComponent()30         {31             this.button1 = new System.Windows.Forms.Button();32             this.button2 = new System.Windows.Forms.Button();33             this.label1 = new System.Windows.Forms.Label();34             this.SuspendLayout();35             // 36             // button137             // 38             this.button1.Location = new System.Drawing.Point(118, 260);39             this.button1.Name = "button1";40             this.button1.Size = new System.Drawing.Size(75, 23);41             this.button1.TabIndex = 0;42             this.button1.Text = "第一本";43             this.button1.UseVisualStyleBackColor = true;44             this.button1.Click += new System.EventHandler(this.button1_Click);45             // 46             // button247             // 48             this.button2.Location = new System.Drawing.Point(258, 260);49             this.button2.Name = "button2";50             this.button2.Size = new System.Drawing.Size(75, 23);51             this.button2.TabIndex = 1;52             this.button2.Text = "第二本";53             this.button2.UseVisualStyleBackColor = true;54             this.button2.Click += new System.EventHandler(this.button2_Click);55             // 56             // label157             // 58             this.label1.AutoSize = true;59             this.label1.Font = new System.Drawing.Font("Adobe Arabic", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));60             this.label1.Location = new System.Drawing.Point(92, 205);61             this.label1.Name = "label1";62             this.label1.Size = new System.Drawing.Size(303, 33);63             this.label1.TabIndex = 2;64             this.label1.Text = "最近看的计算机图书";65             this.label1.Click += new System.EventHandler(this.label1_Click);66             // 67             // Form168             // 69             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);70             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;71             this.BackColor = System.Drawing.SystemColors.HotTrack;72             this.ClientSize = new System.Drawing.Size(449, 505);73             this.Controls.Add(this.label1);74             this.Controls.Add(this.button2);75             this.Controls.Add(this.button1);76             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;77             this.Name = "Form1";78             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;79             this.Text = "窗体操作简单演示";80             this.Load += new System.EventHandler(this.Form1_Load);81             this.ResumeLayout(false);82             this.PerformLayout();83 84         }85 86         #endregion87 88         private System.Windows.Forms.Button button1;89         private System.Windows.Forms.Button button2;90         private System.Windows.Forms.Label label1;91     }92 }

效果图:

 

转载地址:http://ninql.baihongyu.com/

你可能感兴趣的文章
前端必备,50 个 Chrome Developer Tools 必备技巧
查看>>
客户故事:4家银行如何打造新一代移动金融中心
查看>>
NDK开发中这些基本知识你都懂吗
查看>>
自动化运维工具ansible的实践
查看>>
一个22万张NSFW图片的鉴黄数据集?我有个大胆的想法……
查看>>
do 一下来了一个 redux
查看>>
Vue教程09:双向绑定对象中属性原理
查看>>
如何实现VM框架中的数据绑定
查看>>
关于this
查看>>
[译] 系列教程:选择准备安装的 TensorFlow 类型
查看>>
Webhook到底是个啥?
查看>>
Flutter学习 ---- TravisCI加持
查看>>
借用UAC完成的提权思路分享
查看>>
『中级篇』 Linux网络命名空间(25)
查看>>
JS计算精度小记
查看>>
js的各种距离计算(较全)
查看>>
微信小程序异步API为Promise简化异步编程
查看>>
关于java泛型大大小小的那些事
查看>>
此面试题版本落后-请勿观看
查看>>
Stream流与Lambda表达式(三) 静态工厂类Collectors
查看>>