C#-如何确定表格';标题栏字体?
我想创建一个足够宽的表单来显示标题栏字符串,它是动态的。要计算字符串的文本宽度,我需要知道标题栏的字体。如何查询它?您可以使用属性: 获取用于在窗口标题栏中显示文本的字体 示例用法:C#-如何确定表格';标题栏字体?,c#,windows,forms,titlebar,C#,Windows,Forms,Titlebar,我想创建一个足够宽的表单来显示标题栏字符串,它是动态的。要计算字符串的文本宽度,我需要知道标题栏的字体。如何查询它?您可以使用属性: 获取用于在窗口标题栏中显示文本的字体 示例用法: using System.Drawing; var font = SystemFonts.CaptionFont; 您可以使用属性: 获取用于在窗口标题栏中显示文本的字体 示例用法: using System.Drawing; var font = SystemFonts.CaptionFont; 以下内容
using System.Drawing;
var font = SystemFonts.CaptionFont;
您可以使用属性:
获取用于在窗口标题栏中显示文本的字体
示例用法:
using System.Drawing;
var font = SystemFonts.CaptionFont;
以下内容似乎与powershell等效:
function Get-CaptionFont {
$font_family = ([Windows.SystemFonts]::"CaptionFontFamily").Source
$font_size = [Windows.SystemFonts]::"CaptionFontSize"
return New-Object System.Drawing.Font($font_family, $font_size, [System.Drawing.FontStyle]"Regular")
}
以下内容似乎与powershell等效:
function Get-CaptionFont {
$font_family = ([Windows.SystemFonts]::"CaptionFontFamily").Source
$font_size = [Windows.SystemFonts]::"CaptionFontSize"
return New-Object System.Drawing.Font($font_family, $font_size, [System.Drawing.FontStyle]"Regular")
}