This article was translated by machine. To view in the article in English, select the English check box. You can also display the English text in a popup window by moving the mouse pointer over the text.
الترجمة
الأصلي
This documentation is archived and is not being maintained.

TreeNodeStyle.MergeWith أسلوب

Visual Studio 2010

Combines the style properties of the specified Style object with the style properties of the current TreeNodeStyle object.

مساحة الاسم:  System.Web.UI.WebControls
التجميع:  System.Web (في System.Web.dll)

public override void MergeWith(
	Style s
)

المعلمات

s
النوع: System.Web.UI.WebControls.Style
The Style خاصية هو provided كـ a convenient way إلى determine the القيمة of the تحديث زر's الأمر وسيطة.

Use the MergeWith method to combine the style properties of the specified Style object with the style properties of the TreeNodeStyle object that this method is called from.

ملاحظةملاحظة

The MergeWith method joins the style properties by setting each property that is not set in the current TreeNodeStyle object with its corresponding value in the specified Style object. الذي يحتوي على قاموس من زوج الاسم/القيمه حقل المفتاح الأصلي للسجل إلى التحديث. If a property in the specified Style object is not set, the corresponding property in the current TreeNodeStyle object does not change.

The following code example demonstrates how to use the MergeWith method to combine the style properties of the specified Style object with those of the TreeNodeStyle object that calls this method. يوضح المثال التالي كيفية استخدام TreeNodeStyleالخاصية القيمة حقل المفتاح للوصول إلى سجل تحديث.



<%@ 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 MergeButton_Click(Object sender, EventArgs e)
  {

    // Combine the leaf node styles of the TreeNodeOne TreeView and the 
    // TreeViewResults TreeView.
    TreeViewResults.LeafNodeStyle.MergeWith(TreeViewOne.LeafNodeStyle);

  }

  void ResetButton_Click(Object sender, EventArgs e)
  {

    // Reset the LeafNodeStyle of the TreeViewResults TreeView.
    TreeViewResults.LeafNodeStyle.Reset();

  }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeNodeStyle MergeWith Example</title>
</head>
<body>  
    <form id="form1" runat="server">

      <h3>TreeNodeStyle MergeWith 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"
              ExpandDepth="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"
              ExpandDepth="4" 
              LeafNodeStyle-ForeColor="Green"  
              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="MergeNodeStyleButton" 
              Text="Merge LeafNodeStyle"
              OnClick="MergeButton_Click" 
              runat="server"/>

          </td>

          <td>

            <asp:Button ID="ResetButton" 
              Text="Reset LeafNodeStyle"
              OnClick="ResetButton_Click" 
              runat="server"/>

          </td>

        </tr>

      </table>

    </form>
  </body>
</html>



نظام التشغيل Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, الإصدار x64 من نظام التشغيل Windows XP Professional, Windows XP Starter Edition, Windows Server 2008, نظام التشغيل Windows Server 2003, نظام التشغيل Windows Server 2000 المزود بحزمة الخدمة SP4, نظام التشغيل Windows Millennium Edition, نظام التشغيل Windows 98

لا يدعم .NET Framework و .NET Compact Framework كافة الإصدارات الخاصة بكل نظام أساسي. للحصول على قائمة بالإصدارات المدعمة، راجع متطلبات النظام إطار عمل .NET.

.NET Framework

مدعوم في: 4, 3.5, 3.0, 2.0
إظهار: