本文整理汇总了C#中System.Web.UI.WebControls.Style.IsSet方法的典型用法代码示例。如果您正苦于以下问题:C# Style.IsSet方法的具体用法?C# Style.IsSet怎么用?C# Style.IsSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Style
的用法示例。
在下文中一共展示了Style.IsSet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyStyle
private void CopyStyle(Style toStyle, Style fromStyle)
{
if ((fromStyle != null) && fromStyle.IsSet(0x2000))
{
toStyle.Font.Underline = fromStyle.Font.Underline;
}
toStyle.CopyFrom(fromStyle);
}
示例2: CopyStyle
private void CopyStyle(Style toStyle, Style fromStyle) {
Debug.Assert(toStyle != null);
// Review: How to change the default value of Font.Underline?
if (fromStyle != null && fromStyle.IsSet(System.Web.UI.WebControls.Style.PROP_FONT_UNDERLINE))
toStyle.Font.Underline = fromStyle.Font.Underline;
toStyle.CopyFrom(fromStyle);
}
示例3: MergeWith
/// <devdoc>
/// Copies non-blank elements from the specified style,
/// but will not overwrite any existing style elements.
/// </devdoc>
public virtual void MergeWith(Style s) {
if (RegisteredCssClass.Length != 0) {
throw new InvalidOperationException(SR.GetString(SR.Style_RegisteredStylesAreReadOnly));
}
if (s == null || s.IsEmpty)
return;
if (IsEmpty) {
// merge into an empty style is equivalent to a copy, which
// is more efficient
CopyFrom(s);
return;
}
this.Font.MergeWith(s.Font);
if (s.IsSet(PROP_CSSCLASS) && !this.IsSet(PROP_CSSCLASS))
this.CssClass = s.CssClass;
// If the source Style is registered and this one isn't, copy
// the CSS class and any style props not included in the CSS class
// if they aren't set on this Style
if (s.RegisteredCssClass.Length == 0) {
if (s.IsSet(PROP_BACKCOLOR) && (!this.IsSet(PROP_BACKCOLOR) || (BackColor == Color.Empty)))
this.BackColor = s.BackColor;
if (s.IsSet(PROP_FORECOLOR) && (!this.IsSet(PROP_FORECOLOR) || (ForeColor == Color.Empty)))
this.ForeColor = s.ForeColor;
if (s.IsSet(PROP_BORDERCOLOR) && (!this.IsSet(PROP_BORDERCOLOR) || (BorderColor == Color.Empty)))
this.BorderColor = s.BorderColor;
if (s.IsSet(PROP_BORDERWIDTH) && (!this.IsSet(PROP_BORDERWIDTH) || (BorderWidth == Unit.Empty)))
this.BorderWidth = s.BorderWidth;
if (s.IsSet(PROP_BORDERSTYLE) && !this.IsSet(PROP_BORDERSTYLE))
this.BorderStyle = s.BorderStyle;
if (s.IsSet(PROP_HEIGHT) && (!this.IsSet(PROP_HEIGHT) || (Height == Unit.Empty)))
this.Height = s.Height;
if (s.IsSet(PROP_WIDTH) && (!this.IsSet(PROP_WIDTH) || (Width == Unit.Empty)))
this.Width = s.Width;
}
else {
if (IsSet(PROP_CSSCLASS)) {
CssClass += " " + s.RegisteredCssClass;
}
else {
CssClass = s.RegisteredCssClass;
}
}
}
示例4: CopyFrom
/// <devdoc>
/// <para>
/// Copies non-blank elements from the specified style,
/// overwriting existing style elements if necessary.
/// </para>
/// </devdoc>
public virtual void CopyFrom(Style s) {
if (RegisteredCssClass.Length != 0) {
throw new InvalidOperationException(SR.GetString(SR.Style_RegisteredStylesAreReadOnly));
}
if (s != null && !s.IsEmpty) {
this.Font.CopyFrom(s.Font);
if (s.IsSet(PROP_CSSCLASS))
this.CssClass = s.CssClass;
// if the source Style is registered and this one isn't,
// reset all the styles set by the source Style so it's
// css class can be used to set those values
if (s.RegisteredCssClass.Length != 0) {
if (IsSet(PROP_CSSCLASS)) {
CssClass += " " + s.RegisteredCssClass;
}
else {
CssClass = s.RegisteredCssClass;
}
if (s.IsSet(PROP_BACKCOLOR) && (s.BackColor != Color.Empty)) {
ViewState.Remove("BackColor");
ClearBit(PROP_BACKCOLOR);
}
if (s.IsSet(PROP_FORECOLOR) && (s.ForeColor != Color.Empty)) {
ViewState.Remove("ForeColor");
ClearBit(PROP_FORECOLOR);
}
if (s.IsSet(PROP_BORDERCOLOR) && (s.BorderColor != Color.Empty)) {
ViewState.Remove("BorderColor");
ClearBit(PROP_BORDERCOLOR);
}
if (s.IsSet(PROP_BORDERWIDTH) && (s.BorderWidth != Unit.Empty)) {
ViewState.Remove("BorderWidth");
ClearBit(PROP_BORDERWIDTH);
}
if (s.IsSet(PROP_BORDERSTYLE)) {
ViewState.Remove("BorderStyle");
ClearBit(PROP_BORDERSTYLE);
}
if (s.IsSet(PROP_HEIGHT) && (s.Height != Unit.Empty)) {
ViewState.Remove("Height");
ClearBit(PROP_HEIGHT);
}
if (s.IsSet(PROP_WIDTH) && (s.Width != Unit.Empty)) {
ViewState.Remove("Width");
ClearBit(PROP_WIDTH);
}
}
else {
if (s.IsSet(PROP_BACKCOLOR) && (s.BackColor != Color.Empty))
this.BackColor = s.BackColor;
if (s.IsSet(PROP_FORECOLOR) && (s.ForeColor != Color.Empty))
this.ForeColor = s.ForeColor;
if (s.IsSet(PROP_BORDERCOLOR) && (s.BorderColor != Color.Empty))
this.BorderColor = s.BorderColor;
if (s.IsSet(PROP_BORDERWIDTH) && (s.BorderWidth != Unit.Empty))
this.BorderWidth = s.BorderWidth;
if (s.IsSet(PROP_BORDERSTYLE))
this.BorderStyle = s.BorderStyle;
if (s.IsSet(PROP_HEIGHT) && (s.Height != Unit.Empty))
this.Height = s.Height;
if (s.IsSet(PROP_WIDTH) && (s.Width != Unit.Empty))
this.Width = s.Width;
}
}
}
示例5: CopyTextStylesFrom
internal virtual void CopyTextStylesFrom (Style source)
{
if (source.IsSet (FORECOLOR)&& (source.ForeColor != Color.Empty))
ForeColor = source.ForeColor;
}
示例6: CopyFrom
public virtual void CopyFrom (Style source)
{
if (source == null || source.IsEmpty)
return;
Font.CopyFrom (source.Font);
if (source.IsSet (HEIGHT)&& (source.Height != Unit.Empty))
Height = source.Height;
if (source.IsSet (WIDTH)&& (source.Width != Unit.Empty))
Width = source.Width;
if (source.IsSet (BORDERCOLOR)&& (source.BorderColor != Color.Empty))
BorderColor = source.BorderColor;
if (source.IsSet (BORDERWIDTH)&& (source.BorderWidth != Unit.Empty))
BorderWidth = source.BorderWidth;
if (source.IsSet (BORDERSTYLE))
BorderStyle = source.BorderStyle;
if (source.IsSet (BACKCOLOR)&& (source.BackColor != Color.Empty))
BackColor = source.BackColor;
if (source.IsSet (CSSCLASS))
CssClass = source.CssClass;
if (source.IsSet (FORECOLOR)&& (source.ForeColor != Color.Empty))
ForeColor = source.ForeColor;
}