protected virtual void UpdateAppearance(TimeEdit ownerEdit) { PopupAppearance = new AppearanceObject(AppearanceObject.EmptyAppearance); PopupAppearance.BackColor = Color.Black; PopupAppearance.BackColor2 = Color.DarkBlue; PopupAppearance.BorderColor = Color.LightBlue; }
private void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) { switch (Convert.ToInt32(radioGroup1.EditValue)) { case 1: // solution 1 if (cellStyles != null) { int column = e.Column.AbsoluteIndex; int row = gridView1.GetDataSourceRowIndex(e.RowHandle); AppearanceObject cellAppearance = cellStyles[new Point(column, row)] as AppearanceObject; if (cellAppearance != null) { e.Appearance.Assign(cellAppearance); } } break; case 2: // solution 2 string cellValue = gridView1.GetRowCellDisplayText(e.RowHandle, e.Column); if (cellValue.IndexOf('1') > 0) { e.Appearance.BackColor = Color.Red; } break; } }
void _View_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) { if (_ActiveFilter == string.Empty) { return; } int index = e.DisplayText.IndexOf(_ActiveFilter); if (index < 0) { return; } e.Handled = true; e.Appearance.FillRectangle(e.Cache, e.Bounds); MultiColorDrawStringParams args = new MultiColorDrawStringParams(e.Appearance); args.Bounds = e.Bounds; args.Text = e.DisplayText; args.Appearance.Assign(e.Appearance); AppearanceObject apperance = _View.PaintAppearance.SelectedRow; CharacterRangeWithFormat defaultRange = new CharacterRangeWithFormat(0, e.DisplayText.Length, e.Appearance.ForeColor, e.Appearance.BackColor); CharacterRangeWithFormat range = new CharacterRangeWithFormat(index, _ActiveFilter.Length, apperance.ForeColor, apperance.BackColor); args.Ranges = new CharacterRangeWithFormat[] { defaultRange, range }; paint.MultiColorDrawString(e.Cache, args); }
void myDockManager1_CustomDrawPanelCaption(object sender, MyCustomDrawArgs e) { if (!checkEdit1.Checked) { return; } DrawWindowCaptionArgs args = e.Args as DrawWindowCaptionArgs; if (args != null) { AppearanceObject appearance = new AppearanceObject(); appearance.BackColor = e.Panel == myDockPanel1 ? Color.Yellow : Color.LightCyan; appearance.BackColor2 = e.Panel == myDockPanel1 ? Color.Orange: Color.SkyBlue; appearance.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; Rectangle rect = args.Bounds; rect.Inflate(-1, -1); appearance.FillRectangle(args.Cache, rect); } DrawApplicationCaptionArgs appArgs = e.Args as DrawApplicationCaptionArgs; if (appArgs != null && args == null) { AppearanceObject appearance = new AppearanceObject(); appearance.BackColor = Color.LightCyan; appearance.BackColor2 = Color.LightGreen; appearance.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Horizontal; Rectangle rect = appArgs.Bounds; rect.Inflate(-1, -1); appearance.FillRectangle(appArgs.Cache, rect); } }
/// <summary> /// 重新绘制单元格的时候条件(首先判断是否修改) /// </summary> /// <param name="rowHandle"></param> /// <param name="column"></param> /// <param name="state"></param> /// <param name="appearance"></param> /// <returns></returns> protected override AppearanceObject RaiseGetRowCellStyle(int rowHandle, DevExpress.XtraGrid.Columns.GridColumn column, DevExpress.XtraGrid.Views.Base.GridRowCellState state, AppearanceObject appearance) { AppearanceObject ao = base.RaiseGetRowCellStyle(rowHandle, column, state, appearance); if (this.m_SchemeColor != null) { if (SetRowCellColorStyle != null) { CellColorArgs args = new CellColorArgs(); args.Appearance = ao; args.RowObject = this.GetRow(rowHandle); args.SchemeColor = this.m_SchemeColor; args.Column = column; //事件调用 this.OnSetRowCellColor(this, args); } } string str = string.Format("{0},{1}", rowHandle, column.ColumnHandle); if (this.EditedObject.Contains(str)) { ao.Font = new Font(ao.Font.FontFamily, ao.Font.Size, FontStyle.Bold); } else { ao.Font = new Font(ao.Font.FontFamily, ao.Font.Size, ao.Font.Style); } return(ao); }
private void ActivateMergedCellEditor(GridCellInfo cell) { if (cell == null) { return; } cell = cell.MergedCell.MergedCells[0]; this.fEditingCell = cell; Rectangle bounds = GetMergedEditorBounds(cell); if (bounds.IsEmpty) { return; } RepositoryItem cellEdit = RequestCellEditor(cell); ViewInfo.UpdateCellAppearance(cell); ViewInfo.RequestCellEditViewInfo(cell); AppearanceObject appearance = new AppearanceObject(); AppearanceHelper.Combine(appearance, new AppearanceObject[] { GetEditorAppearance(), ViewInfo.PaintAppearance.Row, cell.Appearance }); if (cellEdit != cell.Editor && cellEdit.DefaultAlignment != HorzAlignment.Default) { appearance.TextOptions.HAlignment = cellEdit.DefaultAlignment; } UpdateEditor(cellEdit, new UpdateEditorInfoArgs(GetColumnReadOnly(cell.ColumnInfo.Column), bounds, appearance, cell.CellValue, ElementsLookAndFeel, cell.ViewInfo.ErrorIconText, cell.ViewInfo.ErrorIcon)); ViewInfo.UpdateCellAppearance(cell); if (cell != null) { InvalidateRow(cell.RowHandle); } }
public CustomDrawLineEventArgs(GraphicsCache cache, AppearanceObject appearance, Rectangle bounds, GridCellInfo cellInfo) { this.cache = cache; this.bounds = bounds; this.cellInfo = cellInfo; this.appearance = appearance; }
protected override void PrintBandHeader(IBrickGraphics graph) { if (!View.OptionsPrint.PrintBandHeader) { return; } Rectangle r = Rectangle.Empty; Point indent = new Point(Indent, 0); bool usePrintStyles = View.OptionsPrint.UsePrintStyles; SetDefaultBrickStyle(graph, (BrickStyle)Bricks["BandPanel"].Clone()); foreach (PrintBandInfo band in Bands) { r = band.Bounds; r.Offset(indent); if (!usePrintStyles && band.Band != null) { AppearanceObject temp = new AppearanceObject(); AppearanceHelper.Combine(temp, new AppearanceObject[] { band.Band.AppearanceHeader, AppearancePrint.BandPanel }); SetDefaultBrickStyle(graph, Bricks.Create(temp, BorderSide.All, temp.BorderColor, 1)); } var brick = DrawTextBrick(graph, band.Band.GetTextCaption(), r); brick.Style = (BrickStyle)brick.Style.Clone(); brick.Style.StringFormat.ChangeFormatFlags(StringFormatFlags.NoWrap | StringFormatFlags.LineLimit); } }
public RowStateHelper(bool isReadOnly) { _ReadOnlyRow = isReadOnly; _DisabledRows = new List <int>(); _AppearanceDisabledRow = new AppearanceObject(); AppearanceDisabledRow.Changed += _AppearanceDisabledRow_Changed; }
public PriorityRowCellStyleEventArgs(GridCellInfo cellInfo, AppearanceObject appearance, bool overrydeFormatCondition) : base() { this.overrydeFormatCondition = overrydeFormatCondition; this.cellInfo = cellInfo; this.appearance = appearance; }
private void DrawAutoFilterRowText(GridView view, GraphicsCache cache, Rectangle r) { AppearanceObject appearance = view.PaintAppearance.TopNewRow; appearance.DrawBackground(cache, r); appearance.DrawString(cache, _AutoFilterText, r); }
public ItemSelectorPopupFormViewInfo(ItemSelectorPopupForm form) : base(form) { ShowSizeBar = Form.Properties.AllowResize; AppearanceColumnHeader = new AppearanceObject(); AppearanceResults = new AppearanceObject(); AppearanceMatch = new AppearanceObject(); ColumnHeaderArgs = new List <HeaderObjectInfoArgs>(); HeaderPainter = Form.Properties.LookAndFeel.Painter.Header; //This looks nicer in many skins, but has bad padding. //HoverElement = NavPaneSkins.GetSkin(Form.Properties.LookAndFeel)[NavPaneSkins.SkinOverflowPanelItem]; switch (Form.Properties.LookAndFeel.ActiveSkinName) { case "Darkroom": //Workaround for unsolveable issue - their ribbon button is transparent HoverElement = CommonSkins.GetSkin(Form.Properties.LookAndFeel)[CommonSkins.SkinButton]; break; default: HoverElement = RibbonSkins.GetSkin(Form.Properties.LookAndFeel)[RibbonSkins.SkinButton]; break; } LinePen = new Pen(Utilities.GetHeaderLineColor(form.Properties.LookAndFeel)); }
public override int GetButtonWidth(DockLayout dockLayout, AppearanceObject appearance, bool isHorizontal) { int result = 0; Graphics g = Painter.AddGraphics(null); if (dockLayout.Tabbed) { try { int imageSize = (isHorizontal ? GetImageSize(dockLayout).Width : GetImageSize(dockLayout).Height); int defImageSize = (isHorizontal ? GetDefaultImageSize(dockLayout).Width : GetDefaultImageSize(dockLayout).Height); int imageInterval = (imageSize > 0 ? HideBarHorzInterval : 0); for (int i = 0; i < dockLayout.Count; i++) { if (dockLayout[i].Visibility == DockVisibility.Visible) { layout = dockLayout[i]; int width = GetTabButtonWidth(dockLayout[i]); result += width + TabButtonsInterval; } } } finally { Painter.ReleaseGraphics(); } } else { return(base.GetButtonWidth(dockLayout, appearance, isHorizontal)); } return(result); }
protected override DevExpress.Utils.AppearanceObject RaiseGetCustomNodeCellStyle(DevExpress.XtraTreeList.GetCustomNodeCellStyleEventArgs e) { AppearanceObject ao = base.RaiseGetCustomNodeCellStyle(e); if (!e.Column.AppearanceCell.BackColor.IsEmpty) { if (e.Column.AppearanceCell.BackColor.ToArgb() != Color.White.ToArgb()) { return(ao); } } //if (!e.Column.AppearanceCell.BackColor.IsEmpty && e.Column.AppearanceCell.BackColor != Color.White) return ao; //如果当前行是焦点行或者是选中行直接返回 if (this.FocusedNode == e.Node) { return(ao); } //如果找到列配色方案 直接返回ao //if (RaiseColumnColor(e)) return ao; //不同模块使用不同配色方式 switch (this.ModelName) { case "分部分项": this.RaiseGetCustomNodeCellStyleEx(e, "LB"); break; default: //默认配色 按照Level配色 this.RaiseGetCustomNodeCellStyleEx(e); break; } return(ao); }
public void InitStyle() { style = new AppearanceObject(); style.BackColor = Color.Red; style.BackColor2 = Color.Orange; style.ForeColor = Color.White; style.Font = new Font(style.Font, FontStyle.Bold); }
private AppearanceObject checkGetNormalRowStyle(BaseRow row) { return(_normalRowStyle ?? (_normalRowStyle = new AppearanceObject { BackColor = row.Appearance.BackColor == Color.Empty ? SystemColors.Window : row.Appearance.BackColor })); }
AppearanceObject GetPaintAppearance() { AppearanceObject paintAppearance = new AppearanceObject(Appearance, DefaultAppearance); paintAppearance.TextOptions.WordWrap = WordWrap.Wrap; paintAppearance.TextOptions.VAlignment = VertAlignment.Top; paintAppearance.TextOptions.Trimming = Trimming.EllipsisCharacter; return(paintAppearance); }
private void DrawString(CheckedListBoxViewInfo.CheckedItemInfo itInfo, AppearanceObject appearance, GraphicsCache cache) { Rectangle textRect = new Rectangle(itInfo.TextRect.X + RepositoryItemCheckedImageComboBoxEdit.ImageWidth + 2, itInfo.TextRect.Y, itInfo.TextRect.Width - RepositoryItemCheckedImageComboBoxEdit.ImageWidth - 2, itInfo.TextRect.Height); appearance.DrawString(cache, itInfo.Text, textRect); }
private AppearanceObject GetPaintAppearance() { AppearanceObject obj2 = new AppearanceObject(base.Appearance, base.DefaultAppearance); obj2.TextOptions.WordWrap = WordWrap.Wrap; obj2.TextOptions.VAlignment = VertAlignment.Top; obj2.TextOptions.Trimming = Trimming.EllipsisCharacter; return(obj2); }
public static void LoadFont(AppearanceObject obj) { Font font = getFont(); if (font != null) { obj.Font = font; obj.Options.UseFont = true; } }
protected override void SetupRepositoryItem(DevExpress.XtraEditors.Repository.RepositoryItem item) { base.SetupRepositoryItem(item); ((RepositoryItemLookupEdit)item).Init(this, DisplayFormat, this.Helper); AppearanceObject appearance = new AppearanceObject(); appearance.Font = new Font(FontFamily.GenericSansSerif, 10F, FontStyle.Underline); ((RepositoryItemLookupEdit)item).Buttons.Add(new EditorButton(ButtonPredefines.Glyph, "Edit", -1, true, true, true, HorzAlignment.Default, null, new KeyShortcut(System.Windows.Forms.Keys.Enter), appearance, "Press this button to edit the object")); ((RepositoryItemLookupEdit)item).ButtonClick += new ButtonPressedEventHandler(MyLookupPropertyEditor_ButtonClick); }
void DrawCenterLine(ControlGraphicsInfoArgs info) { AppearanceObject obj = new AppearanceObject(); obj.BackColor = Color.Gray; obj.BackColor2 = Color.Black; obj.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; obj.FillRectangle(info.Cache, calc.CenterBounds); obj.Dispose(); }
private void Form1_Load(object sender, EventArgs e) { recordBindingSource.DataSource = DataHelper.GetData(10); style = new AppearanceObject(); style.BackColor = Color.Orange; style.Options.UseBackColor = true; //try different paint styles //advBandedGridView1.PaintStyleName = "UltraFlat"; }
void SetEvenRowAppearance(AppearanceObject appearance, int rowHandle) { if (rowHandle % 2 == 0) { appearance.BackColor = PaintAppearance.EvenRow.BackColor; } else { appearance.BackColor = PaintAppearance.Row.BackColor; } }
private void SetFont(AppearanceObject app, float size) { Font font = app.Font; float newSize = font.Size + size; if (newSize < 0 || newSize > Single.MaxValue) { return; } app.Font = new Font(font.FontFamily, newSize); }
public static void DrawStringDefaultColor(this AppearanceObject app, GraphicsCache cache, string text, Rectangle bounds, Brush foreground) { if (foreground != null) { app.DrawString(cache, text, bounds, foreground); } else { app.DrawString(cache, text, bounds); } }
///<summary>Creates appearance objects used by the editor.</summary> ///<remarks>Any properties that will never change (such as alignment) should be set here.</remarks> void CreateAppearances() { AppearanceResult = new AppearanceObject { Font = new Font(Appearance.GetFont(), FontStyle.Bold) }; AppearanceResult.TextOptions.VAlignment = VertAlignment.Center; AppearanceResultInfo = new AppearanceObject(); AppearanceResultInfo.TextOptions.VAlignment = VertAlignment.Center; AppearanceResultInfo.TextOptions.Trimming = Trimming.EllipsisCharacter; }
protected int GetTabButtonWidth(DockLayout layout) { AppearanceObject appearance = layout.DockManager.ActivePanel == layout.Panel ? layout.ActiveTabAppearance : layout.TabsAppearance; Graphics g = Painter.AddGraphics(null); int imageSize = (layout.IsHorizontal ? GetImageSize(layout).Width : GetImageSize(layout).Height); int defImageSize = (layout.IsHorizontal ? GetDefaultImageSize(layout).Width : GetDefaultImageSize(layout).Height); int imageInterval = (imageSize > 0 ? HideBarHorzInterval : 0); int width = Math.Max(DockElementsPainter.CalcTextSize(g, appearance, layout.TabText).Width + imageSize + imageInterval, defImageSize) + 10; Painter.ReleaseGraphics(); return(width); }
public ButtonsPanel() { Buttons = new List <EditorButton>(); Indent = 10; Appearance = new AppearanceObject(); Appearance.BackColor = SystemColors.Control; Appearance.ForeColor = SystemColors.ControlText; LookAndFeel = new UserLookAndFeel(this); HAlignment = HorzAlignment.Far; VAlignment = VertAlignment.Center; Padding = Padding.Empty; }
void DrawTitle(ControlGraphicsInfoArgs info) { if ((info.ViewInfo as ProgressBarViewInfo).Item.ShowTitle) { Rectangle bounds = info.Bounds; AppearanceObject obj = new AppearanceObject(info.ViewInfo.PaintAppearance); obj.ForeColor = Color.White; obj.DrawString(info.Cache, info.ViewInfo.DisplayText, bounds); bounds.Offset(1, 1); info.ViewInfo.PaintAppearance.DrawString(info.Cache, info.ViewInfo.DisplayText, bounds); } }
public void SetAppearance(AppearanceObject appearance, Font font = null, Color backColor = default(Color), Color foreColor = default(Color)) { if (appearance != null) { if (font != null) { appearance.Font = font; appearance.Options.UseFont = true; } if (backColor != default(Color)) { appearance.BackColor = backColor; appearance.Options.UseBackColor = true; } if (foreColor != default(Color)) { appearance.ForeColor = foreColor; appearance.Options.UseForeColor = true; } } }
public DiagramShapeViewEx(IEnumerable<DiagramGraphicsPath> paths, Func<bool> allowDrawShadows, AppearanceObject textAppearance, string text, RectangleF textBounds, DiagramShapeEx shape) : base(paths, allowDrawShadows, textAppearance, text, textBounds) { Shape = shape; TextBounds = textBounds; }
private AppearanceObject GenerateClickedLinkAppearance() { var appearanceObject = new AppearanceObject() { BackColor = Color.Transparent, Font = new Font("Tahoma", 14, FontStyle.Bold | FontStyle.Underline), ForeColor = Color.DeepSkyBlue, }; appearanceObject.Options.UseBackColor = true; appearanceObject.Options.UseFont = true; appearanceObject.Options.UseForeColor = true; return appearanceObject; }
public ItemSelectorPopupFormViewInfo(ItemSelectorPopupForm form) : base(form) { ShowSizeBar = Form.Properties.AllowResize; AppearanceColumnHeader = new AppearanceObject(); AppearanceResults = new AppearanceObject(); AppearanceMatch = new AppearanceObject(); ColumnHeaderArgs = new List<HeaderObjectInfoArgs>(); HeaderPainter = Form.Properties.LookAndFeel.Painter.Header; //This looks nicer in many skins, but has bad padding. //HoverElement = NavPaneSkins.GetSkin(Form.Properties.LookAndFeel)[NavPaneSkins.SkinOverflowPanelItem]; switch (Form.Properties.LookAndFeel.ActiveSkinName) { case "Darkroom": //Workaround for unsolveable issue - their ribbon button is transparent HoverElement = CommonSkins.GetSkin(Form.Properties.LookAndFeel)[CommonSkins.SkinButton]; break; default: HoverElement = RibbonSkins.GetSkin(Form.Properties.LookAndFeel)[RibbonSkins.SkinButton]; break; } LinePen = new Pen(Utilities.GetHeaderLineColor(form.Properties.LookAndFeel)); }
private AppearanceObject GenerateNormalLinkAppearance() { var appearanceObject = new AppearanceObject() { BackColor = Color.Transparent, Font = new Font("Tahoma", 12, FontStyle.Regular), ForeColor = Color.Black, }; appearanceObject.Options.UseBackColor = true; appearanceObject.Options.UseFont = true; appearanceObject.Options.UseForeColor = true; return appearanceObject; }
private void gvReception_RowCellStyle(object sender, RowCellStyleEventArgs e) { if (statusRegReception == StatusRegRecep.reg_recep_saved) { switch (tabOptionRight.SelectedTabPageIndex) { case 0: break; case 1: if (e.Column.Name.Contains("Dyn")) { // --- draw color style cell without result AppearanceObject styleRed = new AppearanceObject(); styleRed.BackColor = Color.Blue; styleRed.BackColor2 = Color.Blue; styleRed.ForeColor = Color.White; styleRed.Font = new Font(styleRed.Font, FontStyle.Bold); styleRed.Options.UseTextOptions = true; gvReception.Appearance.SelectedRow.Assign(styleRed); // --- draw color style cell report or enCreacion report CPositionValue cell = findReport(e.RowHandle, e.Column); if (cell != null) { e.Appearance.BackColor = cell.color; e.Appearance.Options.UseBorderColor = true; e.Appearance.BorderColor = Color.Red; } } break; case 3: if (e.Column.Name.Contains("Dyn")) { // --- draw color style cell without result AppearanceObject styleRed = new AppearanceObject(); styleRed.BackColor = Color.Blue; styleRed.BackColor2 = Color.Blue; styleRed.ForeColor = Color.White; styleRed.Font = new Font(styleRed.Font, FontStyle.Bold); styleRed.Options.UseTextOptions = true; gvReception.Appearance.SelectedRow.Assign(styleRed); // --- draw color style cell report or enCreacion report CPositionValueProgram cell = findProgram(e.RowHandle, e.Column); if (cell != null) { e.Appearance.BackColor = cell.color; e.Appearance.Options.UseBorderColor = true; e.Appearance.BorderColor = Color.Red; } } break; } } }
private void SetAppearance(AppearanceObject appearance, Color bgColor1, Color bgColor2, Color foreColor) { this.SetAppearance(appearance, this.MasterFont, bgColor1, bgColor2, foreColor); }
private void SetAppearance(AppearanceObject appearance, Font font, Color bgColor1, Color bgColor2, Color foreColor) { appearance.Font = font; appearance.BackColor = bgColor1; appearance.BackColor2 = bgColor2; appearance.ForeColor = foreColor; }