zoukankan      html  css  js  c++  java
  • 《Applications=Code+Markup》读书笔记 1(第一章 初识Application和Window)

    知识点

    [STAThread] WPF程序的Main函数必须声明为[STAThread]:

    In any WPF program, the [STAThread] attribute must precede Main or the C# compiler will complain.
    This attribute directs the threading model of the initial application thread to be a single-threaded apartment,
    which is required for interoperability with the Component Object Model (COM).
    "Single-threaded apartment" is an old COM-era, pre-.NET programming term,
    but for our purposes you could imagine it to mean
    our application won't be using multiple threads originating from the runtime environment.
    

    app.Run();开始进入消息循环,可带参数(win)

    介绍Application中的事件

    包括Startup, SessionEnding 等 以及 可override的函数(default event handler) OnStartup , OnSessionEnding

    Window 中的事件(继承自UIElement)(TextInput,MouseDown等)

    Following initialization, virtually everything a program does is in response to an event.
    These events usually indicate keyboard, mouse, or stylus input from the user.
    The UIElement class (which refers to the user interface, of course) defines a number of keyboard-,
    mouse-, and stylus-related events; the Window class inherits all those events.
    One of those events is named \MouseDown. A window's \MouseDown event occurs 
    whenever the user clicks the client area of the window with the mouse.
    

    Window的一些属性(Height,Width,Top,Left; Title; WindowStartupLocation; WindowStyle; ResizeMode;WindowState )

    由Background 引出Brushes(见下一章)

    关键

    熟悉Application和Window的事件

    在需要的情况下可继承Window以及Application

    在子类中override其中的一些event handler, 修改一些属性

    一个WPF程序只有一个Application(对象),这个Application可创建多个Window

    这些Window的各种属性都可以通过程序控制.

    Window可以以Show()和ShowDialog()两种方式Show出来,弄清二者的区别

    隐藏一个Window可以用Hide(),关闭则调用它的Close();

  • 相关阅读:
    初探nodejs事件循环机制event loop
    夯实基础之--new关键字、instanceOf原理
    分享-结合demo讲解JS引擎工作原理
    Linux-centos安装node、nginx小记
    openlayers5实战--踩坑总结
    node+koa中转层开发实践总结
    vue预渲染实践总结
    css多行省略-webkit-box-orient打包编译后失效原因
    使用mpVue开发小程序实战总结
    Linux crontab定时执行任务
  • 原文地址:https://www.cnblogs.com/caoyang/p/904616.html
Copyright © 2011-2022 走看看