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); }
public static void DrawBackgroundWeekDayCell(long storeid, StoreDay storeday, EmployeeDay epd, GraphicsCache cache, Rectangle rect, long storeworldid, bool bFocused, int? long_absence_color) { Rectangle drawrect = Rectangle.Inflate(rect, 1, 1); if (bFocused) { Pen pen = cache.GetPen (Color.Black ); cache.FillRectangle(Painters.FOCUSED_COLOR , drawrect); cache.DrawRectangle(pen, drawrect); } else { Color color = Color.White; if (storeday.Feast) color = Painters.FEAST_COLOR; if (storeday.ClosedDay) color = Painters.CLOSEDDAY_COLOR ; if (epd.CountDailyAdditionalCharges > 0) color = Painters.ADDITIONAL_CHARGES_COLOR; if (epd.StoreWorldId != storeworldid || epd.HasLongAbsence || !epd.HasRelation || storeid != epd.StoreId) { color = Painters.DISABLE_COLOR; if (epd.HasLongAbsence) { if (long_absence_color.HasValue) color = Color.FromArgb(long_absence_color.Value); } } cache.FillRectangle(color, drawrect); } }
public bool DrawMergedCell(MyMergedCell cell, PaintEventArgs e) { //return true; int delta = cell.Column1.VisibleIndex - cell.Column2.VisibleIndex; if (Math.Abs(delta) > 1) return false; GridViewInfo vi = View.GetViewInfo() as GridViewInfo; GridCellInfo gridCellInfo1 = vi.GetGridCellInfo(cell.RowHandle, cell.Column1.VisibleIndex); GridCellInfo gridCellInfo2 = vi.GetGridCellInfo(cell.RowHandle, cell.Column2.VisibleIndex); if (gridCellInfo1 == null || gridCellInfo2 == null) return false; Rectangle targetRect = Rectangle.Union(gridCellInfo1.Bounds, gridCellInfo2.Bounds); gridCellInfo1.Bounds = targetRect; gridCellInfo1.CellValueRect = targetRect; gridCellInfo2.Bounds = targetRect; gridCellInfo2.CellValueRect = targetRect; if (delta < 0) gridCellInfo1 = gridCellInfo2; Rectangle bounds = gridCellInfo1.ViewInfo.Bounds; bounds.Width = targetRect.Width; bounds.Height = targetRect.Height; gridCellInfo1.ViewInfo.Bounds = bounds; gridCellInfo1.ViewInfo.CalcViewInfo(e.Graphics); IsCustomPainting = true; GraphicsCache cache = new GraphicsCache(e.Graphics); gridCellInfo1.Appearance.FillRectangle(cache, gridCellInfo1.Bounds); DrawRowCell(new GridViewDrawArgs(cache, vi, vi.ViewRects.Bounds), gridCellInfo1); IsCustomPainting = false; return true; }
private void adjustScrollbars() { // Hide scrollbar when not needed. // http://devexpress.com/Support/Center/p/Q96633.aspx // Looking for a Windows Forms solution? // http://stackoverflow.com/questions/73110/how-can-i-show-scrollbars-on-a-system-windows-forms-textbox-only-when-the-text-d var vi = (MemoEditViewInfo)_edit.GetViewInfo(); using (var cache = new GraphicsCache(_edit.CreateGraphics())) { var h = ((IHeightAdaptable)vi).CalcHeight( cache, vi.MaskBoxRect.Width); var args = new ObjectInfoArgs { Bounds = new Rectangle(0, 0, vi.ClientRect.Width, h) }; var rect = vi.BorderPainter.CalcBoundsByClientRectangle(args); _edit.Properties.ScrollBars = rect.Height > _edit.Height ? ScrollBars.Vertical : ScrollBars.None; } }
protected override void OnDraw(GraphicsCache graphics, System.Drawing.RectangleF area) { if (Value != null) { graphics.Graphics.DrawIcon(Value, Rectangle.Round(area)); } }
protected override void OnDraw(GraphicsCache graphics, System.Drawing.RectangleF area) { base.OnDraw(graphics, area); ButtonState state; if (Style == ButtonStyle.Disabled) state = ButtonState.Inactive; else if (Style == ButtonStyle.Pressed) state = ButtonState.Pushed; else if (Style == ButtonStyle.Hot) state = ButtonState.Normal; else state = ButtonState.Normal; ControlPaint.DrawButton(graphics.Graphics, Rectangle.Round(area), state); if (Style == ButtonStyle.NormalDefault) { graphics.Graphics.DrawRectangle(Pens.Black, Rectangle.Round(area)); } if (Style == ButtonStyle.Focus) { using (MeasureHelper measure = new MeasureHelper(graphics)) { ControlPaint.DrawFocusRectangle(graphics.Graphics, Rectangle.Round(GetBackgroundContentRectangle(measure, area))); } } }
public SeparatorComponent() { Line = new LineComponent(2, Color.White); DisplayedSize = 2f; UseSeparatorColor = true; LockToBottom = false; Cache = new GraphicsCache(); }
protected override void OnDraw(GraphicsCache graphics, System.Drawing.RectangleF area) { if (BackColor != Color.Empty) { SolidBrush brush = graphics.BrushsCache.GetBrush(BackColor); graphics.Graphics.FillRectangle(brush, area); } }
public Title() { VerticalHeight = 10; Settings = new TitleSettings(); Cache = new GraphicsCache(); GameNameLabel = new SimpleLabel(); CategoryNameLabel = new SimpleLabel(); AttemptCountLabel = new SimpleLabel(); }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { base.OnDraw(graphics, area); if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(GetBackgroundElement())) GetRenderer(GetBackgroundElement()).DrawBackground(graphics.Graphics, Rectangle.Round(area)); else mStandardHeader.Draw(graphics, area); }
public LoadTimer(LiveSplitState state) { Formatter = new PossibleTimeSaveFormatter(); InternalComponent = new InfoTimeComponent(null, null, Formatter); Cache = new GraphicsCache(); Settings = new AlternateTimingMethodSettings() { CurrentState = state }; }
public static void DrawCell(long storeid, IRecordingContext context, EmployeeDay epd, GraphicsCache cache, Rectangle rect, bool bFocused) { if (context == null) return; if (epd == null) return; if (cache == null) return; StoreDay sd = context.StoreDays[epd.Date]; DrawBackgroundWeekDayCell(storeid,sd, epd, cache, rect, context.StoreWorldId, bFocused, context.LongAbsences.GetColor (epd.LongAbsenceId )); DrawWeekDayContent(sd, epd, cache, rect, context); }
public override void Draw(GraphicsCache graphics, RectangleF area) { if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(GetBackgroundElement())) { if (BorderStyle == BorderStyle.System) GetRenderer(GetBackgroundElement()).DrawBackground(graphics.Graphics, Rectangle.Round(area)); } else mStandard.Draw(graphics, area); }
public GraphComponent (GraphSettings settings) { GraphEdgeValue = new TimeSpan(0, 0, 0, 0, 200); GraphEdgeMin = 5; Settings = settings; Cache = new GraphicsCache(); Deltas = new List<TimeSpan?>(); FinalSplit = TimeSpan.Zero; MaxDelta = TimeSpan.Zero; MinDelta = TimeSpan.Zero; }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { // base.OnDraw(graphics, area); //Don't call the base method because this class draw the class in a different way if (Value == null || Value.Length == 0) return; if (Enabled) System.Windows.Forms.TextRenderer.DrawText(graphics.Graphics, Value, Font, Rectangle.Round(area), ForeColor, TextFormatFlags); else System.Windows.Forms.TextRenderer.DrawText(graphics.Graphics, Value, Font, Rectangle.Round(area), Color.FromKnownColor(KnownColor.GrayText), TextFormatFlags); }
public LabelsComponent(SplitsSettings settings, IEnumerable<ColumnData> columns) { Settings = settings; MinimumHeight = 31; MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); Cache = new GraphicsCache(); LabelsList = new List<SimpleLabel>(); ColumnsList = columns; }
public CounterComponent(LiveSplitState state) { VerticalHeight = 10; Settings = new CounterComponentSettings(); Cache = new GraphicsCache(); CounterNameLabel = new SimpleLabel(); Counter = new Counter(); this.state = state; Settings.CounterReinitialiseRequired += Settings_CounterReinitialiseRequired; Settings.IncrementUpdateRequired += Settings_IncrementUpdateRequired; // Subscribe to input hooks. Settings.Hook.KeyOrButtonPressed += hook_KeyOrButtonPressed; }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { //base.OnDrawContent(graphics, area); //Don't call the base method because this class draw the class in a different way if (Value == null || Value.Length == 0) return; SolidBrush brush; if (Enabled) brush = graphics.BrushsCache.GetBrush(ForeColor); else brush = graphics.BrushsCache.GetBrush(Color.FromKnownColor(KnownColor.GrayText)); graphics.Graphics.DrawString(Value, Font, brush, area, StringFormat); }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(GetBackgroundElement())) { GetRenderer(GetBackgroundElement()).DrawBackground(graphics.Graphics, Rectangle.Round(area)); if (Style == ButtonStyle.Focus) { using (MeasureHelper measure = new MeasureHelper(graphics)) { ControlPaint.DrawFocusRectangle(graphics.Graphics, Rectangle.Round(area)); } } } else mStandardButton.Draw(graphics, area); }
public InfoTextComponent(string informationName, string informationValue) { Cache = new GraphicsCache(); NameLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, Text = informationName }; ValueLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Far, Text = informationValue }; NameMeasureLabel = new SimpleLabel(); VerticalHeight = 31; LongestString = ""; }
protected override void OnDraw(GraphicsCache graphics, System.Drawing.RectangleF area) { if (SortStyle != HeaderSortStyle.None && Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(GetSortElement())) { Rectangle sortArea = Rectangle.Round(area); VisualStyleRenderer renderer = GetRenderer(GetSortElement()); Size sortSize = renderer.GetPartSize(graphics.Graphics, sortArea, ThemeSizeType.Draw); sortArea = new Rectangle(sortArea.Right - sortSize.Width, sortArea.Top, sortSize.Width, sortSize.Height); renderer.DrawBackground(graphics.Graphics, sortArea); } else { base.OnDraw(graphics, area); } }
protected override void OnDraw(GraphicsCache graphics, System.Drawing.RectangleF area) { if (Value != null) { if (Enabled) { graphics.Graphics.DrawImage(Value, Rectangle.Round(area)); //Note: If I don't make the Rectangle.Round sometimes the image is drawed with a strange stretch (not clear). Probably this problem is caused by some rounding in the drawing code that use the float overload } else { using (System.Drawing.Image imgDisabled = Utilities.CreateDisabledImage(Value, Color.White)) { graphics.Graphics.DrawImage(imgDisabled, area); } } } }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { ButtonState state; if (Style == ControlDrawStyle.Disabled) state = ButtonState.Inactive; else if (Style == ControlDrawStyle.Pressed) state = ButtonState.Pushed; else if (Style == ControlDrawStyle.Hot) state = ButtonState.Normal; else state = ButtonState.Normal; if (CheckBoxState == CheckBoxState.Checked) state |= ButtonState.Checked; ControlPaint.DrawCheckBox(graphics.Graphics, Rectangle.Round(area), state); }
public SplitComponent(SplitsSettings settings, IEnumerable<ColumnData> columnsList) { NameLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, X = 8, }; MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); Settings = settings; ColumnsList = columnsList; TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); MinimumHeight = 31; NeedUpdateAll = true; IsActive = false; Cache = new GraphicsCache(); LabelsList = new List<SimpleLabel>(); }
public DetailedTimer(LiveSplitState state) { InternalComponent = new LiveSplit.UI.Components.Timer() { DeathsLabelVisible = false }; SegmentTimer = new SegmentTimer() { DeathsLabelVisible = false }; Settings = new DetailedTimerSettings() { CurrentState = state }; IconWidth = 0; Cache = new GraphicsCache(); LabelSegment = new SimpleLabel(); LabelBest = new SimpleLabel(); SegmentTime = new SimpleLabel(); BestSegmentTime = new SimpleLabel(); SplitName = new SimpleLabel(); state.ComparisonRenamed += state_ComparisonRenamed; }
public void DrawButton(PaintEventArgs args, ObjectState state) { using (GraphicsCache cache = new GraphicsCache(args)) { SkinElement element = CommonSkins.GetSkin(UserLookAndFeel.Default)[CommonSkins.SkinButton]; SkinElementInfo info = new SkinElementInfo(element, ButtonRectangle); if (state == ObjectState.Normal) { info.ImageIndex = 0; } if (state == ObjectState.Hot) { info.ImageIndex = 1; } if (state == ObjectState.Pressed) { info.ImageIndex = 2; } DrawSkinImage(cache, info); DrawText(cache); DrawImage(cache); } }
private Cursor GetDragCursor(int rowHandle, Point e) { var info = (GridViewInfo)_view.GetViewInfo(); var rowInfo = info.GetGridRowInfo(rowHandle); var imageBounds = new Rectangle(new Point(0, 0), rowInfo.TotalBounds.Size); var totalBounds = new Rectangle(new Point(0, 0), info.Bounds.Size); //Grid using (var bitmap = new Bitmap(totalBounds.Width, totalBounds.Height)) using (var gridBitmap = new Bitmap(totalBounds.Width, totalBounds.Height)) using (var cache = new GraphicsCache(Graphics.FromImage(bitmap))) using (var result = new Bitmap(imageBounds.Width, imageBounds.Height)) using (var resultGraphics = Graphics.FromImage(result)) using (var imageAttributes = new ImageAttributes()) { _view.GridControl.DrawToBitmap(gridBitmap, _view.GridControl.Bounds); var args = new GridViewDrawArgs(cache, info, totalBounds); DrawRow(args, rowInfo); float[][] matrixItems = { new float[] { 1, 0, 0, 0, 0 }, new float[] { 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0 }, new[] { 0, 0, 0, 0.7f, 0 }, new float[] { 0, 0, 0, 0, 1 } }; var colorMatrix = new ColorMatrix(matrixItems); imageAttributes.SetColorMatrix( colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); resultGraphics.DrawImage(gridBitmap, imageBounds, rowInfo.TotalBounds.X, rowInfo.TotalBounds.Y + _rowVerticalOffset, rowInfo.TotalBounds.Width, rowInfo.TotalBounds.Height, GraphicsUnit.Pixel, imageAttributes); var offset = new Point(e.X - rowInfo.TotalBounds.X, e.Y - rowInfo.TotalBounds.Y); return(CreateCursor(result, offset)); } }
int IHeightAdaptable.CalcHeight(GraphicsCache cache, int width) { width -= ((MyRepositoryItemMemoEdit)Item).ContentImageSize.Width; BorderObjectInfoArgs info = new BorderObjectInfoArgs(cache); info.Bounds = new Rectangle(0, 0, width, 100); Rectangle textRect = BorderPainter.GetObjectClientRectangle(info); if (!(BorderPainter is EmptyBorderPainter) && !(BorderPainter is InplaceBorderPainter)) { textRect.Inflate(-1, -1); } string text = string.Empty; if (Item.LinesCount == 0) { text = DisplayText; if (text != null && text.Length > 0) { char lastChar = text[text.Length - 1]; if (lastChar == 13 || lastChar == 10) { text += "W"; } } } else { for (int i = 0; i < Item.LinesCount; i++) { text += (string.IsNullOrEmpty(text) ? "" : Environment.NewLine) + "W"; } } int height1 = CalcTextSizeCore(cache, text, textRect.Width).Height + 1; return((height1 + 100 - textRect.Bottom) + 1); }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { base.OnDraw(graphics, area); if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(GetBackgroundElement())) GetRenderer(GetBackgroundElement()).DrawBackground(graphics.Graphics, Rectangle.Round(area)); else { if (RotateColHeaderIfNotDefined) { //Swap Height and Width to rotate the bitmap (note I can't use the Graphics transformation matrix because the theme are drawed without using GDI+ I think and the trasformation matrix has no effect) Bitmap bmpBuffer = new Bitmap((int)area.Height, (int)area.Width); Graphics bmpGraphics = Graphics.FromImage(bmpBuffer); try { Rectangle bmpRect = new Rectangle(0, 0, (int)area.Height, (int)area.Width); using (GraphicsCache cache = new GraphicsCache(bmpGraphics)) { mColHeaderThemed.Draw(cache, bmpRect); } bmpBuffer.RotateFlip(RotateFlipType.Rotate270FlipY); graphics.Graphics.DrawImage(bmpBuffer, area); } finally { bmpGraphics.Dispose(); bmpBuffer.Dispose(); } } else { mStandardRowHeader.Draw(graphics, area); } } }
///<summary>Gets the tooltip associated with a point in the control.</summary> protected override ToolTipControlInfo GetToolTipObjectInfoCore(GraphicsCache cache, Point p) { var baseInfo = base.GetToolTipObjectInfoCore(cache, p); if (baseInfo != null) { return(baseInfo); } var ht = GetHintObjectInfo() as GridHitInfo; if (ht == null) { return(null); } var args = new CustomToolTipEventArgs(ht); if (ht.InRowCell) { var column = ht.Column as SmartGridColumn; if (column != null && column.Controller != null) { args.SuperTip = column.Controller.GetCellToolTip(GetRow(ht.RowHandle), GetRowCellValue(ht.RowHandle, column)); } } OnCustomSuperTip(args); if (args.SuperTip != null) { return new ToolTipControlInfo() { SuperTip = args.SuperTip } } ; return(null); }
public SourceSplitComponent(LiveSplitState state) { this.Settings = new SourceSplitSettings(); this.InternalComponent = new InfoTimeComponent("Game Time", null, new RegularTimeFormatter(TimeAccuracy.Hundredths)); this.ContextMenuControls = new Dictionary <String, Action>(); this.ContextMenuControls.Add("SourceSplit: Map Times", () => { if (_mapTimesForm.Visible) { _mapTimesForm.Hide(); } else { _mapTimesForm.Show(); } }); _cache = new GraphicsCache(); _timer = new TimerModel { CurrentState = state }; state.OnSplit += state_OnSplit; state.OnReset += state_OnReset; state.OnStart += state_OnStart; _state = state; _mapTimes = new List <MapTime>(); _mapsVisited = new List <string>(); _mapTimesForm = new MapTimesForm(); _gameMemory = new GameMemory(this.Settings); _gameMemory.OnSignOnStateChange += gameMemory_OnSignOnStateChange; _gameMemory.OnGameTimeUpdate += gameMemory_OnGameTimeUpdate; _gameMemory.StartReading(); }
protected override Rectangle CalcButtons(GraphicsCache cache) { bool autoFit = Item.TextEditStyle == TextEditStyles.HideTextEditor; EditorButtonCollection inpButtons = new EditorButtonCollection(); if (this.OwnerEdit != null) { inpButtons = Item.Buttons; } else { inpButtons = ButtonsFromEditValue(); //LeftButtons.Clear(); } for (int n = 0; n < inpButtons.Count; n++) { EditorButton btn = inpButtons[n]; if (!btn.Visible) { continue; } EditorButtonObjectInfoArgs info = CreateButtonInfo(btn, n); info.FillBackground = FillBackground; CalcButtonState(info, n); info.Cache = cache; LeftButtons.Add(info); } CustomCalc targs = CreateCustomCalcButtonsRectsArgs(ClientRect); targs.UseAutoFit = false; targs.ViewInfo = this; targs.Calc(); RightButtons.SetCache(null); LeftButtons.SetCache(null); return(targs.ClientRect); }
void CustomDrawAppointmentFlyoutSubject(Appointment appointment, AppointmentBandDrawerViewInfoBase viewInfo) { GraphicsCache cache = viewInfo.Cache; StringFormat stringFormat = new StringFormat(viewInfo.View.Appearance.GetStringFormat()); stringFormat.Alignment = stringFormat.LineAlignment = StringAlignment.Center; try { // Draw status Rectangle statusRect = GetStatusBounds(viewInfo); cache.FillRectangle(viewInfo.View.Status.GetBrush(), statusRect); if (viewInfo.View.Status.Type == AppointmentStatusType.Free) { // Draw a warning cache.DrawImage(GetWarningIcon(new Size(statusRect.Height, statusRect.Height)), statusRect.Location); cache.DrawString("Status is unacceptable", fontStorage.StatusFont, Brushes.Red, statusRect, stringFormat); } // Draw subject cache.DrawString(appointment.Subject, fontStorage.SubjectFont, Brushes.Black, GetSubjectBounds(viewInfo), stringFormat); } finally { stringFormat.Dispose(); } }
int IHeightAdaptable.CalcHeight(GraphicsCache cache, int width) { Rectangle textRect = new Rectangle(0, 0, width, 100); if (!(BorderPainter is EmptyBorderPainter) && !(BorderPainter is InplaceBorderPainter)) { textRect.Inflate(-1, -1); } string text = string.Empty; { text = DisplayText; if (text != null && text.Length > 0) { char lastChar = text[text.Length - 1]; if (lastChar == 13 || lastChar == 10) { text += "W"; } } } int height = CalcTextSizeCore(cache, text, textRect.Width).Height + 1; return((height + 100 - textRect.Bottom) + 1); }
protected override void OnDraw(GraphicsCache graphics, System.Drawing.RectangleF area) { ButtonState state; if (Style == ButtonStyle.Disabled) { state = ButtonState.Inactive; } else if (Style == ButtonStyle.Pressed) { state = ButtonState.Pushed; } else if (Style == ButtonStyle.Hot) { state = ButtonState.Normal; } else { state = ButtonState.Normal; } ControlPaint.DrawComboButton(graphics.Graphics, Rectangle.Round(area), state); if (Style == ButtonStyle.NormalDefault) { graphics.Graphics.DrawRectangle(Pens.Black, Rectangle.Round(area)); } if (Style == ButtonStyle.Focus) { using (MeasureHelper measure = new MeasureHelper(graphics)) { ControlPaint.DrawFocusRectangle(graphics.Graphics, Rectangle.Round(area)); } } }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { base.OnDraw(graphics, area); if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(GetBackgroundElement())) { GetRenderer(GetBackgroundElement()).DrawBackground(graphics.Graphics, Rectangle.Round(area)); if (Style == ButtonStyle.Focus) { using (MeasureHelper measure = new MeasureHelper(graphics)) { //[email protected]: With the default implementation it was seen that the ractangle is not drawn at the desired location. //Inorder to correct that we provide an overridable method which can make minor adjustments to area RectangleF focusRectangle = GetFocusRectangle(measure, area); ControlPaint.DrawFocusRectangle(graphics.Graphics, Rectangle.Round(focusRectangle)); } } } else { mStandardButton.Draw(graphics, area); } }
public void Draw(GraphicsCache cache, AnyControlEditViewInfo viewInfo){}
/// <summary> /// Draw actual picture /// </summary> protected virtual void DrawImage(GraphicsCache graphics, RectangleF area, Bitmap bmp) { bmp.MakeTransparent(Color.White); bmp.RotateFlip(RotateFlipType); graphics.Graphics.DrawImage(bmp, area); }
///<summary>Gets the tooltip associated with a point in the control.</summary> protected override ToolTipControlInfo GetToolTipObjectInfoCore(GraphicsCache cache, Point p) { var baseInfo = base.GetToolTipObjectInfoCore(cache, p); if (baseInfo != null) return baseInfo; var ht = GetHintObjectInfo() as GridHitInfo; if (ht == null) return null; var args = new CustomToolTipEventArgs(ht); if (ht.InRowCell) { var column = ht.Column as SmartGridColumn; if (column != null && column.Controller != null) args.SuperTip = column.Controller.GetCellToolTip(GetRow(ht.RowHandle), GetRowCellValue(ht.RowHandle, column)); } OnCustomSuperTip(args); if (args.SuperTip != null) return new ToolTipControlInfo() { SuperTip = args.SuperTip }; return null; }
public HotkeyIndicator() { Line = new LineComponent(3, Color.White); Cache = new GraphicsCache(); Settings = new HotkeyIndicatorSettings(); }
private void FillRectangle(AppearanceObject appearance, GraphicsCache cache, Rectangle rect) { appearance.FillRectangle(cache, rect); }
/// <summary> /// Draw the current VisualElement in the specified Graphics object. /// Usually derived class don't override this method but the OnDraw method that automatically check the area to draw. /// </summary> /// <param name="graphics"></param> /// <param name="area"></param> public void Draw(GraphicsCache graphics, System.Drawing.RectangleF area) { RectangleF drawArea; Draw(graphics, area, out drawArea); }
public ThinSeparatorComponent() { Line = new LineComponent(1, Color.White); Cache = new GraphicsCache(); }
void IDiagramItemView.Draw(GraphicsCache cache, DiagramItemDrawArgs args) { base.Draw(cache, args); cache.Graphics.DrawImage(Shape.Image, TextBounds); }
public DevicePipelineStateCache(GraphicsDevice graphicsDevice) { EffectProgramCache = new GraphicsCache <Tuple <EffectBytecode, bool>, EffectBytecode, EffectProgram>(source => source.Item1, source => new EffectProgram(graphicsDevice, source.Item1, source.Item2)); VertexAttribsCache = new GraphicsCache <VertexAttrib[], VertexAttribsKey, VertexAttrib[]>(source => new VertexAttribsKey(source), source => source); }
protected virtual void OnDrawBorder(GraphicsCache graphics, RectangleF area) { //[email protected]: as the IBorder Draw method was changed to add the //part of border which needs to be drawn. Change needs to be reflected here as well mBorder.Draw(graphics, area, BorderPartType.All); }
public int GetTextWidth(GraphicsCache cache, GridColumn column, string text) { return(column.AppearanceHeader.CalcTextSizeInt(cache, text, column.VisibleWidth).Width); }
public GraphSeparatorComponent(GraphSettings settings) { Line = new LineComponent(1, Color.White); Settings = settings; Cache = new GraphicsCache(); }
protected override void PrintRow(GraphicsCache cache, IBrickGraphics graph, int rowHandle, int level) { _graph = graph; base.PrintRow(cache, graph, rowHandle, level); }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { }
public void Draw(GraphicsCache cache, Rectangle bounds) { PointF pt = ViewInfo.CalcProgressLabelPoint(cache, bounds); cache.Graphics.DrawString(ViewInfo.Text, ViewInfo.ProgressLabelFont, ViewInfo.Brush, pt); }
protected override void PrintRow(GraphicsCache cache, IBrickGraphics graph, int rowHandle, int level) { base.PrintRow(cache, graph, rowHandle, level); PrintRowIndicator(graph, rowHandle); }
public PointF CalcProgressLabelPoint(GraphicsCache cache, Rectangle bounds) { Size size = TextUtils.GetStringSize(cache.Graphics, Text, ProgressLabelFont); return(new Point(bounds.Width / 2 - size.Width / 2, bounds.Height - 40)); }
protected virtual void OnDrawBorder(GraphicsCache graphics, RectangleF area) { mBorder.Draw(graphics, area); }
/// <summary> /// Method used to draw the specified content based on the Visual element. /// This is the method that you must override to draw. The area used is already calculated based on the AnchorArea property. /// </summary> /// <param name="graphics"></param> /// <param name="area"></param> protected abstract void OnDraw(GraphicsCache graphics, System.Drawing.RectangleF area);
public CustomViewDrawArgs(GraphicsCache graphicsCache, CustomViewInfo viewInfo, Rectangle bounds) : base(graphicsCache, viewInfo, bounds) { }
private Cursor GetDragCursor(int rowHandle, Point e) { var info = (GridViewInfo)_view.GetViewInfo(); var rowInfo = info.GetGridRowInfo(rowHandle); var imageBounds = new Rectangle(new Point(0, 0), rowInfo.TotalBounds.Size); var totalBounds = new Rectangle(new Point(0, 0), info.Bounds.Size); //Grid using (var bitmap = new Bitmap(totalBounds.Width, totalBounds.Height)) using (var gridBitmap = new Bitmap(totalBounds.Width, totalBounds.Height)) using (var cache = new GraphicsCache(Graphics.FromImage(bitmap))) using (var result = new Bitmap(imageBounds.Width, imageBounds.Height)) using (var resultGraphics = Graphics.FromImage(result)) using (var imageAttributes = new ImageAttributes()) { _view.GridControl.DrawToBitmap(gridBitmap, _view.GridControl.Bounds); var args = new GridViewDrawArgs(cache, info, totalBounds); DrawRow(args, rowInfo); float[][] matrixItems = { new float[] { 1, 0, 0, 0, 0 }, new float[] { 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0 }, new[] { 0, 0, 0, 0.7f, 0 }, new float[] { 0, 0, 0, 0, 1 } }; var colorMatrix = new ColorMatrix(matrixItems); imageAttributes.SetColorMatrix( colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); resultGraphics.DrawImage(gridBitmap, imageBounds, rowInfo.TotalBounds.X, rowInfo.TotalBounds.Y + _rowVerticalOffset, rowInfo.TotalBounds.Width, rowInfo.TotalBounds.Height, GraphicsUnit.Pixel, imageAttributes); var offset = new Point(e.X - rowInfo.TotalBounds.X, e.Y - rowInfo.TotalBounds.Y); return CreateCursor(result, offset); } }
protected override void OnDraw(GraphicsCache graphics, RectangleF area) { base.OnDraw(graphics, area); mBackground.Draw(graphics, area); }