-- Foreground for Selected ListViewItem --> <SolidColorBrush x:Key="{x:Static <em>SystemColors</em>.HighlightTextBrushKey -- Background for Selected ListViewItem --> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey TargetType="ListViewItem"> <Style.Resources> <SolidColorBrush x:Key="{x:Static <em>SystemColors</em>.ControlBrushKey }" Color="Yellow"/> <SolidColorBrush x:Key="{x:Static <em>SystemColors</em>.HighlightBrushKey} <Setter.Value> <DynamicResource ResourceKey="{x:Static SystemColors.ControlBrushKey
= System.Drawing.Color.Navy; dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight ; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; this.DataGridView1.EnableHeadersVisualStyles = false; this.DataGridView1.GridColor = System.Drawing.SystemColors.GradientInactiveCaption
TargetType="{x:Type TextBox}"> <Setter Property="Background" Value="{DynamicResource {x:Static <em>SystemColors</em>.WindowBrushKey StaticResource TextBox.Static.Border}"/> <Setter Property="Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.ControlTextBrushKey MultiTrigger.Conditions> <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static <em>SystemColors</em>.InactiveSelectionHighlightBrushKey
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static <em>SystemColors</em>.HighlightBrushKey /> <Setter Property="Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.HighlightTextBrushKey <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static <em>SystemColors</em>.ControlBrushKey "/> <Setter Property="Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.ControlTextBrushKey "> <Setter Property="Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.GrayTextBrushKey
new LinearGradientBrush( 6 this.Bounds, 7 SystemColors.ControlLightLight , 8 SystemColors.ControlLight, 9 LinearGradientMode.Vertical , SystemColors.ControlLight, System.Drawing.Drawing2D.LinearGradientMode.Vertical); 52 , 97 SystemColors.ControlLight, 98 LinearGradientMode.Vertical , SystemColors.ControlLight, System.Drawing.Drawing2D.LinearGradientMode.Vertical); 142
<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static <em>SystemColors</em>.ControlTextBrushKey StaticResource Button.Static.Border}"/> <Setter Property="Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.ControlTextBrushKey <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static <em>SystemColors</em>.HighlightBrushKey 3.2 颜色 从Button的控件模板可以看到Button的字体颜色使用了{DynamicResource {x:Static <em>SystemColors</em>.ControlTextBrushKey}}。 <em>SystemColors</em>,包含与系统显示元素相对应的系统颜色、系统画笔和系统资源键。 SystemParameters,包含可用来查询系统设置的属性。 使用方式可以参考资源帮助主题。
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static <em>SystemColors</em>.ControlBrushKey }}"/> <Setter Property="Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.GrayTextBrushKey
BeginInit(); this.SuspendLayout(); // // dataGrid1 // this.dataGrid1.CaptionBackColor = System.Drawing.SystemColors.Info ; this.dataGrid1.CaptionForeColor = System.Drawing.SystemColors.WindowText; this.dataGrid1.CaptionVisible = false; this.dataGrid1.DataMember = ""; this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; splitContainer1.ForeColor = System.Drawing.SystemColors.Control splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.Control; // Add a TreeView control treeView1.Dock = System.Windows.Forms.DockStyle.Fill; treeView1.ForeColor = System.Drawing.SystemColors.InfoText
= null) { theLastNode.ForeColor = SystemColors.WindowText;
x:Name="Border" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey <Setter TargetName="Border" Property="Stroke" Value="{DynamicResource {x:Static <em>SystemColors</em>.ControlDarkBrushKey <Setter TargetName="Border" Property="Fill" Value="{DynamicResource {x:Static <em>SystemColors</em>.ControlDarkBrushKey SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static <em>SystemColors</em>.ControlTextBrushKey ScrollBar.Static.Border}" /> <Setter Property="Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.ControlTextBrushKey
这些可通过 System.Windows.SystemColors 访问: Color Color Resource Key Brush Brush Resource Key Accent AccentColor 以下是将前景色设置为用户选择的强调色的 UI:TextBlock <TextBlock Text="First Name:" Foreground="{DynamicResource {x:Static <em>SystemColors</em>.AccentColorBrushKey
这些可通过 System.Windows.SystemColors 访问: Color Color Resource Key Brush Brush Resource Key Accent AccentColor 以下是将前景色设置为用户选择的强调色的 UI:TextBlock <TextBlock Text="First Name:" Foreground="{DynamicResource {x:Static <em>SystemColors</em>.AccentColorBrushKey
{ // 清除图片原本背景,并以系统背景色填充 seatG.Clear(SystemColors.AppWorkspace
<Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource {x:Static <em>SystemColors</em>.HighlightBrushKey Canvas Margin="-6,-1"> <Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource {x:Static <em>SystemColors</em>.HighlightBrushKey
用途:处理当操作系统的Theme发生改变后,以及诸如SystemColors,SystemFonts,电源,显示器等跟系统关联的资源发生改变时,更新WPF这边的表现。
Hyperlink}"> <Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.HotTrackBrushKey <Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static <em>SystemColors</em>.GrayTextBrushKey
public void SelectMe() { IsSelected = true; this.BackColor = SystemColors.Info mf.MainContainerP.Controls.Clear(); mf.MainContainerP.Controls.Add(this); SubMenu.BackColor = SystemColors.Info
label3 // this.label3.AutoSize = true; this.label3.BackColor = System.Drawing.SystemColors.ActiveCaption , System.Drawing.GraphicsUnit.Point, ((byte)(128))); this.label4.ForeColor = System.Drawing.SystemColors.HotTrack = System.Drawing.SystemColors.ActiveCaption) { bmp.MakeTransparent(Color.FromArgb EventArgs e) { this.pictureBox1.Image = null; this.label3.BackColor = System.Drawing.SystemColors.ActiveCaption
var lb = sender as Label; lb.BackColor = Color.Transparent; lb.ForeColor = SystemColors.ControlText object sender, EventArgs e) { var lb = sender as Label; lb.BackColor = SystemColors.Info