FontInfo.CopyFrom(FontInfo) Yöntem

Tanım

Belirtilen FontInfo öğesinin yazı tipi özelliklerini, bu yöntemin çağrıldığı sınıfın FontInfo örneğine çoğaltır.

public:
 void CopyFrom(System::Web::UI::WebControls::FontInfo ^ f);
public void CopyFrom (System.Web.UI.WebControls.FontInfo f);
member this.CopyFrom : System.Web.UI.WebControls.FontInfo -> unit
Public Sub CopyFrom (f As FontInfo)

Parametreler

f
FontInfo

FontInfo Çoğaltacak yazı tipi özelliklerini içeren bir.

Örnekler

Aşağıdaki örnekte, bir öğesinin CopyFrom yazı tipi özelliklerini denetimin FontInfo özelliğine Font çoğaltmak için yönteminin nasıl kullanılacağı gösterilmektedir Label .

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

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

   <head>
    <title>FontInfo CopyFrom Example</title>
<script runat="server">

         void CopyFontInfo(Object sender, EventArgs e)
         {

            // Copy the FontInfo of Sample1Label to ResultLabel.
            ResultLabel.Font.CopyFrom(Sample1Label.Font);
    
            ResultLabel.Text = "Copy Result";

         }

       </script>

   </head>

   <body>

      <form id="form1" runat="server">

         <h3>FontInfo CopyFrom Example</h3>

         Click <b>Copy</b> to copy the font style of Font Sample 1 
         and display the result <br /> in the Operation Result label.
         

         <br /><br />

         <asp:Label id="Sample1Label" 
              Text="Font Sample 1" 
              Font-Names="Times New Roman" 
              Font-Italic="true" 
              Font-Strikeout="true" 
              runat="server" />

         <br /><br />

         <asp:Button id="CopyButton" 
              Text="Copy" 
              OnClick="CopyFontInfo" 
              runat="server" />

         <br /><br />

         Operation Result: <br />

         <asp:Label id="ResultLabel"
              runat="server" />

      </form>

   </body>

</html>
<%@ Page Language="VB" AutoEventWireup="True" %>

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

   <head>
    <title>FontInfo CopyFrom Example</title>
<script runat="server">

         Sub CopyFontInfo(sender As Object, e As EventArgs)

            ' Copy the FontInfo of Sample1Label to ResultLabel.
            ResultLabel.Font.CopyFrom(Sample1Label.Font)
    
            ResultLabel.Text = "Copy Result"

         End Sub

       </script>

   </head>

   <body>

      <form id="form1" runat="server">

         <h3>FontInfo CopyFrom Example</h3>

         Click <b>Copy</b> to copy the font style of Font Sample 1 
         and display the result <br /> in the Operation Result label.
         

         <br /><br />

         <asp:Label id="Sample1Label" 
              Text="Font Sample 1" 
              Font-Names="Times New Roman" 
              Font-Italic="true" 
              Font-Strikeout="true" 
              runat="server" />

         <br /><br />

         <asp:Button id="CopyButton" 
              Text="Copy" 
              OnClick="CopyFontInfo" 
              runat="server" />

         <br /><br />

         Operation Result: <br />

         <asp:Label id="ResultLabel"
              runat="server" />

      </form>

   </body>

</html>

Açıklamalar

Belirtilen FontInfo öğesinin CopyFrom yazı tipi özelliklerini bu yöntemin çağrıldığı sınıfın FontInfo örneğinde çoğaltmak için yöntemini kullanın.

Dikkat

sınıfının geçerli örneğindeki FontInfo tüm özellikler parametresindeki ilişkili özellik f ile değiştirilir.

Bir stil kullanılarak RegisterStylekaydedildiğinde ve kullanılarak Style.CopyFrom(Style)kopyalandığında, tek tek özelliklerin CssClass tümü değil, yalnızca özelliği hedefe kopyalanır. Bu nedenle, yazı tipi bilgilerini kayıtlı bir Style özelliğinden Font kopyalamak için kullanıyorsanızFontInfo.CopyFrom(FontInfo), yazı tipinin tek tek ayarlarını stilden alamazsınız.

Şunlara uygulanır

Ayrıca bkz.