zoukankan      html  css  js  c++  java
  • Windows Forms 2.0 Programming 读书笔记Hello, Windows Forms

    快捷方式
    从设计视图切换到代码视图 F7
    将焦点移到属性面板 Alt+Enter,F4
    模板代码解读
    1.      动态主题支持 dynamic theme support
    --保证用户接口的外观和当前的Windows主题一致
    //keeps a UI's appearance consistent with the current Windows theme
    Application.EnableVisualStyles();
    2.      布局 Layout
    --确保将自动保持正确的视图比例
    //ensures that the form will automatically retain the correct visual proportions
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    3.      COM 支持
    --确保windows窗体和组件对象模型的正确交互的技术
    //enables appropriate communication between Windows Forms and Component Object Model (COM) technology
    [STAThread]
    4.      设计器支持
    --在我们可视化地设计窗体时,InitializeComponent方法给了窗体设计器一个放置初始化窗体和它的控件和组件的地方
    //InitializeComponent gives the Windows Forms Designer a place to put the code to initialize the form and its controls and components as we visually design the form
    private void InitializeComponent()
    1.       布局控件Arranging Controls
    锚定Anchoring
    锚定是Windows窗体为你提供的自动布局你的窗体和控件的方式
    Anchoring is one of the ways Windows Forms gives you automatic layout control of your forms and their controls
    吸附 Docking
    吸附允许你的任何控件粘附在它的容器的边缘
    Docking allows you to "stick" any control on the edge of its container
    2.       控件 Controls
    控件库工程 Control Library project
    创建可以重用的控件的集合,创建后在左侧的工具栏中会自动出现所创建的控件。
    3.       应用程序设置Application Settings
    所有你创建的设置都存储在你项目的app.config 文件中,在这个文件中设置按照范围被分组。
    在编译时这个文件的被拷贝到ApplicationName.exe.config
    All the settings you create are stored in your project's app.config file, in which they are grouped by scope
    //用户设置,对应的Setting类属性为读写,这个文件保存默认设置
    <userSettings></userSettings>
    //应用程序设置, 对应的Setting类属性为只读
    <applicationSettings></applicationSettings>
    // 保存所有对用户设置的修改Save all user settings
       Properties.Settings.Default.Save();
    修改后的用户设置保存在%SystemDrive%/Documents and Settings/UserName/
     Local Settings/Application Data/ProductName/
     ApplicationName.exe_Url_UrlHash/AssemblyVersionNumber/user.config
    //使用user.config, ApplicationName.exe.config中的值重置Setting类中的对应属性值
    Properties.Settings.Default.Reload();
    //使用ApplicationName.exe.config中属性值重置user.config中的属性值和Setting类中的对应属性值
    Properties.Settings.Default.Reset();
  • 相关阅读:
    python高级内置函数和各种推导式的介绍:一行搞定的代码
    迭代器、可迭代对象与生成器
    Git 从了解到放弃
    装饰器
    时间处理模块time
    map、filter、reduce、lambda
    python 发邮件
    日志模块
    office套件
    Nginx 实战(一) 集群环境搭建
  • 原文地址:https://www.cnblogs.com/oyjj/p/2133031.html
Copyright © 2011-2022 走看看