本文整理汇总了C#中System.Web.UI.WebControls.TableItemStyle.CopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C# TableItemStyle.CopyFrom方法的具体用法?C# TableItemStyle.CopyFrom怎么用?C# TableItemStyle.CopyFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TableItemStyle
的用法示例。
在下文中一共展示了TableItemStyle.CopyFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
//Put user code to initialize the page here
base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
System.Web.UI.WebControls.TableItemStyle tableStyle = new System.Web.UI.WebControls.TableItemStyle();
tableStyle.CopyFrom(Table2.Rows[0].Cells[0].ControlStyle);
Table1.Rows[0].Cells[0].ApplyStyle(tableStyle);
tableStyle.CopyFrom(Table2.Rows[1].ControlStyle);
Table1.Rows[1].ApplyStyle(tableStyle);
base.GHTTestEnd();
}
示例2: RenderDays
/// <devdoc>
/// </devdoc>
private void RenderDays(HtmlTextWriter writer, DateTime firstDay, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) {
// Now add the rows for the actual days
DateTime d = firstDay;
TableItemStyle weekSelectorStyle = null;
Unit defaultWidth;
bool hasWeekSelectors = HasWeekSelectors(selectionMode);
if (hasWeekSelectors) {
weekSelectorStyle = new TableItemStyle();
weekSelectorStyle.Width = Unit.Percentage(12);
weekSelectorStyle.HorizontalAlign = HorizontalAlign.Center;
weekSelectorStyle.CopyFrom(SelectorStyle);
defaultWidth = Unit.Percentage(12);
}
else {
defaultWidth = Unit.Percentage(14);
}
// This determines whether we need to call DateTime.ToString for each day. The only culture/calendar
// that requires this for now is the HebrewCalendar.
bool usesStandardDayDigits = !(threadCalendar is HebrewCalendar);
// This determines whether we can write out cells directly, or whether we have to create whole
// TableCell objects for each day.
bool hasRenderEvent = (this.GetType() != typeof(Calendar)
|| Events[EventDayRender] != null);
TableItemStyle [] cellStyles = new TableItemStyle[16];
int definedStyleMask = GetDefinedStyleMask();
DateTime todaysDate = TodaysDate;
string selectWeekText = SelectWeekText;
bool daysSelectable = buttonsActive && (selectionMode != CalendarSelectionMode.None);
int visibleDateMonth = threadCalendar.GetMonth(visibleDate);
int absoluteDay = firstDay.Subtract(baseDate).Days;
// VSWhidbey 480155: flag to indicate if forecolor needs to be set
// explicitly in design mode to mimic runtime rendering with the
// limitation of not supporting CSS class color setting.
bool inDesignSelectionMode = (DesignMode && SelectionMode != CalendarSelectionMode.None);
//------------------------------------------------------------------
// VSWhidbey 366243: The following variables are for boundary cases
// such as the current visible month is the first or the last
// supported month. They are used in the 'for' loops below.
// For the first supported month, calculate how many days to
// skip at the beginning of the first month. E.g. JapaneseCalendar
// starts at Sept 8.
int numOfFirstDaysToSkip = 0;
if (IsMinSupportedYearMonth(visibleDate)) {
numOfFirstDaysToSkip = (int)threadCalendar.GetDayOfWeek(firstDay) - NumericFirstDayOfWeek();
// If negative, it simply means the the index of the starting
// day name is greater than the day name of the first supported
// date. We add back 7 to get the number of days to skip.
if (numOfFirstDaysToSkip < 0) {
numOfFirstDaysToSkip += 7;
}
}
Debug.Assert(numOfFirstDaysToSkip < 7);
// For the last or second last supported month, initialize variables
// to identify the last supported date of the current calendar.
// e.g. The last supported date of HijriCalendar is April 3. When
// the second last monthh is shown, it can be the case that not all
// cells will be filled up.
bool passedLastSupportedDate = false;
DateTime secondLastMonth = threadCalendar.AddMonths(maxSupportedDate, -1);
bool lastOrSecondLastMonth = (IsMaxSupportedYearMonth(visibleDate) ||
IsTheSameYearMonth(secondLastMonth, visibleDate));
//------------------------------------------------------------------
for (int iRow = 0; iRow < 6; iRow++) {
if (passedLastSupportedDate) {
break;
}
writer.Write(ROWBEGINTAG);
// add week selector column and button if required
if (hasWeekSelectors) {
// Range selection. The command starts with an "R". The remainder is an integer. When divided by 100
// the result is the day difference from the base date of the first day, and the remainder is the
// number of days to select.
int dayDiffParameter = (absoluteDay * 100) + 7;
// Adjust the dayDiff for the first or the last supported month
if (numOfFirstDaysToSkip > 0) {
dayDiffParameter -= numOfFirstDaysToSkip;
}
else if (lastOrSecondLastMonth) {
int daysFromLastDate = maxSupportedDate.Subtract(d).Days;
if (daysFromLastDate < 6) {
dayDiffParameter -= (6 - daysFromLastDate);
}
}
string weekSelectKey = SELECT_RANGE_COMMAND + dayDiffParameter.ToString(CultureInfo.InvariantCulture);
string selectWeekTitle = null;
//.........这里部分代码省略.........
示例3: PrepareControlHierarchy
protected override void PrepareControlHierarchy ()
{
if (!HasControls () || Controls.Count == 0)
return; // No one called CreateControlHierarchy() with DataSource != null
Style alt = null;
foreach (DataListItem item in Controls) {
switch (item.ItemType) {
case ListItemType.Item:
item.MergeStyle (itemStyle);
break;
case ListItemType.AlternatingItem:
if (alt == null) {
if (alternatingItemStyle != null) {
alt = new TableItemStyle ();
alt.CopyFrom (itemStyle);
alt.CopyFrom (alternatingItemStyle);
} else
alt = itemStyle;
}
item.MergeStyle (alt);
break;
case ListItemType.EditItem:
if (editItemStyle != null)
item.MergeStyle (editItemStyle);
else
item.MergeStyle (itemStyle);
break;
case ListItemType.Footer:
if (!ShowFooter) {
item.Visible = false;
break;
}
if (footerStyle != null)
item.MergeStyle (footerStyle);
break;
case ListItemType.Header:
if (!ShowHeader) {
item.Visible = false;
break;
}
if (headerStyle != null)
item.MergeStyle (headerStyle);
break;
case ListItemType.SelectedItem:
if (selectedItemStyle != null)
item.MergeStyle (selectedItemStyle);
else
item.MergeStyle (itemStyle);
break;
case ListItemType.Separator:
if (separatorStyle != null)
item.MergeStyle(separatorStyle);
else
item.MergeStyle (itemStyle);
break;
}
}
}
示例4: ApplyDefaultCreateUserValues
//.........这里部分代码省略.........
this._passwordRegExpRow.Visible = false;
this._passwordCompareRow.Visible = false;
}
else
{
passwordRequired.ErrorMessage = this.PasswordRequiredErrorMessage;
passwordRequired.ToolTip = this.PasswordRequiredErrorMessage;
confirmPasswordRequired.ErrorMessage = this.ConfirmPasswordRequiredErrorMessage;
confirmPasswordRequired.ToolTip = this.ConfirmPasswordRequiredErrorMessage;
passwordCompareValidator.ErrorMessage = this.ConfirmPasswordCompareErrorMessage;
if (this._validatorTextStyle != null)
{
passwordRequired.ApplyStyle(this._validatorTextStyle);
confirmPasswordRequired.ApplyStyle(this._validatorTextStyle);
passwordCompareValidator.ApplyStyle(this._validatorTextStyle);
}
if (flag4)
{
passwordRegExpValidator.ValidationExpression = this.PasswordRegularExpression;
passwordRegExpValidator.ErrorMessage = this.PasswordRegularExpressionErrorMessage;
if (this._validatorTextStyle != null)
{
passwordRegExpValidator.ApplyStyle(this._validatorTextStyle);
}
}
else
{
this._passwordRegExpRow.Visible = false;
}
}
RequiredFieldValidator userNameRequired = this._createUserStepContainer.UserNameRequired;
userNameRequired.ErrorMessage = this.UserNameRequiredErrorMessage;
userNameRequired.ToolTip = this.UserNameRequiredErrorMessage;
userNameRequired.Enabled = flag;
userNameRequired.Visible = flag;
if (this._validatorTextStyle != null)
{
userNameRequired.ApplyStyle(this._validatorTextStyle);
}
bool flag5 = (flag && (this.EmailRegularExpression.Length > 0)) && this.RequireEmail;
RegularExpressionValidator emailRegExpValidator = this._createUserStepContainer.EmailRegExpValidator;
emailRegExpValidator.Enabled = flag5;
emailRegExpValidator.Visible = flag5;
if ((this.EmailRegularExpression.Length > 0) && this.RequireEmail)
{
emailRegExpValidator.ValidationExpression = this.EmailRegularExpression;
emailRegExpValidator.ErrorMessage = this.EmailRegularExpressionErrorMessage;
if (this._validatorTextStyle != null)
{
emailRegExpValidator.ApplyStyle(this._validatorTextStyle);
}
}
else
{
this._emailRegExpRow.Visible = false;
}
string helpPageText = this.HelpPageText;
bool flag6 = helpPageText.Length > 0;
HyperLink helpPageLink = this._createUserStepContainer.HelpPageLink;
Image helpPageIcon = this._createUserStepContainer.HelpPageIcon;
helpPageLink.Visible = flag6;
if (flag6)
{
helpPageLink.Text = helpPageText;
helpPageLink.NavigateUrl = this.HelpPageUrl;
helpPageLink.TabIndex = this.TabIndex;
}
string helpPageIconUrl = this.HelpPageIconUrl;
bool flag7 = helpPageIconUrl.Length > 0;
helpPageIcon.Visible = flag7;
if (flag7)
{
helpPageIcon.ImageUrl = helpPageIconUrl;
helpPageIcon.AlternateText = helpPageText;
}
LoginUtil.SetTableCellVisible(helpPageLink, flag6 || flag7);
if ((this._hyperLinkStyle != null) && (flag6 || flag7))
{
TableItemStyle style = new TableItemStyle();
style.CopyFrom(this._hyperLinkStyle);
style.Font.Reset();
LoginUtil.SetTableCellStyle(helpPageLink, style);
helpPageLink.Font.CopyFrom(this._hyperLinkStyle.Font);
helpPageLink.ForeColor = this._hyperLinkStyle.ForeColor;
}
Control errorMessageLabel = this._createUserStepContainer.ErrorMessageLabel;
if (errorMessageLabel != null)
{
if (this._failure && !string.IsNullOrEmpty(this._unknownErrorMessage))
{
((ITextControl) errorMessageLabel).Text = this._unknownErrorMessage;
LoginUtil.SetTableCellStyle(errorMessageLabel, this.ErrorMessageStyle);
LoginUtil.SetTableCellVisible(errorMessageLabel, true);
}
else
{
LoginUtil.SetTableCellVisible(errorMessageLabel, false);
}
}
}
示例5: PrepareControlHierarchy
/// <devdoc>
/// </devdoc>
protected internal virtual void PrepareControlHierarchy() {
// The order of rows is autogenerated data rows, declared rows, then autogenerated command rows
if (Controls.Count < 1) {
return;
}
Debug.Assert(Controls[0] is Table);
Table childTable = (Table)Controls[0];
childTable.CopyBaseAttributes(this);
if (ControlStyleCreated && !ControlStyle.IsEmpty) {
childTable.ApplyStyle(ControlStyle);
} else {
// Since we didn't create a ControlStyle yet, the default
// settings for the default style of the control need to be applied
// to the child table control directly
//
childTable.GridLines = GridLines.Both;
childTable.CellSpacing = 0;
}
childTable.Caption = Caption;
childTable.CaptionAlign = CaptionAlign;
// the composite alternating item style, so we need to do just one
// merge style on the actual item
Style altRowStyle = new TableItemStyle();
altRowStyle.CopyFrom(_rowStyle);
if (_alternatingRowStyle != null) {
altRowStyle = new TableItemStyle();
altRowStyle.CopyFrom(_alternatingRowStyle);
}
Style compositeStyle;
TableRowCollection rows = childTable.Rows;
foreach (DetailsViewRow row in rows) {
compositeStyle = new TableItemStyle();
DataControlRowState rowState = row.RowState;
DataControlRowType rowType = row.RowType;
DataControlFieldCell headerFieldCell = row.Cells[0] as DataControlFieldCell;
DataControlField field = null;
if (headerFieldCell != null) {
field = headerFieldCell.ContainingField;
}
switch (rowType) {
case DataControlRowType.Header:
compositeStyle = _headerStyle;
break;
case DataControlRowType.Footer:
compositeStyle = _footerStyle;
break;
case DataControlRowType.DataRow:
compositeStyle.CopyFrom(_rowStyle);
if ((rowState & DataControlRowState.Alternate) != 0) {
compositeStyle.CopyFrom(altRowStyle);
}
if (field is ButtonFieldBase) {
compositeStyle.CopyFrom(_commandRowStyle);
break;
}
if ((rowState & DataControlRowState.Edit) != 0) {
compositeStyle.CopyFrom(_editRowStyle);
}
if ((rowState & DataControlRowState.Insert) != 0) {
if (_insertRowStyle != null) {
compositeStyle.CopyFrom(_insertRowStyle);
}
else {
compositeStyle.CopyFrom(_editRowStyle);
}
}
break;
case DataControlRowType.Pager:
compositeStyle = _pagerStyle;
break;
case DataControlRowType.EmptyDataRow:
compositeStyle = _emptyDataRowStyle;
break;
}
if (compositeStyle != null && row.Visible) {
row.MergeStyle(compositeStyle);
}
if (rowType == DataControlRowType.DataRow && field != null) {
if (!field.Visible ||
(Mode == DetailsViewMode.Insert && !field.InsertVisible)) {
row.Visible = false;
}
//.........这里部分代码省略.........
示例6: ApplyCompleteValues
private void ApplyCompleteValues() {
LoginUtil.ApplyStyleToLiteral(_completeStepContainer.SuccessTextLabel, CompleteSuccessText, _completeSuccessTextStyle, true);
switch (ContinueButtonType) {
case ButtonType.Link:
_completeStepContainer.ContinuePushButton.Visible = false;
_completeStepContainer.ContinueImageButton.Visible = false;
_completeStepContainer.ContinueLinkButton.Text = ContinueButtonText;
_completeStepContainer.ContinueLinkButton.ValidationGroup = ValidationGroup;
_completeStepContainer.ContinueLinkButton.TabIndex = TabIndex;
_completeStepContainer.ContinueLinkButton.AccessKey = AccessKey;
break;
case ButtonType.Button:
_completeStepContainer.ContinueLinkButton.Visible = false;
_completeStepContainer.ContinueImageButton.Visible = false;
_completeStepContainer.ContinuePushButton.Text = ContinueButtonText;
_completeStepContainer.ContinuePushButton.ValidationGroup = ValidationGroup;
_completeStepContainer.ContinuePushButton.TabIndex = TabIndex;
_completeStepContainer.ContinuePushButton.AccessKey = AccessKey;
break;
case ButtonType.Image:
_completeStepContainer.ContinueLinkButton.Visible = false;
_completeStepContainer.ContinuePushButton.Visible = false;
_completeStepContainer.ContinueImageButton.ImageUrl = ContinueButtonImageUrl;
_completeStepContainer.ContinueImageButton.AlternateText = ContinueButtonText;
_completeStepContainer.ContinueImageButton.ValidationGroup = ValidationGroup;
_completeStepContainer.ContinueImageButton.TabIndex = TabIndex;
_completeStepContainer.ContinueImageButton.AccessKey = AccessKey;
break;
}
if (!NavigationButtonStyle.IsEmpty) {
_completeStepContainer.ContinuePushButton.ApplyStyle(NavigationButtonStyle);
_completeStepContainer.ContinueImageButton.ApplyStyle(NavigationButtonStyle);
_completeStepContainer.ContinueLinkButton.ApplyStyle(NavigationButtonStyle);
}
if (_continueButtonStyle != null) {
_completeStepContainer.ContinuePushButton.ApplyStyle(_continueButtonStyle);
_completeStepContainer.ContinueImageButton.ApplyStyle(_continueButtonStyle);
_completeStepContainer.ContinueLinkButton.ApplyStyle(_continueButtonStyle);
}
LoginUtil.ApplyStyleToLiteral(_completeStepContainer.Title, CompleteStep.Title, _titleTextStyle, true);
string editProfileText = EditProfileText;
bool editProfileVisible = (editProfileText.Length > 0);
HyperLink editProfileLink = _completeStepContainer.EditProfileLink;
editProfileLink.Visible = editProfileVisible;
if (editProfileVisible) {
editProfileLink.Text = editProfileText;
editProfileLink.NavigateUrl = EditProfileUrl;
editProfileLink.TabIndex = TabIndex;
if (_hyperLinkStyle != null) {
// Apply style except font to table cell, then apply font and forecolor to HyperLinks
// VSWhidbey 81289
Style hyperLinkStyleExceptFont = new TableItemStyle();
hyperLinkStyleExceptFont.CopyFrom(_hyperLinkStyle);
hyperLinkStyleExceptFont.Font.Reset();
LoginUtil.SetTableCellStyle(editProfileLink, hyperLinkStyleExceptFont);
editProfileLink.Font.CopyFrom(_hyperLinkStyle.Font);
editProfileLink.ForeColor = _hyperLinkStyle.ForeColor;
}
}
string editProfileIconUrl = EditProfileIconUrl;
bool editProfileIconVisible = (editProfileIconUrl.Length > 0);
Image editProfileIcon = _completeStepContainer.EditProfileIcon;
editProfileIcon.Visible = editProfileIconVisible;
if (editProfileIconVisible) {
editProfileIcon.ImageUrl = editProfileIconUrl;
editProfileIcon.AlternateText = EditProfileText;
}
LoginUtil.SetTableCellVisible(editProfileLink, editProfileVisible || editProfileIconVisible);
// Copy the styles from the StepStyle property if defined.
Table table = ((CompleteStepContainer)(CompleteStep.ContentTemplateContainer)).LayoutTable;
table.Height = Height;
table.Width = Width;
}
示例7: PrepareControlHierarchy
/// <summary>
/// Undocumented
/// </summary>
protected override void PrepareControlHierarchy ()
{
if (Controls.Count == 0)
return;
Style defaultStyle = null;
Style rowStyle = null;
if (alternatingItemStyle != null) {
defaultStyle = new TableItemStyle ();
defaultStyle.CopyFrom (itemStyle);
defaultStyle.CopyFrom (alternatingItemStyle);
} else {
defaultStyle = itemStyle;
}
foreach (DataListItem current in Controls) {
rowStyle = null;
switch (current.ItemType) {
case ListItemType.Header:
if (headerStyle != null)
rowStyle = headerStyle;
break;
case ListItemType.Footer:
if (footerStyle != null)
rowStyle = footerStyle;
break;
case ListItemType.Separator:
rowStyle = separatorStyle;
break;
case ListItemType.Item:
rowStyle = itemStyle;
break;
case ListItemType.AlternatingItem:
rowStyle = defaultStyle;
break;
case ListItemType.SelectedItem:
rowStyle = new TableItemStyle ();
if ((current.ItemIndex % 2) == 0) {
rowStyle.CopyFrom (itemStyle);
} else {
rowStyle.CopyFrom (defaultStyle);
}
rowStyle.CopyFrom (selectedItemStyle);
break;
case ListItemType.EditItem:
rowStyle = new TableItemStyle ();
if ((current.ItemIndex % 2) == 0) {
rowStyle.CopyFrom (itemStyle);
} else {
rowStyle.CopyFrom (defaultStyle);
}
if (current.ItemIndex == SelectedIndex)
rowStyle.CopyFrom (selectedItemStyle);
rowStyle.CopyFrom (editItemStyle);
break;
}
if (rowStyle == null)
continue;
if (!extractTemplateRows) {
current.MergeStyle (rowStyle);
continue;
}
if (current.HasControls ()) {
int len = current.Controls.Count;
for (int i = 0 ; i < len ; i++) {
Control currentCtrl = current.Controls [i];
if (!(currentCtrl is Table))
continue;
foreach (TableRow cRow in ((Table) currentCtrl).Rows)
cRow.MergeStyle (rowStyle);
}
}
}
}
示例8: PrepareControlHierarchy
/// <internalonly/>
/// <devdoc>
/// </devdoc>
protected internal virtual void PrepareControlHierarchy() {
if (Controls.Count == 0)
return;
bool controlStyleCreated = ControlStyleCreated;
Table childTable = (Table)Controls[0];
childTable.CopyBaseAttributes(this);
if (controlStyleCreated && !ControlStyle.IsEmpty) {
childTable.ApplyStyle(ControlStyle);
}
else {
// Since we didn't create a ControlStyle yet, the default
// settings for the default style of the control need to be applied
// to the child table control directly
//
childTable.GridLines = GridLines.Both;
childTable.CellSpacing = 0;
}
childTable.Caption = Caption;
childTable.CaptionAlign = CaptionAlign;
TableRowCollection rows = childTable.Rows;
// the composite alternating row style, so we need to do just one
// merge style on the actual row
Style altRowStyle = null;
if (_alternatingRowStyle != null) {
altRowStyle = new TableItemStyle();
altRowStyle.CopyFrom(_rowStyle);
altRowStyle.CopyFrom(_alternatingRowStyle);
}
else {
altRowStyle = _rowStyle;
}
int visibleColumns = 0;
bool calculateColumns = true;
foreach (GridViewRow row in rows) {
switch (row.RowType) {
case DataControlRowType.Header:
if (ShowHeader && _headerStyle != null) {
row.MergeStyle(_headerStyle);
}
break;
case DataControlRowType.Footer:
if (ShowFooter && _footerStyle != null) {
row.MergeStyle(_footerStyle);
}
break;
case DataControlRowType.Pager:
if (row.Visible && _pagerStyle != null) {
row.MergeStyle(_pagerStyle);
}
break;
case DataControlRowType.DataRow:
if ((row.RowState & DataControlRowState.Edit) != 0) {
// When creating the control hierarchy, we first check if the
// row is in edit mode. So an row may be selected too, and
// so both editRowStyle (more specific) and selectedRowStyle
// are applied.
{
Style s = new TableItemStyle();
if (row.RowIndex % 2 != 0)
s.CopyFrom(altRowStyle);
else
s.CopyFrom(_rowStyle);
if (row.RowIndex == SelectedIndex)
s.CopyFrom(_selectedRowStyle);
s.CopyFrom(_editRowStyle);
row.MergeStyle(s);
}
}
else if ((row.RowState & DataControlRowState.Selected) != 0) {
// When creating the control hierarchy we first check if the
// row is in edit mode, so we know this row cannot be in edit
// mode. The only special characteristic of this row is that
// it is selected.
{
Style s = new TableItemStyle();
if (row.RowIndex % 2 != 0)
s.CopyFrom(altRowStyle);
else
s.CopyFrom(_rowStyle);
s.CopyFrom(_selectedRowStyle);
row.MergeStyle(s);
}
}
else if ((row.RowState & DataControlRowState.Alternate) != 0) {
row.MergeStyle(altRowStyle);
}
else {
//.........这里部分代码省略.........
示例9: PrepareControlHierarchy
protected internal override void PrepareControlHierarchy()
{
if (this.Controls.Count != 0)
{
Table table = (Table) this.Controls[0];
table.CopyBaseAttributes(this);
table.Caption = this.Caption;
table.CaptionAlign = this.CaptionAlign;
if (base.ControlStyleCreated)
{
table.ApplyStyle(base.ControlStyle);
}
else
{
table.GridLines = GridLines.Both;
table.CellSpacing = 0;
}
TableRowCollection rows = table.Rows;
int count = rows.Count;
if (count != 0)
{
int num2 = this.Columns.Count;
DataGridColumn[] array = new DataGridColumn[num2];
if (num2 > 0)
{
this.Columns.CopyTo(array, 0);
}
Style s = null;
if (this.alternatingItemStyle != null)
{
s = new TableItemStyle();
s.CopyFrom(this.itemStyle);
s.CopyFrom(this.alternatingItemStyle);
}
else
{
s = this.itemStyle;
}
int num3 = 0;
bool flag = true;
for (int i = 0; i < count; i++)
{
Style style2;
Style style3;
TableCellCollection cells;
DataGridItem item = (DataGridItem) rows[i];
switch (item.ItemType)
{
case ListItemType.Header:
{
if (this.ShowHeader)
{
break;
}
item.Visible = false;
continue;
}
case ListItemType.Footer:
{
if (this.ShowFooter)
{
goto Label_016A;
}
item.Visible = false;
continue;
}
case ListItemType.Item:
item.MergeStyle(this.itemStyle);
goto Label_029E;
case ListItemType.AlternatingItem:
item.MergeStyle(s);
goto Label_029E;
case ListItemType.SelectedItem:
style2 = new TableItemStyle();
if ((item.ItemIndex % 2) == 0)
{
goto Label_021D;
}
style2.CopyFrom(s);
goto Label_022A;
case ListItemType.EditItem:
style3 = new TableItemStyle();
if ((item.ItemIndex % 2) == 0)
{
goto Label_025F;
}
style3.CopyFrom(s);
goto Label_026C;
case ListItemType.Pager:
{
if (this.pagerStyle.Visible)
{
goto Label_0196;
}
item.Visible = false;
continue;
//.........这里部分代码省略.........
示例10: SetDayStyles
private void SetDayStyles(TableItemStyle style, int styleMask, Unit defaultWidth)
{
// default day styles
style.Width = defaultWidth;
style.HorizontalAlign = HorizontalAlign.Center;
if ((styleMask & STYLEMASK_DAY) != 0)
{
style.CopyFrom(DayStyle);
}
if ((styleMask & STYLEMASK_WEEKEND) != 0)
{
style.CopyFrom(WeekendDayStyle);
}
if ((styleMask & STYLEMASK_OTHERMONTH) != 0)
{
style.CopyFrom(OtherMonthDayStyle);
}
if ((styleMask & STYLEMASK_TODAY) != 0)
{
style.CopyFrom(TodayDayStyle);
}
}
示例11: CreateDayHeader
private TableRow CreateDayHeader(DateTime firstDay, DateTime visibleDate, System.Globalization.Calendar threadCalendar)
{
TableRow row = new TableRow();
DateTimeFormatInfo dtf = DateTimeFormatInfo.CurrentInfo;
TableItemStyle dayNameStyle = new TableItemStyle();
dayNameStyle.HorizontalAlign = HorizontalAlign.Center;
dayNameStyle.CopyFrom(DayHeaderStyle);
DayNameFormat dayNameFormat = DayNameFormat;
int numericFirstDay = (int)threadCalendar.GetDayOfWeek(firstDay);
for (int i = numericFirstDay; i < numericFirstDay + 7; i++)
{
string dayName;
int dayOfWeek = i % 7;
switch (dayNameFormat)
{
case DayNameFormat.FirstLetter:
dayName = dtf.GetDayName((DayOfWeek)dayOfWeek).Substring(0, 1);
break;
case DayNameFormat.FirstTwoLetters:
dayName = dtf.GetDayName((DayOfWeek)dayOfWeek).Substring(0, 2);
break;
case DayNameFormat.Full:
dayName = dtf.GetDayName((DayOfWeek)dayOfWeek);
break;
case DayNameFormat.Short:
dayName = dtf.GetAbbreviatedDayName((DayOfWeek)dayOfWeek);
break;
case DayNameFormat.Shortest:
dayName = dtf.GetShortestDayName((DayOfWeek)dayOfWeek);
break;
default:
System.Diagnostics.Debug.Assert(false, "Unknown DayNameFormat value!");
goto
case DayNameFormat.Short;
}
TableCell cell = new TableCell();
cell.ApplyStyle(dayNameStyle);
cell.Text = dayName;
row.Cells.Add(cell);
}
return row;
}
示例12: CopyFrom
public void CopyFrom ()
{
TableItemStyle tis = new TableItemStyle ();
tis.HorizontalAlign = HorizontalAlign.Left;
tis.VerticalAlign = VerticalAlign.Top;
tis.Wrap = true;
tis.CopyFrom (GetTableItemStyle ());
CheckTableStyle (tis);
}
示例13: SetDayStyles
/// <devdoc>
/// </devdoc>
private void SetDayStyles(TableItemStyle style, int styleMask, Unit defaultWidth) {
// default day styles
style.Width = defaultWidth;
style.HorizontalAlign = HorizontalAlign.Center;
if ((styleMask & STYLEMASK_DAY) != 0) {
style.CopyFrom(DayStyle);
}
if ((styleMask & STYLEMASK_WEEKEND) != 0) {
style.CopyFrom(WeekendDayStyle);
}
if ((styleMask & STYLEMASK_OTHERMONTH) != 0) {
style.CopyFrom(OtherMonthDayStyle);
}
if ((styleMask & STYLEMASK_TODAY) != 0) {
style.CopyFrom(TodayDayStyle);
}
if ((styleMask & STYLEMASK_SELECTED) != 0) {
// default selected day style
style.ForeColor = Color.White;
style.BackColor = Color.Silver;
style.CopyFrom(SelectedDayStyle);
}
}
示例14: RenderTitle
/// <devdoc>
/// </devdoc>
private void RenderTitle(HtmlTextWriter writer, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) {
writer.Write(ROWBEGINTAG);
TableCell titleCell = new TableCell();
Table titleTable = new Table();
// default title table/cell styles
titleCell.ColumnSpan = HasWeekSelectors(selectionMode) ? 8 : 7;
titleCell.BackColor = Color.Silver;
titleTable.GridLines = GridLines.None;
titleTable.Width = Unit.Percentage(100);
titleTable.CellSpacing = 0;
TableItemStyle titleStyle = TitleStyle;
ApplyTitleStyle(titleCell, titleTable, titleStyle);
titleCell.RenderBeginTag(writer);
titleTable.RenderBeginTag(writer);
writer.Write(ROWBEGINTAG);
NextPrevFormat nextPrevFormat = NextPrevFormat;
TableItemStyle nextPrevStyle = new TableItemStyle();
nextPrevStyle.Width = Unit.Percentage(15);
nextPrevStyle.CopyFrom(NextPrevStyle);
if (ShowNextPrevMonth) {
if (IsMinSupportedYearMonth(visibleDate)) {
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.RenderEndTag();
}
else {
string prevMonthText;
if (nextPrevFormat == NextPrevFormat.ShortMonth || nextPrevFormat == NextPrevFormat.FullMonth) {
int monthNo = threadCalendar.GetMonth(threadCalendar.AddMonths(visibleDate, - 1));
prevMonthText = GetMonthName(monthNo, (nextPrevFormat == NextPrevFormat.FullMonth));
}
else {
prevMonthText = PrevMonthText;
}
// Month navigation. The command starts with a "V" and the remainder is day difference from the
// base date.
DateTime prevMonthDate;
// VSWhidbey 366243: Some calendar's min supported date is
// not the first day of the month (e.g. JapaneseCalendar.
// So if we are setting the second supported month, the prev
// month link should always point to the first supported
// date instead of the first day of the previous month.
DateTime secondSupportedMonth = threadCalendar.AddMonths(minSupportedDate, 1);
if (IsTheSameYearMonth(secondSupportedMonth, visibleDate)) {
prevMonthDate = minSupportedDate;
}
else {
prevMonthDate = threadCalendar.AddMonths(visibleDate, -1);
}
string prevMonthKey = NAVIGATE_MONTH_COMMAND + (prevMonthDate.Subtract(baseDate)).Days.ToString(CultureInfo.InvariantCulture);
string previousMonthTitle = null;
if (useAccessibleHeader) {
previousMonthTitle = SR.GetString(SR.Calendar_PreviousMonthTitle);
}
RenderCalendarCell(writer, nextPrevStyle, prevMonthText, previousMonthTitle, buttonsActive, prevMonthKey);
}
}
TableItemStyle cellMainStyle = new TableItemStyle();
if (titleStyle.HorizontalAlign != HorizontalAlign.NotSet) {
cellMainStyle.HorizontalAlign = titleStyle.HorizontalAlign;
}
else {
cellMainStyle.HorizontalAlign = HorizontalAlign.Center;
}
cellMainStyle.Wrap = titleStyle.Wrap;
cellMainStyle.Width = Unit.Percentage(70);
string titleText;
switch (TitleFormat) {
case TitleFormat.Month:
titleText = visibleDate.ToString("MMMM", CultureInfo.CurrentCulture);
break;
case TitleFormat.MonthYear:
string titlePattern = DateTimeFormatInfo.CurrentInfo.YearMonthPattern;
// Some cultures have a comma in their YearMonthPattern, which does not look
// right in a calendar. Use a fixed pattern for those.
if (titlePattern.IndexOf(',') >= 0) {
titlePattern = "MMMM yyyy";
}
titleText = visibleDate.ToString(titlePattern, CultureInfo.CurrentCulture);
break;
default:
Debug.Assert(false, "Unknown TitleFormat value!");
goto case TitleFormat.MonthYear;
}
RenderCalendarCell(writer, cellMainStyle, titleText, null, false, null);
//.........这里部分代码省略.........
示例15: PrepareControlHierarchy
protected override void PrepareControlHierarchy()
{
if (Controls.Count == 0)
return;
Table display = (Table) Controls [0];
display.CopyBaseAttributes (this);
if (ControlStyleCreated) {
display.ApplyStyle (ControlStyle);
} else {
display.GridLines = GridLines.Both;
display.CellSpacing = 0;
}
TableRowCollection rows = display.Rows;
if (rows.Count == 0)
return;
int nCols = Columns.Count;
DataGridColumn [] cols = new DataGridColumn [nCols];
Style deployStyle = null;
if (nCols > 0)
Columns.CopyTo (cols, 0);
if (alternatingItemStyle != null) {
deployStyle = new TableItemStyle ();
deployStyle.CopyFrom (itemStyle);
deployStyle.CopyFrom (alternatingItemStyle);
} else {
deployStyle = itemStyle;
}
int nrows = rows.Count;
for (int counter = 0; counter < nrows; counter++)
PrepareControlHierarchyForItem (cols,
(DataGridItem) rows [counter],
counter,
deployStyle);
}