Bagikan melalui


FontInfo Kelas

Definisi

Merangkum properti font teks. Kelas ini tidak dapat diwariskan.

public ref class FontInfo sealed
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
public sealed class FontInfo
[<System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))>]
type FontInfo = class
Public NotInheritable Class FontInfo
Warisan
FontInfo
Atribut

Contoh

Contoh kode berikut menunjukkan cara mengubah properti FontInfo objek secara terprogram untuk menentukan properti font untuk Label kontrol.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  void Page_Load(object sender, EventArgs e)
  {
    // When the page loads, set the myLabel Label control's FontInfo properties.
    // Note that myLabel.Font is a FontInfo object.
    
    myLabel.Font.Bold = true;
    myLabel.Font.Italic = false;
    myLabel.Font.Name = "verdana";
    myLabel.Font.Overline = false;
    myLabel.Font.Size = 10;
    myLabel.Font.Strikeout = false;
    myLabel.Font.Underline = true;
    
    // Write information on the FontInfo object to the myLabel label.
    myLabel.Text = myLabel.Font.ToString();
    
  }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>FontInfo Example</title>
</head>
  <body>
    <form id="form1" runat="server">
    <h3>FontInfo Example</h3>
      <asp:Label id="myLabel" 
        runat="server" >
      </asp:Label>
    </form>
  </body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
  
    ' When the page loads, set the myLabel Label control's FontInfo properties.
    ' Note that myLabel.Font is a FontInfo object.
    
    myLabel.Font.Bold = True
    myLabel.Font.Italic = False
    myLabel.Font.Name = "verdana"
    myLabel.Font.Overline = False
    myLabel.Font.Size = 10
    myLabel.Font.Strikeout = False
    myLabel.Font.Underline = True
    
    ' Write information on the FontInfo object to the myLabel label.
    myLabel.Text = myLabel.Font.ToString()
    
  End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>FontInfo Example</title>
</head>
  <body>
    <form id="form1" runat="server">
    <h3>FontInfo Example</h3>
      <asp:Label id="myLabel" 
        runat="server" >
      </asp:Label>
    </form>
  </body>
</html>

Keterangan

FontInfo Gunakan kelas untuk merangkum properti font teks. Anda dapat menentukan nama font dan ukuran font. Anda juga dapat menentukan apakah gaya font tebal, miring, ditimpa, coretan, atau digarisbawahi.

Kelas ini biasanya digunakan dalam properti untuk kelas yang memerlukan informasi font, seperti Font properti WebControl kelas.

Nota

Kelas ini tidak memiliki konstruktor publik. Instans baru kelas tidak dapat dibuat secara langsung.

Properti

Nama Deskripsi
Bold

Mendapatkan atau menetapkan nilai yang menunjukkan apakah font tebal.

Italic

Mendapatkan atau menetapkan nilai yang menunjukkan apakah font miring.

Name

Mendapatkan atau mengatur nama font utama.

Names

Mendapatkan atau mengatur array nama font yang diurutkan.

Overline

Mendapatkan atau menetapkan nilai yang menunjukkan apakah font ditimpa.

Size

Mendapatkan atau mengatur ukuran font.

Strikeout

Mendapatkan atau menetapkan nilai yang menunjukkan apakah font dicoret.

Underline

Mendapatkan atau menetapkan nilai yang menunjukkan apakah font digaris bawahi.

Metode

Nama Deskripsi
ClearDefaults()

Mereset semua FontInfo properti ke status unset dan menghapus status tampilan.

CopyFrom(FontInfo)

Menduplikasi properti font yang ditentukan FontInfo ke dalam instans FontInfo kelas tempat metode ini dipanggil.

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan Type instans saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari Objectsaat ini.

(Diperoleh dari Object)
MergeWith(FontInfo)

Menggabungkan properti font dari yang ditentukan FontInfo dengan instans FontInfo kelas tempat metode ini dipanggil.

ShouldSerializeNames()

Menentukan apakah Names properti harus dipertahankan.

ToString()

Mengembalikan string yang berisi nama dan ukuran font untuk instans FontInfo kelas.

Berlaku untuk

Lihat juga