zoukankan      html  css  js  c++  java
  • <winform>简单应用控件

           对于初学者来说,怎样简单应用Winform中的控件,不是一件容易的事。我浅显的讲讲应用,首先双击VS2012--->FILE--->New--->Project--->Windows Forms Application。在Form中可以设计布局了,例如选择工具栏中的Button/Label/TextBox等控件,将其拖入Form中进行设计。我选择上次做的软件来举例。所以软件布局如下:

                        

            其中,Label控件就是将想输入的字母写入它的Text属性,然而要想输入&并不容易,就是多写入一个&,例如INC&DEC要在Text属性中写入INC&&DEC。Button控件的字母是通过Text属性,设置Enabled属性就会改变Button的色彩。在TextBox中通过设置Text属性来设初始值。

            最后,Button/Form控件可以通过双击出它的Click事件,从中可以编写相关代码。例如:

     private void btnStart_Click(object sender, EventArgs e)
    
            {
    
                btnStart.Enabled = false;
    
                btnStop.Enabled = true;
    
                btnReset.Enabled = true;
    
                btnClose.Enabled = true;
    
                
    
    
    
    
                timer1.Enabled = true;   
    
                if (time == 1)
    
                {
    
                    textBox2.Text = "INC & DEC :Increasing ";
    
                    StreamWriter aw = new StreamWriter("d://c.text");  
    
                    aw.WriteLine("1");
    
                    aw.Close();
    
                }
    
                else if(time == 2)
    
                {
    
                    textBox2.Text = "INC & DEC : Decreasing ";
    
                    StreamWriter aw = new StreamWriter("d://c.text"); 
    
                    aw.WriteLine("6");
    
                    aw.Close();
    
                }                              //Send start information
    
           
    
            }
  • 相关阅读:
    kaggle编码categorical feature总结
    sklearn---DBSCAN
    Panda to Panda.Dataframe?
    pandas的分组取最大多行并求和函数nlargest()
    26.异常检测---孤立森林 | one-class SVM
    PowerShell----Automatic_Variables(预定义变量)
    powershell---高级函数的介绍
    PowerShell中的配置文件
    PowerShell如何使用自定义公共函数
    探索PowerShell----函数
  • 原文地址:https://www.cnblogs.com/virgil/p/2715554.html
Copyright © 2011-2022 走看看