本文整理汇总了C#中System.Web.UI.WebControls.Style.GetStyleAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# Style.GetStyleAttributes方法的具体用法?C# Style.GetStyleAttributes怎么用?C# Style.GetStyleAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Style
的用法示例。
在下文中一共展示了Style.GetStyleAttributes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public NamedCssStyleCollection Add (Style style)
{
if (style != null)
CopyFrom (style.GetStyleAttributes (null));
return this;
}
示例2: AddStyles
public StyleBlockStyles AddStyles(Style style)
{
if (style != null)
{
this.AddStyles(style.GetStyleAttributes(this._styleControl));
}
return this;
}
示例3: RegisterStyle
public NamedCssStyleCollection RegisterStyle (Style style, string name = null)
{
if (style == null)
throw new ArgumentNullException ("style");
if (name == null)
name = String.Empty;
NamedCssStyleCollection cssStyle = GetStyle (name);
cssStyle.CopyFrom (style.GetStyleAttributes (null));
return cssStyle;
}
示例4: WarningBlock
/// <summary>
/// Initializes a new instance of the <see cref="WarningBlock"/> class.
/// </summary>
public WarningBlock()
{
var style = new Style();
this.Style = style.GetStyleAttributes( this );
}
示例5: Style_GetStyleAttributes
public void Style_GetStyleAttributes () {
Style s;
CssStyleCollection css;
s = new Style ();
css = s.GetStyleAttributes (null);
Assert.AreEqual (0, css.Count, "GetStyleAttributes#1");
s.Font.Bold = true;
s.Font.Italic = true;
s.Font.Size = 10;
s.Font.Names = new string [] { "Arial", "Veranda" };
s.Font.Overline = true;
s.Font.Strikeout = true;
s.Font.Underline = true;
css = s.GetStyleAttributes (null);
Assert.AreEqual ("bold", css ["font-weight"], "GetStyleAttributes#2");
Assert.AreEqual ("italic", css ["font-style"], "GetStyleAttributes#3");
Assert.AreEqual ("10pt", css ["font-size"], "GetStyleAttributes#4");
Assert.AreEqual ("Arial,Veranda", css ["font-family"], "GetStyleAttributes#5");
Assert.AreEqual (true, css ["text-decoration"].Contains ("overline"), "GetStyleAttributes#6");
Assert.AreEqual (true, css ["text-decoration"].Contains ("line-through"), "GetStyleAttributes#7");
Assert.AreEqual (true, css ["text-decoration"].Contains ("underline"), "GetStyleAttributes#8");
s.Font.Names = null;
css = s.GetStyleAttributes (null);
Assert.AreEqual (null, css ["font-family"], "GetStyleAttributes#9");
s.Font.Name = "Arial, Veranda";
css = s.GetStyleAttributes (null);
Assert.AreEqual ("Arial, Veranda", css ["font-family"], "GetStyleAttributes#10");
s.Font.Name = "";
css = s.GetStyleAttributes (null);
Assert.AreEqual (null, css ["font-family"], "GetStyleAttributes#11");
s.Font.Bold = false;
s.Font.Italic = false;
s.Font.Size = FontUnit.Empty;
s.Font.Overline = false;
s.Font.Strikeout = false;
s.Font.Underline = false;
css = s.GetStyleAttributes (null);
Assert.AreEqual ("normal", css ["font-weight"], "GetStyleAttributes#12");
Assert.AreEqual ("normal", css ["font-style"], "GetStyleAttributes#13");
Assert.AreEqual (null, css ["font-size"], "GetStyleAttributes#14");
Assert.AreEqual ("none", css ["text-decoration"], "GetStyleAttributes#15");
s.Reset ();
css = s.GetStyleAttributes (null);
Assert.AreEqual (0, css.Count, "GetStyleAttributes#16");
s.Reset ();
s.Font.Underline = false;
css = s.GetStyleAttributes (null);
Assert.AreEqual ("none", css ["text-decoration"], "GetStyleAttributes#17");
s.Reset ();
s.BorderWidth = 1;
s.BorderStyle = BorderStyle.Dashed;
css = s.GetStyleAttributes (null);
Assert.AreEqual ("Dashed", css ["border-style"], "GetStyleAttributes#18");
Assert.AreEqual ("1px", css ["border-width"], "GetStyleAttributes#19");
s.BorderStyle = BorderStyle.NotSet;
css = s.GetStyleAttributes (null);
Assert.AreEqual ("solid", css ["border-style"], "GetStyleAttributes#20");
Assert.AreEqual ("1px", css ["border-width"], "GetStyleAttributes#21");
s.BorderWidth = 0;
css = s.GetStyleAttributes (null);
Assert.AreEqual (null, css ["border-style"], "GetStyleAttributes#22");
Assert.AreEqual ("0px", css ["border-width"], "GetStyleAttributes#23");
}
示例6: RenderCssRule
internal static void RenderCssRule(CssTextWriter cssWriter, string selector,
Style style, IUrlResolutionService urlResolver) {
cssWriter.WriteBeginCssRule(selector);
CssStyleCollection attrs = style.GetStyleAttributes(urlResolver);
attrs.Render(cssWriter);
cssWriter.WriteEndCssRule();
}
示例7: GetLoanBalance
decimal GetLoanBalance()
{
using (FinanceManagerDataContext db = new FinanceManagerDataContext())
{
try
{
decimal totalRepayment = 0;
totalRepayment = db.Loans.FirstOrDefault(l => l.LoanID == Convert.ToInt32(Request.QueryString["lid"])).Repayments.Where(r => r.isDeleted == false). Sum(r => r.RepaymentAmount).Value;
Loan _loan = db.Loans.FirstOrDefault(l => l.LoanID == Convert.ToInt32(Request.QueryString["lid"]));
lblTotalRepayment.Text = totalRepayment.ToString("C");
decimal totalPenalty =0;
//caculate total balance
try
{
totalPenalty = db.LoanPenalties.Where<LoanPenalty>(p => p.LoanID == _loan.LoanID && p.IsReleived == false).Sum(lp => lp.PenaltyAmount.Value);
}
catch (Exception)
{
totalPenalty = 0;
}
lblTotalPenalty.Text = totalPenalty.ToString("C");
if (totalPenalty <= 0)
{
lblTotalPenalty.Visible = false;
LitPenaltyLabel.Visible = false;
}
else
{
//change color scheme
DivMemberDetails.Attributes["class"] = "OverDueDataSection";
DivRepaymentDetails.Attributes["class"] = "OverDueDataSection";
DivNewRepayment .Attributes["class"] = "OverDueDataSection";
}
if (_loan.Amount.Value - totalRepayment <= 0)
{
_loan.IsPaidup = true;
db.SubmitChanges();
DivRepaymentDetails.Attributes["class"] = "DataSectionGreen";
DivMemberDetails.Attributes["class"] = "DataSectionGreen";
DivNewRepayment.Attributes["class"] = "DataSectionGreen";
// DivNewRepayment.Style = new CssStyleCollection(
Style style = new Style();
CssStyleCollection css = style.GetStyleAttributes(DivMemberDetails);
css.Add("height", "800px");
}
return _loan.Amount.Value - totalRepayment;
}
catch (Exception)
{
return 0;
}
}
}