当前位置: 首页>>代码示例>>C#>>正文


C# Table.MergeStyle方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.Table.MergeStyle方法的典型用法代码示例。如果您正苦于以下问题:C# Table.MergeStyle方法的具体用法?C# Table.MergeStyle怎么用?C# Table.MergeStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.Table的用法示例。


在下文中一共展示了Table.MergeStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildMenu

		/// <summary>
		/// BuildMenu builds the top-level menu.  It is called from the OnDataBinding method as well
		/// as from <see cref="CreateChildControls"/>.  It has code to check if the top-level menu should be
		/// laid out horizontally or vertically.
		/// </summary>
		protected virtual void BuildMenu()
		{
			string image = string.Empty;
			string mouseoverimage = string.Empty;
			string mousedownimage = string.Empty;
			string mouseupimage = string.Empty;			

			// iterate through the Items
			Table menu = new Table();
			menu.Attributes.Add("id", this.ClientID);
			menu.MergeStyle(this.ControlStyle);

			menu.CellPadding = ItemPadding;
			menu.CellSpacing = ItemSpacing;
			menu.GridLines = GridLines;

			// Add the Menu control's STYLE properties to the TABLE
			IEnumerator key = this.Style.Keys.GetEnumerator();
			while(key.MoveNext())
			{
				string k = key.Current.ToString();
				menu.Style.Add(k, this.Style[k]);
			}

			menu.Style.Remove("Z-INDEX");		// remove z-index added automatically by grid positioning

			// set the Z-INDEX
			menu.Style.Add("z-index", this.zIndex.ToString());
			curzindex = this.zIndex + 2;

			BuildOpacity(menu);
			
			TableRow tr = null;
			if (Layout == MenuLayout.Horizontal)
				tr = new TableRow();

			// Iterate through the top-level menu's menuitems, and add a <td> tag for each menuItem
			for (int i = 0; i < this.items.Count; i++)
			{
				MenuItem mi = this.items[i];

				//add by johnny start
				if (this.MainSpacingWidth != 0)
				{
					if (i % 2 == 1)
					{
						TableCell tdblank = new TableCell();
						tdblank.Width=this.MainSpacingWidth;
						tdblank.BackColor = Color.Empty;
						tr.Cells.Add(tdblank);
					}
				}
				//end

				// only render this MenuItem if it is visible and the user has permissions
				if (mi.Visible && UserHasPermission(mi)) 
				{ 
					if (Layout == MenuLayout.Vertical)
						tr = new TableRow();

					TableCell td = new TableCell();
					td.ApplyStyle(this.unselectedMenuItemStyle);
					// The style is overwritten by anything specifically set in menuitem
					if (mi.BackColor != Color.Empty) 
						td.BackColor = mi.BackColor;
					if (mi.Font != null)
						td.Font.CopyFrom(mi.Font);
					if (mi.ForeColor != Color.Empty)
						td.ForeColor = mi.ForeColor;
					if (mi.Height != Unit.Empty)
						td.Height = mi.Height;
					if (mi.Width != Unit.Empty)
						td.Width = mi.Width;
					if (mi.CssClass != String.Empty)
						td.CssClass = mi.CssClass;
					else if	(this.DefaultCssClass != String.Empty)
						td.CssClass = this.DefaultCssClass;
					if (mi.BorderColor != Color.Empty)
						td.BorderColor = mi.BorderColor;
					if (mi.BorderStyle != BorderStyle.NotSet)
						td.BorderStyle = mi.BorderStyle;
					if (mi.BorderWidth != Unit.Empty)
						td.BorderWidth = mi.BorderWidth;
					if (mi.HorizontalAlign != System.Web.UI.WebControls.HorizontalAlign.NotSet)
						td.HorizontalAlign = mi.HorizontalAlign;
					if (mi.VerticalAlign != System.Web.UI.WebControls.VerticalAlign.NotSet)
						td.VerticalAlign = mi.VerticalAlign;
					BuildOpacity(td);
					if (mi.Text != string.Empty)
						td.Text = mi.Text;  // Text
					else if (mi.Image != string.Empty) // Show Image
					{
						System.Web.UI.WebControls.Image cellimage = new System.Web.UI.WebControls.Image();

						cellimage.ImageUrl = mi.Image;
//.........这里部分代码省略.........
开发者ID:jojozhuang,项目名称:Projects,代码行数:101,代码来源:Menu.cs

示例2: RenderBeginTag

 public override void RenderBeginTag(HtmlTextWriter writer)
 {
     Table tbl = new Table();
     tbl.ID = "tbl_" + this.ID;
     tbl.MergeStyle(this.ControlStyle);
     tbl.RenderBeginTag(writer);
 }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:7,代码来源:GridView.cs


注:本文中的System.Web.UI.WebControls.Table.MergeStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。