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