private void DrawNothingToSee(CustomDrawEventArgs e) { if (ActiveGridControl.DataSource == null) { e.Graphics.DrawString(NoData, PaintFont, Brushes.Gray, NothingToSeeBounds(e.Bounds).Location); } }
/// <summary> /// 在查询得到0条记录时显示自定义的字符提示/显示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MyGridView_CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { if (!this.EnableShowEmptyForeground) { return; } string showText = string.IsNullOrWhiteSpace(this.EmptyForegroundText) ? "没有查询到你所想要的数据!" : this.EmptyForegroundText; //方法一(此方法为GridView设置了数据源绑定时,可用) try { var bindingSource = this.DataSource as BindingSource; if (bindingSource.Count == 0) { var str = showText; var f = new Font("宋体", 10, FontStyle.Bold); var r = new Rectangle(e.Bounds.Top + 5, e.Bounds.Left + 5, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Black, r); } } catch { //方法二(此方法为GridView没有设置数据源绑定时使用,一般使用此种方法) if (this.RowCount == 0) { var str = showText; var f = new Font("宋体", 10, FontStyle.Bold); var r = new Rectangle(e.Bounds.Left + 5, e.Bounds.Top + 5, e.Bounds.Width - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Black, r); } } }
public void AddMessageInEmptyArea(CustomDrawEventArgs e, string message) { var font = new Font(AppearanceObject.DefaultFont, FontStyle.Bold); var r = new Rectangle(e.Bounds.Left + 5, e.Bounds.Top + 5, e.Bounds.Width - 5, e.Bounds.Height - 5); e.Graphics.DrawString(message, font, Brushes.Black, r); }
protected override void DrawRadioGroupItems(ControlGraphicsInfoArgs info) { RadioGroupViewInfo vi = info.ViewInfo as RadioGroupViewInfo; foreach (RadioGroupItemViewInfo itemInfo in vi.ItemsInfo) { itemInfo.Cache = info.Cache; try { CustomDrawEventArgs e = new CustomDrawEventArgs(info.Graphics, itemInfo, vi.RadioPainter, false); RepositoryItemCustomRadioGroup item = vi.Item as RepositoryItemCustomRadioGroup; item.RaiseCustomDrawItem(e); if (!e.Handled) { vi.RadioPainter.DrawObject(itemInfo); } if (itemInfo.Focused) { ControlPaint.DrawFocusRectangle(info.Graphics, vi.GetFocusRect(itemInfo)); } } finally { itemInfo.Cache = null; } } }
protected virtual void OnDrawBody(PaintEventArgs args) { var drawArg = new CustomDrawEventArgs(args.ClipRectangle, args.Graphics, false); if (Draw != null) { Draw(this, drawArg); } if (drawArg.Handled) { return; } //split the space into three equal parts var rect = args.ClipRectangle; var height = rect.Height / 4; var top = new Rectangle(0, 0, rect.Width, height); var middle = new Rectangle(0, top.Bottom + 1, rect.Width, height * 2); var bottom = new Rectangle(0, middle.Bottom + 1, rect.Width, height); OnDrawDayName(new PaintEventArgs(args.Graphics, top)); OnDrawDayOfMonth(new PaintEventArgs(args.Graphics, middle)); OnDrawMonthAndYear(new PaintEventArgs(args.Graphics, bottom)); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected void RaiseCustomDrawEmptyForeground(CustomDrawEventArgs e) { if (!e.Handled) { //Image img = (System.Drawing.Image)Properties.Resources.ResourceManager.GetObject("Image1.bmp"); Image img = Image.FromFile(@"Resource\Image1.bmp"); RectangleF actualRectF; int actualHeight = e.Bounds.Height - 26; if (e.Bounds.Width < img.Width || actualHeight < img.Height) { // 当前区域小于图片大小,进行缩放。 float factor1 = e.Bounds.Width * 1f / img.Width; float factor2 = actualHeight * 1f / img.Height; float factor = Math.Min(factor1, factor2); float x = (e.Bounds.Width - img.Width * factor) / 2; float y = (e.Bounds.Height - img.Height * factor) + 26 / 2; actualRectF = new RectangleF(x, y, img.Width * factor, img.Height * factor); } else { actualRectF = new RectangleF((e.Bounds.Width - img.Width) / 2f, (actualHeight - img.Height) / 2f + 26, img.Width, img.Height); } e.Graphics.DrawImage(img, actualRectF); e.Handled = true; } // base.RaiseCustomDrawEmptyForeground(e); }
void DrawBackground(TreeListNode node, CustomDrawEventArgs e) { if (hotNode != node && !node.Focused) { return; } SetUpButtonInfoArgs(e); customButtonPainter.DrawObject(args); }
private void DrawNothingToSee(CustomDrawEventArgs e) { if (this.ActiveGridControl.DataSource == null) { Graphics graphics = e.Graphics; Font paintFont = this.PaintFont; Brush gray = Brushes.Gray; Rectangle seeBounds = this.NothingToSeeBounds(e.Bounds); graphics.DrawString("Select a feature layer to examine attribute data.", paintFont, gray, seeBounds.Location); } }
private void gridView1_CustomDrawEmptyForground(object sender, CustomDrawEventArgs e) { ColumnView columnView = sender as ColumnView; ObservableCollection <SFITrackNum> bindingSource = trackNumInfoCollectionView.DataSource as ObservableCollection <SFITrackNum>; if (bindingSource?.Count == 0) { string str = "请调整查询条件获取你所需要的数据"; Font f = new Font("宋体", 10, FontStyle.Bold); Rectangle r = new Rectangle(e.Bounds.Top + 200, e.Bounds.Left + 60, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Red, r); } }
//空数据提醒 private void gv_CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { GridView gv = sender as GridView; DataView bindingSource = gv.DataSource as DataView; if (bindingSource != null && bindingSource.Count == 0) { Font f = new Font("宋体", 10, FontStyle.Bold); Rectangle r = new Rectangle(gv.GridControl.Width / 2 - 100, gv.GridControl.Height / 2, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString("数据为空!", f, Brushes.Red, r); } }
private void gridView1_CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { ColumnView columnView = sender as ColumnView; BindingSource bindingSource = this.gridView1.DataSource as BindingSource; if (bindingSource.Count == 0) { string str = "没有查询到数据!"; Font f = new Font("宋体", 10, FontStyle.Bold); Rectangle r = new Rectangle(e.Bounds.Top + 5, e.Bounds.Left + 5, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Black, r); } }
private void gridViewExamList_CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { var view = (GridView)sender; if (view != null && view.RowCount != 0) { return; } StringFormat drawFormat = new StringFormat(); drawFormat.Alignment = drawFormat.LineAlignment = StringAlignment.Center; e.Graphics.DrawString("Nothing to see here...", e.Appearance.Font, SystemBrushes.ControlDark, new RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), drawFormat); }
private void DrawQuickCustomisationIconCore(CustomDrawEventArgs e, QuickCustomizationIcon icon, Rectangle bounds) { if (icon == null) { return; } ControlPaint.DrawBorder3D(e.Graphics, e.Bounds, Border3DStyle.RaisedInner); if (icon.Image == null) { icon.Image = Resources.Customization; } e.Graphics.PageUnit = GraphicsUnit.Pixel; e.Graphics.DrawImageUnscaled(icon.Image, treeList.ViewInfo.QuickCustomisationBounds); }
protected virtual void OnDrawDayOfMonth(PaintEventArgs args) { var drawArg = new CustomDrawEventArgs(args.ClipRectangle, args.Graphics, false); if (DrawBody != null) { DrawBody(this, drawArg); } if (drawArg.Handled) { return; } Painter.DrawString(args.Graphics, args.ClipRectangle, GetBodyValue(), OneLineNoTrimming, DayFont, Enabled); }
protected virtual void OnDrawMonthAndYear(PaintEventArgs args) { var drawArg = new CustomDrawEventArgs(args.ClipRectangle, args.Graphics, false); if (DrawFooter != null) { DrawFooter(this, drawArg); } if (drawArg.Handled) { return; } Painter.DrawString(args.Graphics, args.ClipRectangle, GetFooterValue(), OneLineNoTrimming, FooterFont, Enabled); }
private void faDayView1_Draw(object sender, CustomDrawEventArgs e) { var dayNumber = faDayView1.DefaultCalendar.GetDayOfYear(faDayView1.ViewDateTime); if (dayNumber == 1) { using (var fmt = new StringFormat()) { fmt.Alignment = StringAlignment.Center; fmt.LineAlignment = StringAlignment.Center; e.Graphics.FillRectangle(Brushes.Red, e.Rectangle); e.Graphics.DrawString("Happy New Year", faDayView1.DayFont, Brushes.Black, e.Rectangle, fmt); } e.Handled = true; } }
private void gridView1_CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { string s = string.Empty; DevExpress.XtraGrid.Views.Base.ColumnView view = sender as DevExpress.XtraGrid.Views.Base.ColumnView; BindingSource dataSource = view.DataSource as BindingSource; if (dataSource == null) { s = "没有数据 QAQ"; } else if (dataSource.Count == 0) { s = "没有找到符合条件的数据 QAQ"; } Font font = new Font("微软雅黑", 10, FontStyle.Bold); Rectangle r = new Rectangle(e.Bounds.Left + 5, e.Bounds.Top + 5, e.Bounds.Width - 5, e.Bounds.Height - 5); e.Graphics.DrawString(s, font, Brushes.Black, r); }
protected override void RaiseCustomDrawEmptyForeground(CustomDrawEventArgs e) { base.RaiseCustomDrawEmptyForeground(e); // https://www.devexpress.com/Support/Center/Question/Details/A557 if (!string.IsNullOrEmpty(EmptyText)) { if (RowCount != 0) { return; } var drawFormat = new StringFormat(); drawFormat.Alignment = drawFormat.LineAlignment = StringAlignment.Center; e.Graphics.DrawString(EmptyText, e.Appearance.Font, SystemBrushes.ControlDark, new RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), drawFormat); } }
private void CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { string noIndexesFoundText = "No indexes found"; string trySearchingAgainText = "Try searching again"; int offset = 15; e.DefaultDraw(); e.Appearance.Options.UseFont = true; e.Appearance.Font = new Font("Tahoma", 12); Size size = e.Appearance.CalcTextSize(e.Cache, noIndexesFoundText, e.Bounds.Width).ToSize(); int x = (e.Bounds.Width - size.Width) / 2; int y = e.Bounds.Y + offset; Rectangle noIndexesFoundBounds = new Rectangle(new Point(x, y), size); e.Appearance.DrawString(e.Cache, noIndexesFoundText, noIndexesFoundBounds); size = e.Appearance.CalcTextSize(e.Cache, trySearchingAgainText, e.Bounds.Width).ToSize(); x = noIndexesFoundBounds.X - (size.Width - noIndexesFoundBounds.Width) / 2; y = noIndexesFoundBounds.Bottom + offset; size.Width += offset; Rectangle trySearchingAgainBounds = new Rectangle(new Point(x, y), size); e.Appearance.DrawString(e.Cache, trySearchingAgainText, trySearchingAgainBounds); }
void DrawBackGround(TreeListNode node, CustomDrawEventArgs e) { if (hotNode != node && !node.Focused) { return; } SimpleButton backButton = new SimpleButton(); Tree.FindForm().Controls.Add(backButton); RowInfo ri = Tree.ViewInfo.RowsInfo[node]; backButton.Bounds = ri.Bounds; Bitmap bm = new Bitmap(backButton.Width, backButton.Height); backButton.DrawToBitmap(bm, new Rectangle(0, 0, bm.Width, bm.Height)); Rectangle rec = Rectangle.Intersect(ri.Bounds, e.Bounds); rec.Offset(-ri.Bounds.X, -ri.Bounds.Y); e.Graphics.DrawImage(bm, e.Bounds, rec, GraphicsUnit.Pixel); Tree.FindForm().Controls.Remove(backButton); }
private void addMessageInEmptyArea(CustomDrawEventArgs e) { gridView.AddMessageInEmptyArea(e, PKSimConstants.Information.NoParameterAvailableForScaling); }
void DrawBackGround(TreeListNode node, CustomDrawEventArgs e) { TreeListNode hotNode = null; if (hotNode != node && !node.Focused) return; SimpleButton button = new SimpleButton(); this.Controls.Add(button); RowInfo ri = treeList1.ViewInfo.RowsInfo[node]; button.Bounds = ri.Bounds; Bitmap bm = new Bitmap(button.Width, button.Height); button.DrawToBitmap(bm, new Rectangle(0, 0, bm.Width, bm.Height)); Rectangle rec = Rectangle.Intersect(ri.Bounds, e.Bounds); rec.Offset(-ri.Bounds.X, -ri.Bounds.Y); e.Graphics.DrawImage(bm, e.Bounds, rec, GraphicsUnit.Pixel); //e.Handled = true; }
private void addMessageInEmptyArea(CustomDrawEventArgs e) { gridView.AddMessageInEmptyArea(e, Captions.ParameterIdentification.MultipleRunsAreBeingCreated); }
void DrawTrySearchingAgain(CustomDrawEventArgs e) { e.Cache.DrawString(TrySearchingAgainText, GetLinkFont(), Brushes.Blue, TrySearchingAgainBounds(e.Bounds), e.Appearance.GetStringFormat()); }
void DrawNoMatchesFound(CustomDrawEventArgs e) { e.Cache.DrawString(NoMatchesFoundText, PaintFont, Brushes.Gray, NoMatchesFoundBounds(e.Bounds), e.Appearance.GetStringFormat()); }
private void OnGridViewDrawEmptyForeground(object sender, CustomDrawEventArgs args) { Utils.DrawRecordNotFoundToForeground(sender, args); }
private void ActiveView_CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { DrawNothingToSee(e); }
private void addMessageInEmptyArea(CustomDrawEventArgs e) { gridView.AddMessageInEmptyArea(e, _presenter.DragAndDropMessage); }
void ActiveView_CustomDrawEmptyForeground(object sender, CustomDrawEventArgs e) { DrawNoMatchesFound(e); DrawTrySearchingAgain(e); }
private void addMessageInEmptyArea(CustomDrawEventArgs e) { gridView.AddMessageInEmptyArea(e, _presenter.EmptySelectionMessage); }
private void SetUpButtonInfoArgs(CustomDrawEventArgs e) { args.Cache = e.Cache; args.Bounds = e.Bounds; args.State = DevExpress.Utils.Drawing.ObjectState.Hot; }