本文整理汇总了C#中Microsoft.Win32.SystemEvents.UserPreferenceChanged事件的典型用法代码示例。如果您正苦于以下问题:C# SystemEvents.UserPreferenceChanged事件的具体用法?C# SystemEvents.UserPreferenceChanged怎么用?C# SystemEvents.UserPreferenceChanged使用的例子?那么, 这里精选的事件代码示例或许可以为您提供帮助。您也可以进一步了解该事件所在类Microsoft.Win32.SystemEvents
的用法示例。
在下文中一共展示了SystemEvents.UserPreferenceChanged事件的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Form1
//引入命名空间
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
public class Form1 : Form
{
private System.Windows.Forms.Label label2;
public Form1() {
this.Font = SystemFonts.IconTitleFont;
this.AutoScaleDimensions = new System.Drawing.SizeF(6.0F, 13.0F);
InitializeComponent();
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
}
private void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
if (e.Category == UserPreferenceCategory.Window)
{
this.Font = SystemFonts.IconTitleFont;
}
}
private void InitializeComponent()
{
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label2
//
this.label2.Location = new System.Drawing.Point(12, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(220, 55);
this.label2.TabIndex = 2;
this.label2.Text = "Try changing the Small Fonts/Large Fonts setting for th" +
"e computer.";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(244, 138);
this.Controls.Add(this.label2);
this.Text = "Form1";
this.ResumeLayout(false);
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
}