惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
Jina AI
Jina AI
GbyAI
GbyAI
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
P
Proofpoint News Feed
The Cloudflare Blog
H
Help Net Security
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
量子位
博客园 - 聂微东
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
月光博客
月光博客

博客园 - caoyang.org

jupyter centos 6 yum源记录,离线下载rpm包的办法 使用命令提示符连接到无线网络 linux系统的ssh服务开启方法 nodejs dateformat date-utils nodejs async nodejs dateformat date-utils nodejs timer block-timer timer-ease linux 修改 ssh 的端口号,启动hg服务 linux 下添加 路由 【msdn wpf forum翻译】TextBox中文本 中对齐 的方法 - caoyang.org 【msdn wpf forum翻译】TextBlock等类型的默认样式(implicit style)为何有时不起作用? 【msdn wpf forum翻译】获取当前窗口焦点所在的元素 【msdn wpf forum翻译】如何在wpf程序(程序激活时)中捕获所有的键盘输入,而不管哪个元素获得焦点? 【msdn wpf forum翻译】在wpf程序中显示一个doc文件的内容 《Applications=Code+Markup》读书笔记 2(第二章 基本画刷) Bind Enum to Combobox.SelectedIndex 如何捕获正在执行的函数名? wpf中显示HTML(转自http://steeven.cnblogs.com/archive/2006/06/12/424258.html)
《Applications=Code+Markup》读书笔记 1(第一章 初识Applica...
caoyang.org · 2007-09-24 · via 博客园 - caoyang.org

知识点

[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();