TreeNodeStyle.CopyFrom メソッド
アセンブリ: System.Web (system.web.dll 内)


CopyFrom メソッドを使用して、このメソッドを呼び出す TreeNodeStyle オブジェクトに、指定した Style オブジェクトのスタイル プロパティをコピーします。
![]() |
---|
現在の TreeNodeStyle オブジェクトのすべてのプロパティは、指定した Style オブジェクトの対応するプロパティで置き換えられます。 |

CopyFrom メソッドを使用して、指定した Style オブジェクトのスタイル プロパティを、このメソッドを呼び出す TreeNodeStyle オブジェクトにコピーする方法を次のコード例に示します。すべてのスタイル プロパティが置き換えられることに注意してください。
<%@ Page Language="VB" %> <script runat="server"> Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs) ' Copy the leaf node styles from the TreeNodeOne TreeView into the ' TreeViewResults TreeView. TreeViewResults.LeafNodeStyle.CopyFrom(TreeViewOne.LeafNodeStyle) End Sub </script> <html> <body> <form runat="server"> <h3>TreeNodeStyle CopyFrom Example</h3> <table cellspacing="30"> <tr> <th> TreeView One </th> <th> TreeView Result </th> </tr> <tr valign="top"> <td> <!-- Set the styles for the leaf nodes declaratively. --> <asp:TreeView id="TreeViewOne" InitialExpandDepth="4" LeafNodeStyle-BackColor="Yellow" LeafNodeStyle-Font-Bold="true" LeafNodeStyle-ForeColor="Black" runat="server"> <Nodes> <asp:TreeNode Text="Table of Contents" SelectAction="None"> <asp:TreeNode Text="Chapter One"> <asp:TreeNode Text="Section 1.0"> <asp:TreeNode Text="Topic 1.0.1"/> <asp:TreeNode Text="Topic 1.0.2"/> <asp:TreeNode Text="Topic 1.0.3"/> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView> </td> <td> <!-- Set the styles for the leaf nodes declaratively. --> <asp:TreeView id="TreeViewResults" InitialExpandDepth="4" runat="server"> <Nodes> <asp:TreeNode Text="Table of Contents" SelectAction="None"> <asp:TreeNode Text="Chapter One"> <asp:TreeNode Text="Section 1.0"> <asp:TreeNode Text="Topic 1.0.1"/> <asp:TreeNode Text="Topic 1.0.2"/> <asp:TreeNode Text="Topic 1.0.3"/> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView> </td> </tr> <tr> <td> <asp:Button ID="CopyNodeStyleButton" Text="Copy LeafNodeStyle" OnClick="Button_Click" runat="server"/> </td> <td> </td> </tr> </table> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> void Button_Click(Object sender, EventArgs e) { // Copy the leaf node styles from the TreeNodeOne TreeView into the // TreeViewResults TreeView. TreeViewResults.LeafNodeStyle.CopyFrom(TreeViewOne.LeafNodeStyle); } </script> <html> <body> <form runat="server"> <h3>TreeNodeStyle CopyFrom Example</h3> <table cellspacing="30"> <tr> <th> TreeView One </th> <th> TreeView Result </th> </tr> <tr valign="top"> <td> <!-- Set the styles for the leaf nodes declaratively. --> <asp:TreeView id="TreeViewOne" InitialExpandDepth="4" LeafNodeStyle-BackColor="Yellow" LeafNodeStyle-Font-Bold="true" LeafNodeStyle-ForeColor="Black" runat="server"> <Nodes> <asp:TreeNode Text="Table of Contents" SelectAction="None"> <asp:TreeNode Text="Chapter One"> <asp:TreeNode Text="Section 1.0"> <asp:TreeNode Text="Topic 1.0.1"/> <asp:TreeNode Text="Topic 1.0.2"/> <asp:TreeNode Text="Topic 1.0.3"/> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView> </td> <td> <!-- Set the styles for the leaf nodes declaratively. --> <asp:TreeView id="TreeViewResults" InitialExpandDepth="4" runat="server"> <Nodes> <asp:TreeNode Text="Table of Contents" SelectAction="None"> <asp:TreeNode Text="Chapter One"> <asp:TreeNode Text="Section 1.0"> <asp:TreeNode Text="Topic 1.0.1"/> <asp:TreeNode Text="Topic 1.0.2"/> <asp:TreeNode Text="Topic 1.0.3"/> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView> </td> </tr> <tr> <td> <asp:Button ID="CopyNodeStyleButton" Text="Copy LeafNodeStyle" OnClick="Button_Click" runat="server"/> </td> <td> </td> </tr> </table> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTreeNodeStyle.CopyFrom メソッドを検索する場合は、下記のリンクをクリックしてください。

- TreeNodeStyle.CopyFrom メソッドのページへのリンク