指定した FontInfo のフォントのプロパティを、このメソッドの呼び出し元である FontInfo クラスのインスタンスに複製します。
Public Sub CopyFrom( _
ByVal f As FontInfo _)
[C#]
public void CopyFrom(FontInfof);
[C++]
public: void CopyFrom(FontInfo* f);
[JScript]
public function CopyFrom(
f : FontInfo);
パラメータ
- f
複製するフォント プロパティを格納している FontInfo 。
解説
CopyFrom メソッドを使用して、指定した FontInfo のフォント プロパティをこのメソッドの呼び出し元である FontInfo クラスのインスタンスに複製します。
注意 FontInfo クラスの現在のインスタンスにあるすべてのプロパティは、 f パラメータの関連付けられているプロパティによって置き換えられます。
使用例
[Visual Basic, C#] CopyFrom メソッドを使用して、 FontInfo のフォント プロパティを Label コントロールの Font プロパティに複製する方法を次の例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<head>
<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 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-Name="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>
[C#]
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<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 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-Name="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>
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
参照
FontInfo クラス | FontInfo メンバ | System.Web.UI.WebControls 名前空間 | MergeWith | Font