FontFamily.Equals(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指示指定的对象是否为 FontFamily 以及是否与此 FontFamily 相等。
public:
override bool Equals(System::Object ^ obj);
public override bool Equals (object obj);
public override bool Equals (object? obj);
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean
参数
- obj
- Object
要测试的对象。
返回
如果 obj
为 FontFamily 且与此 FontFamily 相等,则为 true
;否则为 false
。
示例
下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse
,这是事件处理程序的参数Paint。 此代码执行以下操作:
创建两个 Font 对象。
测试它们是否等效。
在消息框中显示测试结果。
public:
void Equals_Example( PaintEventArgs^ /*e*/ )
{
// Create two FontFamily objects.
FontFamily^ firstFontFamily = gcnew FontFamily( "Arial" );
FontFamily^ secondFontFamily = gcnew FontFamily( "Times New Roman" );
// Check to see if the two font families are equivalent.
bool equalFonts = firstFontFamily->Equals( secondFontFamily );
// Display the result of the test in a message box.
MessageBox::Show( equalFonts.ToString() );
}
public void Equals_Example(PaintEventArgs e)
{
// Create two FontFamily objects.
FontFamily firstFontFamily = new FontFamily("Arial");
FontFamily secondFontFamily = new FontFamily("Times New Roman");
// Check to see if the two font families are equivalent.
bool equalFonts = firstFontFamily.Equals(secondFontFamily);
// Display the result of the test in a message box.
MessageBox.Show(equalFonts.ToString());
}
Public Sub Equals_Example(ByVal e As PaintEventArgs)
' Create two FontFamily objects.
Dim firstFontFamily As New FontFamily("Arial")
Dim secondFontFamily As New FontFamily("Times New Roman")
' Check to see if the two font families are equivalent.
Dim equalFonts As Boolean = _
firstFontFamily.Equals(secondFontFamily)
' Display the result of the test in a message box.
MessageBox.Show(equalFonts.ToString())
End Sub
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈