本文整理汇总了C#中System.Web.UI.WebControls.Style.CopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Style.CopyFrom方法的具体用法?C# Style.CopyFrom怎么用?C# Style.CopyFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Style
的用法示例。
在下文中一共展示了Style.CopyFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEditorPartChromeStyle
protected virtual Style CreateEditorPartChromeStyle(EditorPart editorPart, PartChromeType chromeType)
{
if (editorPart == null)
{
throw new ArgumentNullException("editorPart");
}
if ((chromeType < PartChromeType.Default) || (chromeType > PartChromeType.BorderOnly))
{
throw new ArgumentOutOfRangeException("chromeType");
}
if ((chromeType == PartChromeType.BorderOnly) || (chromeType == PartChromeType.TitleAndBorder))
{
return this.Zone.PartChromeStyle;
}
if (this._chromeStyleNoBorder == null)
{
Style style = new Style();
style.CopyFrom(this.Zone.PartChromeStyle);
if (style.BorderStyle != BorderStyle.None)
{
style.BorderStyle = BorderStyle.None;
}
if (style.BorderWidth != Unit.Empty)
{
style.BorderWidth = Unit.Empty;
}
if (style.BorderColor != Color.Empty)
{
style.BorderColor = Color.Empty;
}
this._chromeStyleNoBorder = style;
}
return this._chromeStyleNoBorder;
}
示例2: CopyStyle
private void CopyStyle(Style toStyle, Style fromStyle)
{
if ((fromStyle != null) && fromStyle.IsSet(0x2000))
{
toStyle.Font.Underline = fromStyle.Font.Underline;
}
toStyle.CopyFrom(fromStyle);
}
示例3: CreateCatalogPartChromeStyle
protected virtual Style CreateCatalogPartChromeStyle(CatalogPart catalogPart, PartChromeType chromeType) {
if (catalogPart == null) {
throw new ArgumentNullException("catalogPart");
}
if ((chromeType < PartChromeType.Default) || (chromeType > PartChromeType.BorderOnly)) {
throw new ArgumentOutOfRangeException("chromeType");
}
if (chromeType == PartChromeType.BorderOnly || chromeType == PartChromeType.TitleAndBorder) {
if (_chromeStyleWithBorder == null) {
Style style = new Style();
style.CopyFrom(Zone.PartChromeStyle);
if (style.BorderStyle == BorderStyle.NotSet) {
style.BorderStyle = BorderStyle.Solid;
}
if (style.BorderWidth == Unit.Empty) {
style.BorderWidth = Unit.Pixel(1);
}
if (style.BorderColor == Color.Empty) {
style.BorderColor = Color.Black;
}
_chromeStyleWithBorder = style;
}
return _chromeStyleWithBorder;
}
else {
if (_chromeStyleNoBorder == null) {
Style style = new Style();
style.CopyFrom(Zone.PartChromeStyle);
if (style.BorderStyle != BorderStyle.NotSet) {
style.BorderStyle = BorderStyle.NotSet;
}
if (style.BorderWidth != Unit.Empty) {
style.BorderWidth = Unit.Empty;
}
if (style.BorderColor != Color.Empty) {
style.BorderColor = Color.Empty;
}
_chromeStyleNoBorder = style;
}
return _chromeStyleNoBorder;
}
}
示例4: CreateChromeStyleNoBorder
private Style CreateChromeStyleNoBorder(Style partChromeStyle)
{
Style style = new Style();
style.CopyFrom(this.Zone.PartChromeStyle);
if (style.BorderStyle != BorderStyle.NotSet)
{
style.BorderStyle = BorderStyle.NotSet;
}
if (style.BorderWidth != Unit.Empty)
{
style.BorderWidth = Unit.Empty;
}
if (style.BorderColor != Color.Empty)
{
style.BorderColor = Color.Empty;
}
return style;
}
示例5: CreateChromeStyleWithBorder
private Style CreateChromeStyleWithBorder(Style partChromeStyle)
{
Style style = new Style();
style.CopyFrom(partChromeStyle);
if (style.BorderStyle == BorderStyle.NotSet)
{
style.BorderStyle = BorderStyle.Solid;
}
if (style.BorderWidth == Unit.Empty)
{
style.BorderWidth = Unit.Pixel(1);
}
if (style.BorderColor == Color.Empty)
{
style.BorderColor = Color.Black;
}
return style;
}
示例6: CreateEditorPartChromeStyle
protected virtual Style CreateEditorPartChromeStyle(EditorPart editorPart, PartChromeType chromeType) {
if (editorPart == null) {
throw new ArgumentNullException("editorPart");
}
if ((chromeType < PartChromeType.Default) || (chromeType > PartChromeType.BorderOnly)) {
throw new ArgumentOutOfRangeException("chromeType");
}
// PERF: Cache these, since they are needed for every EditorPart in the zone.
if (chromeType == PartChromeType.BorderOnly || chromeType == PartChromeType.TitleAndBorder) {
// We don't want to set any border styles for ChromeType of TitleAndBorder or BorderOnly,
// since the FrameSet has a default border, and it will use XP themes as long as no border styles
// are set.
// PERF: Just return the Zone.PartChromeStyle directly without making a copy
return Zone.PartChromeStyle;
}
else {
if (_chromeStyleNoBorder == null) {
Style style = new Style();
// create copy of PartChromeStyle so we can modify it
style.CopyFrom(Zone.PartChromeStyle);
if (style.BorderStyle != BorderStyle.None) {
style.BorderStyle = BorderStyle.None;
}
if (style.BorderWidth != Unit.Empty) {
style.BorderWidth = Unit.Empty;
}
if (style.BorderColor != Color.Empty) {
style.BorderColor = Color.Empty;
}
_chromeStyleNoBorder = style;
}
return _chromeStyleNoBorder;
}
}
示例7: GetTemplateStyle
private Style GetTemplateStyle(int templateIndex, TemplateField templateField)
{
Style style = new Style();
style.CopyFrom(((GridView) base.ViewControl).ControlStyle);
switch (templateIndex)
{
case 0:
style.CopyFrom(((GridView) base.ViewControl).EmptyDataRowStyle);
return style;
case 1:
style.CopyFrom(((GridView) base.ViewControl).PagerStyle);
return style;
case 0x3e8:
style.CopyFrom(((GridView) base.ViewControl).RowStyle);
style.CopyFrom(templateField.ItemStyle);
return style;
case 0x3e9:
style.CopyFrom(((GridView) base.ViewControl).RowStyle);
style.CopyFrom(((GridView) base.ViewControl).AlternatingRowStyle);
style.CopyFrom(templateField.ItemStyle);
return style;
case 0x3ea:
style.CopyFrom(((GridView) base.ViewControl).RowStyle);
style.CopyFrom(((GridView) base.ViewControl).EditRowStyle);
style.CopyFrom(templateField.ItemStyle);
return style;
case 0x3eb:
style.CopyFrom(((GridView) base.ViewControl).HeaderStyle);
style.CopyFrom(templateField.HeaderStyle);
return style;
case 0x3ec:
style.CopyFrom(((GridView) base.ViewControl).FooterStyle);
style.CopyFrom(templateField.FooterStyle);
return style;
}
return style;
}
示例8: Style_Copy
public void Style_Copy ()
{
Style s = new Style ();
Style copy = new Style ();
SetSomeValues(s);
copy.CopyFrom (s);
Assert.AreEqual (Color.Red, s.BackColor, "Copy1");
}
示例9: LoadCurrentTemplate
private void LoadCurrentTemplate()
{
int selectedIndex = this._templateCombo.SelectedIndex;
int index = this._templateGroupCombo.SelectedIndex;
if ((index != -1) && (selectedIndex != -1))
{
TemplateEditingFrame editingFrame = this._frames[index];
string templateName = editingFrame.TemplateNames[selectedIndex];
this._activeTemplateName = templateName;
string content = (string) editingFrame.ChangeTable[templateName];
if (content == null)
{
bool allowEditing = false;
content = this._designer.GetTemplateContent(editingFrame, templateName, out allowEditing);
}
IDocumentDesignerHost service = (IDocumentDesignerHost) base.ServiceProvider.GetService(typeof(IDocumentDesignerHost));
ILayeredDesignerHost host2 = (ILayeredDesignerHost) base.ServiceProvider.GetService(typeof(ILayeredDesignerHost));
string str3 = this.GenerateLayerKey(this._templateGroupCombo.Text, this._templateCombo.Text);
host2.ActiveLayer = (IDesignLayer) this.Layers[str3];
service.BeginLoad();
try
{
Style style = new Style();
style.CopyFrom(editingFrame.ControlStyle);
if (editingFrame.TemplateStyles != null)
{
style.CopyFrom(editingFrame.TemplateStyles[selectedIndex]);
}
string str4 = string.Format("<style>body {{ {0} }}</style>", this.StyleToCss(style));
string url = this._parentEditor.Url;
if (content != null)
{
this._designView.Editor.LoadHtml(content, url, str4);
}
else
{
this._designView.Editor.LoadHtml(string.Empty, url, str4);
}
}
finally
{
service.EndLoad();
}
}
}
示例10: RenderMenuItem
void RenderMenuItem (HtmlTextWriter writer, MenuItem item, bool notLast, bool isFirst) {
bool displayChildren = DisplayChildren (item);
bool dynamicChildren = displayChildren && (item.Depth + 1 >= StaticDisplayLevels);
bool isDynamicItem = IsDynamicItem (item);
bool vertical = (Orientation == Orientation.Vertical) || isDynamicItem;
Unit itemSpacing = GetItemSpacing (item, isDynamicItem);
if (itemSpacing != Unit.Empty && (item.Depth > 0 || !isFirst))
RenderMenuItemSpacing (writer, itemSpacing, vertical);
if(!String.IsNullOrEmpty(item.ToolTip))
writer.AddAttribute (HtmlTextWriterAttribute.Title, item.ToolTip);
if (vertical)
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
string parentId = isDynamicItem ? "'" + item.Parent.Path + "'" : "null";
if (dynamicChildren) {
writer.AddAttribute ("onmouseover",
"javascript:Menu_OverItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
writer.AddAttribute ("onmouseout",
"javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "')");
} else if (isDynamicItem) {
writer.AddAttribute ("onmouseover",
"javascript:Menu_OverDynamicLeafItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
writer.AddAttribute ("onmouseout",
"javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "'," + parentId + ")");
} else {
writer.AddAttribute ("onmouseover",
"javascript:Menu_OverStaticLeafItem ('" + ClientID + "','" + item.Path + "')");
writer.AddAttribute ("onmouseout",
"javascript:Menu_OutItem ('" + ClientID + "','" + item.Path + "')");
}
writer.RenderBeginTag (HtmlTextWriterTag.Td);
// Top separator image
if (isDynamicItem && DynamicTopSeparatorImageUrl != "") {
writer.AddAttribute ("src", ResolveClientUrl (DynamicTopSeparatorImageUrl));
writer.RenderBeginTag (HtmlTextWriterTag.Img);
writer.RenderEndTag (); // IMG
}
else if (!isDynamicItem && StaticTopSeparatorImageUrl != "") {
writer.AddAttribute ("src", ResolveClientUrl (StaticTopSeparatorImageUrl));
writer.RenderBeginTag (HtmlTextWriterTag.Img);
writer.RenderEndTag (); // IMG
}
// Menu item box
MenuItemStyle style = new MenuItemStyle ();
if (Page.Header != null) {
// styles are registered
if (!isDynamicItem && staticMenuItemStyle != null) {
AddCssClass (style, staticMenuItemStyle.CssClass);
AddCssClass (style, staticMenuItemStyle.RegisteredCssClass);
}
if (isDynamicItem && dynamicMenuItemStyle != null) {
AddCssClass (style, dynamicMenuItemStyle.CssClass);
AddCssClass (style, dynamicMenuItemStyle.RegisteredCssClass);
}
if (levelMenuItemStyles != null && levelMenuItemStyles.Count > item.Depth) {
AddCssClass (style, levelMenuItemStyles [item.Depth].CssClass);
AddCssClass (style, levelMenuItemStyles [item.Depth].RegisteredCssClass);
}
if (item == SelectedItem) {
if (!isDynamicItem && staticSelectedStyle != null) {
AddCssClass (style, staticSelectedStyle.CssClass);
AddCssClass (style, staticSelectedStyle.RegisteredCssClass);
}
if (isDynamicItem && dynamicSelectedStyle != null) {
AddCssClass (style, dynamicSelectedStyle.CssClass);
AddCssClass (style, dynamicSelectedStyle.RegisteredCssClass);
}
if (levelSelectedStyles != null && levelSelectedStyles.Count > item.Depth) {
AddCssClass (style, levelSelectedStyles [item.Depth].CssClass);
AddCssClass (style, levelSelectedStyles [item.Depth].RegisteredCssClass);
}
}
}
else {
// styles are not registered
if (!isDynamicItem && staticMenuItemStyle != null) {
style.CopyFrom (staticMenuItemStyle);
}
if (isDynamicItem && dynamicMenuItemStyle != null) {
style.CopyFrom (dynamicMenuItemStyle);
}
if (levelMenuItemStyles != null && levelMenuItemStyles.Count > item.Depth) {
style.CopyFrom (levelMenuItemStyles [item.Depth]);
}
if (item == SelectedItem) {
if (!isDynamicItem && staticSelectedStyle != null) {
style.CopyFrom (staticSelectedStyle);
}
if (isDynamicItem && dynamicSelectedStyle != null) {
style.CopyFrom (dynamicSelectedStyle);
}
if (levelSelectedStyles != null && levelSelectedStyles.Count > item.Depth) {
//.........这里部分代码省略.........
示例11: RenderMenuItem
protected override void RenderMenuItem (HtmlTextWriter writer, MenuItem item, bool vertical, bool notLast, bool isFirst, OwnerContext oc)
{
Menu owner = Owner;
string clientID = oc.ClientID;
bool displayChildren = owner.DisplayChildren (item);
bool dynamicChildren = displayChildren && (item.Depth + 1 >= oc.StaticDisplayLevels);
bool isDynamicItem = IsDynamicItem (owner, item);
bool isVertical = oc.IsVertical || isDynamicItem;
Unit itemSpacing = owner.GetItemSpacing (item, isDynamicItem);
if (itemSpacing != Unit.Empty && (item.Depth > 0 || !isFirst))
RenderMenuItemSpacing (writer, itemSpacing, isVertical);
if(!String.IsNullOrEmpty(item.ToolTip))
writer.AddAttribute (HtmlTextWriterAttribute.Title, item.ToolTip);
if (isVertical)
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
string parentId = isDynamicItem ? "'" + item.Parent.Path + "'" : "null";
if (dynamicChildren) {
writer.AddAttribute ("onmouseover",
"javascript:Menu_OverItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
writer.AddAttribute ("onmouseout",
"javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "')");
} else if (isDynamicItem) {
writer.AddAttribute ("onmouseover",
"javascript:Menu_OverDynamicLeafItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
writer.AddAttribute ("onmouseout",
"javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "'," + parentId + ")");
} else {
writer.AddAttribute ("onmouseover",
"javascript:Menu_OverStaticLeafItem ('" + clientID + "','" + item.Path + "')");
writer.AddAttribute ("onmouseout",
"javascript:Menu_OutItem ('" + clientID + "','" + item.Path + "')");
}
writer.RenderBeginTag (HtmlTextWriterTag.Td);
// Top separator image
if (isDynamicItem)
RenderSeparatorImage (owner, writer, oc.DynamicTopSeparatorImageUrl, false);
else
RenderSeparatorImage (owner, writer, oc.StaticTopSeparatorImageUrl, false);
// Menu item box
MenuItemStyle style = new MenuItemStyle ();
if (oc.Header != null) {
// styles are registered
if (!isDynamicItem && oc.StaticMenuItemStyle != null) {
AddCssClass (style, oc.StaticMenuItemStyle.CssClass);
AddCssClass (style, oc.StaticMenuItemStyle.RegisteredCssClass);
}
if (isDynamicItem && oc.DynamicMenuItemStyle != null) {
AddCssClass (style, oc.DynamicMenuItemStyle.CssClass);
AddCssClass (style, oc.DynamicMenuItemStyle.RegisteredCssClass);
}
if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth) {
AddCssClass (style, oc.LevelMenuItemStyles [item.Depth].CssClass);
AddCssClass (style, oc.LevelMenuItemStyles [item.Depth].RegisteredCssClass);
}
if (item == oc.SelectedItem) {
if (!isDynamicItem && oc.StaticSelectedStyle != null) {
AddCssClass (style, oc.StaticSelectedStyle.CssClass);
AddCssClass (style, oc.StaticSelectedStyle.RegisteredCssClass);
}
if (isDynamicItem && oc.DynamicSelectedStyle != null) {
AddCssClass (style, oc.DynamicSelectedStyle.CssClass);
AddCssClass (style, oc.DynamicSelectedStyle.RegisteredCssClass);
}
if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth) {
AddCssClass (style, oc.LevelSelectedStyles [item.Depth].CssClass);
AddCssClass (style, oc.LevelSelectedStyles [item.Depth].RegisteredCssClass);
}
}
} else {
// styles are not registered
if (!isDynamicItem && oc.StaticMenuItemStyle != null)
style.CopyFrom (oc.StaticMenuItemStyle);
if (isDynamicItem && oc.DynamicMenuItemStyle != null)
style.CopyFrom (oc.DynamicMenuItemStyle);
if (oc.LevelMenuItemStyles != null && oc.LevelMenuItemStyles.Count > item.Depth)
style.CopyFrom (oc.LevelMenuItemStyles [item.Depth]);
if (item == oc.SelectedItem) {
if (!isDynamicItem && oc.StaticSelectedStyle != null)
style.CopyFrom (oc.StaticSelectedStyle);
if (isDynamicItem && oc.DynamicSelectedStyle != null)
style.CopyFrom (oc.DynamicSelectedStyle);
if (oc.LevelSelectedStyles != null && oc.LevelSelectedStyles.Count > item.Depth)
style.CopyFrom (oc.LevelSelectedStyles [item.Depth]);
}
}
style.AddAttributesToRender (writer);
writer.AddAttribute ("id", GetItemClientId (clientID, item, "i"));
writer.AddAttribute ("cellpadding", "0", false);
writer.AddAttribute ("cellspacing", "0", false);
writer.AddAttribute ("border", "0", false);
//.........这里部分代码省略.........
示例12: PushPanelStyle
/// <devdoc>
/// <para>Push style on stack, but do not open it. Used for pending styles, as in the panel and page adapters.</para>
/// </devdoc>
internal void PushPanelStyle(Style style) {
Style stackStyle = new Style();
if (_panelStyleStack.Count == 0) {
stackStyle.CopyFrom(style);
_panelStyleStack.Push(stackStyle);
return;
}
stackStyle.CopyFrom((Style)_panelStyleStack.Peek());
stackStyle.MergeWith(style);
_panelStyleStack.Push(stackStyle);
}
示例13: CreateStyleBlock
private StyleBlock CreateStyleBlock() {
StyleBlock styleBlock = new StyleBlock();
Style rootMenuItemStyle = Menu.RootMenuItemStyle;
// drop the font and forecolor from the control style, those are applied
// to the anchors directly with rootMenuItemStyle.
Style menuStyle = null;
if (!Menu.ControlStyle.IsEmpty) {
menuStyle = new Style();
menuStyle.CopyFrom(Menu.ControlStyle);
// Relative sizes should not be multiplied (VSWhidbey 457610)
menuStyle.Font.Reset();
menuStyle.ForeColor = Color.Empty;
}
// Menu surrounding DIV style -- without ForeColor or Font,
// those are applied directly to the '#Menu a' selector.
styleBlock.AddStyleDefinition("#{0}", Menu.ClientID)
.AddStyles(menuStyle);
// Image styles
styleBlock.AddStyleDefinition("#{0} img.icon", Menu.ClientID)
.AddStyle(HtmlTextWriterStyle.BorderStyle, "none")
.AddStyle(HtmlTextWriterStyle.VerticalAlign, "middle");
styleBlock.AddStyleDefinition("#{0} img.separator", Menu.ClientID)
.AddStyle(HtmlTextWriterStyle.BorderStyle, "none")
.AddStyle(HtmlTextWriterStyle.Display, "block");
if (Menu.Orientation == Orientation.Horizontal) {
styleBlock.AddStyleDefinition("#{0} img.horizontal-separator", Menu.ClientID)
.AddStyle(HtmlTextWriterStyle.BorderStyle, "none")
.AddStyle(HtmlTextWriterStyle.VerticalAlign, "middle");
}
// Menu styles
styleBlock.AddStyleDefinition("#{0} ul", Menu.ClientID)
.AddStyle("list-style", "none")
.AddStyle(HtmlTextWriterStyle.Margin, "0")
.AddStyle(HtmlTextWriterStyle.Padding, "0")
.AddStyle(HtmlTextWriterStyle.Width, "auto");
styleBlock.AddStyleDefinition("#{0} ul.static", Menu.ClientID)
.AddStyles(Menu._staticMenuStyle);
var ulDynamic = styleBlock.AddStyleDefinition("#{0} ul.dynamic", Menu.ClientID)
.AddStyles(Menu._dynamicMenuStyle)
.AddStyle(HtmlTextWriterStyle.ZIndex, "1");
if (Menu.DynamicHorizontalOffset != 0) {
ulDynamic.AddStyle(HtmlTextWriterStyle.MarginLeft, Menu.DynamicHorizontalOffset.ToString(CultureInfo.InvariantCulture) + "px");
}
if (Menu.DynamicVerticalOffset != 0) {
ulDynamic.AddStyle(HtmlTextWriterStyle.MarginTop, Menu.DynamicVerticalOffset.ToString(CultureInfo.InvariantCulture) + "px");
}
if (Menu._levelStyles != null) {
int index = 1;
foreach (SubMenuStyle style in Menu._levelStyles) {
styleBlock.AddStyleDefinition("#{0} ul.level{1}", Menu.ClientID, index++)
.AddStyles(style);
}
}
// Menu item styles
// MenuItems have a 14px default right padding.
// This is necessary to prevent the default (and the typical) popout image from going under
// the menu item text when it is one of the longer items in the parent menu.
// It is 'px' based since its based on the image size not font size.
styleBlock.AddStyleDefinition("#{0} a", Menu.ClientID)
.AddStyle(HtmlTextWriterStyle.WhiteSpace, "nowrap")
.AddStyle(HtmlTextWriterStyle.Display, "block")
.AddStyles(rootMenuItemStyle);
var menuItemStatic = styleBlock.AddStyleDefinition("#{0} a.static", Menu.ClientID);
if ((Menu.Orientation == Orientation.Horizontal) &&
((Menu._staticItemStyle == null) || (Menu._staticItemStyle.HorizontalPadding.IsEmpty))) {
menuItemStatic.AddStyle(HtmlTextWriterStyle.PaddingLeft, "0.15em")
.AddStyle(HtmlTextWriterStyle.PaddingRight, "0.15em");
}
menuItemStatic.AddStyles(Menu._staticItemStyle);
if (Menu._staticItemStyle != null) {
menuItemStatic.AddStyles(Menu._staticItemStyle.HyperLinkStyle);
}
if (!String.IsNullOrEmpty(StaticPopOutUrl)) {
styleBlock.AddStyleDefinition("#{0} a.popout", Menu.ClientID)
.AddStyle("background-image", "url(\"" + Menu.ResolveClientUrl(StaticPopOutUrl).Replace("\"", "\\\"") + "\")")
.AddStyle("background-repeat", "no-repeat")
.AddStyle("background-position", "right center")
.AddStyle(HtmlTextWriterStyle.PaddingRight, "14px");
}
//.........这里部分代码省略.........
示例14: CreateTitleStyleWithoutFontOrAlign
private Style CreateTitleStyleWithoutFontOrAlign(Style partTitleStyle) {
// Need to remove font info from TitleStyle. We only want the font
// info to apply to the title text, not the whole title bar table.
// (NDPWhidbey 27755)
// Use plain style so we don't copy alignment or wrap from TableItemStyle
Style style = new Style();
style.CopyFrom(partTitleStyle);
style.Font.Reset();
if (style.ForeColor != Color.Empty) {
style.ForeColor = Color.Empty;
}
return style;
}
示例15: AddNodeLinkStyle
void AddNodeLinkStyle (HtmlTextWriter writer, TreeNode node, int level, bool nodeIsSelected)
{
Style style = new Style ();
#if NET_4_0
bool addBorderStyle = false;
#endif
if (Page.Header != null) {
// styles are registered
style.AddCssClass (ControlLinkStyle.RegisteredCssClass);
if (nodeStyle != null) {
style.AddCssClass (nodeLinkStyle.CssClass);
style.AddCssClass (nodeLinkStyle.RegisteredCssClass);
}
if (levelLinkStyles != null && levelLinkStyles.Count > level) {
style.AddCssClass (levelLinkStyles [level].CssClass);
style.AddCssClass (levelLinkStyles [level].RegisteredCssClass);
#if NET_4_0
addBorderStyle = true;
#endif
}
if (node.IsLeafNode) {
if (leafNodeStyle != null) {
style.AddCssClass (leafNodeLinkStyle.CssClass);
style.AddCssClass (leafNodeLinkStyle.RegisteredCssClass);
}
} else if (node.IsRootNode) {
if (rootNodeStyle != null) {
style.AddCssClass (rootNodeLinkStyle.CssClass);
style.AddCssClass (rootNodeLinkStyle.RegisteredCssClass);
}
} else if (node.IsParentNode) {
if (parentNodeStyle != null) {
style.AddCssClass (parentNodeLinkStyle.CssClass);
style.AddCssClass (parentNodeLinkStyle.RegisteredCssClass);
}
}
if (nodeIsSelected) {
style.AddCssClass (selectedNodeLinkStyle.CssClass);
style.AddCssClass (selectedNodeLinkStyle.RegisteredCssClass);
}
} else {
// styles are not registered
style.CopyFrom (ControlLinkStyle);
if (nodeStyle != null)
style.CopyFrom (nodeLinkStyle);
if (levelLinkStyles != null && levelLinkStyles.Count > level) {
style.CopyFrom (levelLinkStyles [level]);
#if NET_4_0
addBorderStyle = true;
#endif
}
if (node.IsLeafNode) {
if (node.IsLeafNode && leafNodeStyle != null)
style.CopyFrom (leafNodeLinkStyle);
} else if (node.IsRootNode) {
if (node.IsRootNode && rootNodeStyle != null)
style.CopyFrom (rootNodeLinkStyle);
} else if (node.IsParentNode) {
if (node.IsParentNode && parentNodeStyle != null)
style.CopyFrom (parentNodeLinkStyle);
}
if (nodeIsSelected)
style.CopyFrom (selectedNodeLinkStyle);
style.AlwaysRenderTextDecoration = true;
}
#if NET_4_0
if (addBorderStyle) {
// This appears not to come from any style. Instead, it's added
// whenever a level style is present.
writer.AddStyleAttribute (HtmlTextWriterStyle.BorderStyle, "none");
writer.AddStyleAttribute (HtmlTextWriterStyle.FontSize, "1em");
}
#endif
style.AddAttributesToRender (writer);
}