private void InitLayout() { this.padding1 = new Padding(0.0, 1.0 / 6.0); this.Children.Add(this.padding1); this.padding5 = new Padding(0.0, 1.0 - (1.0 - 0.01) * (1.0 - 0.02)); this.padding1.Children.Add(this.padding5); this.box1 = new Box(Direction.Vertical); this.padding5.Children.Add(this.box1); this.adapter1 = new Adapter(Direction.Horizontal); this.box1.Children.Add(this.adapter1); this.box2 = new Box(Direction.Horizontal); this.adapter1.Children.Add(this.box2); this.padding2 = new Padding(0.06, 0.04); this.box2.Children.Add(this.padding2); this.graveyardPlaceholder = new CardPlaceholderWidget(); this.padding2.Children.Add(this.graveyardPlaceholder); this.padding3 = new Padding(0.06, 0.04); this.box2.Children.Add(this.padding3); this.overlay1 = new Overlay(); this.padding3.Children.Add(this.overlay1); this.deckPlaceholder = new CardPlaceholderWidget(); this.overlay1.Children.Add(this.deckPlaceholder); this.padding4 = new Padding(0.02, 0.04); this.box1.Children.Add(this.padding4); this.solidColor1 = new SolidColor(); this.solidColor1.Color = new Cairo.Color(0.25, 0.25, 0.25, 0.3); this.padding4.Children.Add(this.solidColor1); this.selectionPlaceholder = new GeneralPlaceholderWidget(); this.solidColor1.Children.Add(this.selectionPlaceholder); }
/// <summary> /// Draw rich text at specified area. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="bounds">Target area to draw rich text.</param> internal void Draw(IGraphics g, Rectangle bounds) { RGFloat x = bounds.Left + 2; RGFloat y = bounds.Top + 2; if (!this.Overflow) { g.PushClip(bounds); } switch (this.VerticalAlignment) { default: case ReoGridVerAlign.General: case ReoGridVerAlign.Bottom: y += (bounds.Height - this.measuredSize.Height) - 6; break; case ReoGridVerAlign.Middle: y += (bounds.Height - this.measuredSize.Height) / 2 - 2; break; case ReoGridVerAlign.Top: y++; break; } Run lastRun = null; RGBrush lastBrush = null; SolidColor lastColor = SolidColor.Transparent; #if DEBUG1 g.DrawRectangle(System.Drawing.Pens.DarkRed, x, y, x + measuredSize.Width, y + measuredSize.Height); #endif // DEBUG foreach (var p in this.paragraphs) { foreach (var l in p.lines) { #if DEBUG //g.DrawRectangle(System.Drawing.Pens.Blue, x, y + l.leftTop.Y, l.Width, l.Height); #endif // DEBUG foreach (var b in l.boxes) { var r = b.Run; if (lastRun != r) { SolidColor textColor = r.TextColor; if (textColor.IsTransparent) { textColor = this.DefaultTextColor; } if (textColor != lastColor || lastBrush == null) { lastColor = textColor; #if WINFORM || ANDROID if (lastBrush != null) { lastBrush.Dispose(); } #endif // WINFORM lastBrush = new RGBrush(lastColor); } lastRun = r; } #if DEBUG //RGFloat baseLine = l.Top + l.Ascent; //g.DrawLine(System.Drawing.Pens.Blue, b.Left + 1, baseLine, b.Right - 1, baseLine); #endif // DEBUG if ((r.FontStyles & FontStyles.Underline) == FontStyles.Underline) { #if WINFORM using (var underlinePen = new RGPen(lastBrush.Color)) #elif WPF var underlinePen = new RGPen(new RGBrush(lastBrush.Color), 1); #endif // WPF { //RGFloat underlineTop = l.leftTop.Y + l.Ascent + y + 2; //g.PlatformGraphics.DrawLine(underlinePen, new Point(b.leftTop.X + x, underlineTop), new Point(b.rightBottom.X + x, underlineTop)); } } var tx = b.leftTop.X + x; var ty = b.leftTop.Y + y; #if WINFORM || ANDROID g.PlatformGraphics.DrawString(b.Str, b.FontInfo.Font, lastBrush, tx, ty, this.sf); #elif WPF var gr = new System.Windows.Media.GlyphRun(b.FontInfo.GlyphTypeface, 0, false, r.FontSize * 1.33d, new ushort[] { b.GlyphIndex }, new System.Windows.Point(tx, ty), new double[] { b.Width }, null, null, null, null, null, null); g.PlatformGraphics.DrawGlyphRun(lastBrush, gr); #endif // WPF } } //y += p.TextSize.Height + this.paragraphSpacing; } if (!this.Overflow) { g.PopClip(); } }
public void BeginCappedLine(LineCapStyles startCap, Size startSize, LineCapStyles endCap, Size endSize, SolidColor color) { }
public RGPen GetPen(SolidColor color) { return(GetPen(color, 1, RGDashStyles.Solid)); }
/// <summary> /// Create progress cell body. /// </summary> public ProgressCell() { TopColor = SolidColor.LightSkyBlue; BottomColor = SolidColor.SkyBlue; }
public static SolidColor DarkDarkDarkColor(SolidColor color) { return(ChangeColorBrightness(color, -0.3f)); }
public RGPen GetPen(SolidColor color) { throw new NotImplementedException(); }
public void DrawRunningFocusRect(RGFloat x, RGFloat y, RGFloat w, RGFloat h, SolidColor color, int runningOffset) { throw new NotImplementedException(); }
public void FillRectangle(HatchStyles style, SolidColor hatchColor, SolidColor bgColor, float x, float y, float width, float height) { this.g.FillRectangle(this.resourceManager.GetHatchBrush((HatchStyle)style, hatchColor, bgColor), x, y, width, height); }
public void FillRectangle(HatchStyles style, SolidColor hatchColor, SolidColor bgColor, Rectangle rect) { this.g.FillRectangle(this.resourceManager.GetHatchBrush((HatchStyle)style, hatchColor, bgColor), rect); }
public void DrawRectangle(Rectangle rect, SolidColor color, float width, LineStyles lineStyle) { var p = this.resourceManager.GetPen(color, width, ToGDILineStyle(lineStyle)); this.g.DrawRectangle(p, rect.X, rect.Y, rect.Width, rect.Height); }
public Brush GetBrush(SolidColor color) { return(this.resourceManager.GetBrush(color)); }
public Pen GetPen(SolidColor color) { return(this.resourceManager.GetPen(color)); }
public void DrawLeadHeadArrow(Graphics.Rectangle bounds, SolidColor startColor, SolidColor endColor) { using (System.Drawing.Drawing2D.GraphicsPath leadHeadPath = new System.Drawing.Drawing2D.GraphicsPath()) { leadHeadPath.AddLines(new System.Drawing.PointF[] { new Point(bounds.Right - 4, bounds.Y + 4), new Point(bounds.Right - 4, bounds.Bottom - 4), new Point(bounds.Right - bounds.Height + 4, bounds.Bottom - 4) }); leadHeadPath.CloseAllFigures(); using (System.Drawing.Drawing2D.LinearGradientBrush lgb = new System.Drawing.Drawing2D.LinearGradientBrush(bounds, startColor, endColor, 90f)) { base.PlatformGraphics.FillPath(lgb, leadHeadPath); } } }
public void ChangeBackgroundColor(SolidColor color) { this.canvas.Background = new SolidColorBrush(color); }
/// <summary> /// Construct control appearance with two theme colors /// </summary> /// <param name="mainTheme">Main theme color</param> /// <param name="salientTheme">Salient theme color</param> /// <param name="useSystemHighlight">Whether use highlight colors of system default</param> public ControlAppearanceStyle(SolidColor mainTheme, SolidColor salientTheme, bool useSystemHighlight) { SolidColor lightMainTheme = ColorUtility.LightColor(mainTheme); SolidColor lightLightMainTheme = ColorUtility.LightLightColor(mainTheme); SolidColor lightLightLightMainTheme = ColorUtility.LightLightLightColor(mainTheme); SolidColor darkMainTheme = ColorUtility.DarkColor(mainTheme); SolidColor darkDarkMainTheme = ColorUtility.DarkDarkColor(mainTheme); SolidColor lightSalientTheme = ColorUtility.LightColor(salientTheme); SolidColor lightLightSalientTheme = ColorUtility.LightLightColor(salientTheme); SolidColor lightLightLightSalientTheme = ColorUtility.LightLightLightColor(salientTheme); SolidColor darkSalientTheme = ColorUtility.DarkColor(salientTheme); SolidColor darkDarkSalientTheme = ColorUtility.DarkDarkColor(salientTheme); var backgroundColor = ColorUtility.ChangeColorBrightness(mainTheme, 0.5f); SolidColor leadHead = mainTheme; colors[ControlAppearanceColors.LeadHeadNormal] = leadHead; colors[ControlAppearanceColors.LeadHeadSelected] = darkMainTheme; colors[ControlAppearanceColors.LeadHeadIndicatorStart] = lightLightLightSalientTheme; colors[ControlAppearanceColors.LeadHeadIndicatorEnd] = lightLightSalientTheme; colors[ControlAppearanceColors.ColHeadSplitter] = mainTheme; colors[ControlAppearanceColors.ColHeadNormalStart] = lightLightLightMainTheme; colors[ControlAppearanceColors.ColHeadNormalEnd] = mainTheme; colors[ControlAppearanceColors.ColHeadSelectedStart] = lightLightLightSalientTheme; colors[ControlAppearanceColors.ColHeadSelectedEnd] = salientTheme; colors[ControlAppearanceColors.ColHeadFullSelectedStart] = lightLightLightSalientTheme; colors[ControlAppearanceColors.ColHeadFullSelectedEnd] = lightLightSalientTheme; colors[ControlAppearanceColors.ColHeadText] = darkDarkMainTheme; colors[ControlAppearanceColors.RowHeadSplitter] = mainTheme; colors[ControlAppearanceColors.RowHeadNormal] = lightLightMainTheme; colors[ControlAppearanceColors.RowHeadHover] = ColorUtility.DarkColor(leadHead); colors[ControlAppearanceColors.RowHeadSelected] = lightSalientTheme; colors[ControlAppearanceColors.RowHeadFullSelected] = lightLightSalientTheme; colors[ControlAppearanceColors.RowHeadText] = darkDarkMainTheme; if (useSystemHighlight) { colors[ControlAppearanceColors.SelectionFill] = new SolidColor(30, StaticResources.SystemColor_Highlight); colors[ControlAppearanceColors.SelectionBorder] = new SolidColor(180, StaticResources.SystemColor_Highlight); } else { colors[ControlAppearanceColors.SelectionFill] = ColorUtility.FromAlphaColor(30, darkSalientTheme); colors[ControlAppearanceColors.SelectionBorder] = ColorUtility.FromAlphaColor(180, lightSalientTheme); } colors[ControlAppearanceColors.GridBackground] = backgroundColor; colors[ControlAppearanceColors.GridLine] = ColorUtility.ChangeColorBrightness(mainTheme, 0.4f); colors[ControlAppearanceColors.GridText] = StaticResources.SystemColor_WindowText; colors[ControlAppearanceColors.OutlineButtonBorder] = mainTheme; colors[ControlAppearanceColors.OutlinePanelBackground] = lightLightMainTheme; colors[ControlAppearanceColors.OutlinePanelBorder] = mainTheme; colors[ControlAppearanceColors.OutlineButtonText] = darkSalientTheme; colors[ControlAppearanceColors.SheetTabBackground] = lightLightMainTheme; colors[ControlAppearanceColors.SheetTabText] = StaticResources.SystemColor_WindowText; colors[ControlAppearanceColors.SheetTabBorder] = mainTheme; colors[ControlAppearanceColors.SheetTabSelected] = backgroundColor; this.SelectionBorderWidth = 3; }
public void DrawLeadHeadArrow(Rectangle bounds, SolidColor startColor, SolidColor endColor) { throw new NotImplementedException(); }
public void FillRectangle(HatchStyle style, SolidColor hatchColor, SolidColor bgColor, Rectangle rect) { this.FillRectangle(style, hatchColor, bgColor, rect.X, rect.Y, rect.Width, rect.Height); }
public RGBrush GetBrush(SolidColor color) { throw new NotImplementedException(); }
public void FillRectangle(HatchStyle style, SolidColor hatchColor, SolidColor bgColor, float x, float y, float width, float height) { System.Drawing.Drawing2D.HatchBrush hb = this.resourceManager.GetHatchBrush(style, hatchColor, bgColor); this.g.FillRectangle(hb, x, y, width, height); }
public static SolidColor LightLightLightColor(SolidColor color) { return(ChangeColorBrightness(color, 0.3f)); }
public void DrawAndFillRectangle(Rectangle rect, SolidColor lineColor, IColor fillColor) { FillRectangle(rect, fillColor); DrawRectangle(rect, lineColor); }
public static SolidColor FromAlphaColor(byte alpha, SolidColor color) { return(new SolidColor(alpha, color.R, color.G, color.B)); }
public void DrawAndFillRectangle(Rectangle rect, SolidColor lineColor, IColor fillColor, float weight, LineStyles lineStyle) { FillRectangle(rect, fillColor); DrawRectangle(rect, lineColor, weight, lineStyle); }
public HatchStyleBrushInfo(HatchStyle style, SolidColor foreColor, SolidColor backgroundColor) { this.style = style; this.foreColor = foreColor; this.backgroundColor = backgroundColor; }
public void DrawCellText(Cell cell, SolidColor textColor, DrawMode drawMode, float scale) { var sheet = cell.Worksheet; var ds = PlatformGraphics.DpiX / 96.0f; if (sheet == null) { return; } var b = this.GetBrush(textColor); if (b == null) { return; } Rectangle textBounds; System.Drawing.Font scaledFont; #region Determine text bounds switch (drawMode) { default: case DrawMode.View: textBounds = cell.TextBounds; scaledFont = this.resourceManager.GetFont(cell.RenderFont.Name, cell.InnerStyle.FontSize * scale / ds, cell.RenderFont.Style); break; case DrawMode.Preview: case DrawMode.Print: textBounds = cell.PrintTextBounds; scaledFont = this.resourceManager.GetFont(cell.RenderFont.Name, cell.InnerStyle.FontSize * scale, cell.RenderFont.Style); break; } #endregion // Determine text bounds lock (this.sf) { #region Set sf wrap if (cell.InnerStyle.TextWrapMode == TextWrapMode.NoWrap) { sf.FormatFlags |= System.Drawing.StringFormatFlags.NoWrap; } else { sf.FormatFlags &= ~System.Drawing.StringFormatFlags.NoWrap; } #endregion // Set sf wrap var g = base.PlatformGraphics; #region Rotate text if (cell.InnerStyle.RotationAngle != 0) { #if DEBUG1 g.DrawRectangle(Pens.Red, (System.Drawing.Rectangle)textBounds); #endif // DEBUG this.PushTransform(); this.TranslateTransform(textBounds.OriginX, textBounds.OriginY); this.RotateTransform(-cell.InnerStyle.RotationAngle); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; g.DrawString(cell.DisplayText, scaledFont, b, 0, 0, this.sf); this.PopTransform(); } else #endregion // Rotate text { #region Align StringFormat switch (cell.RenderHorAlign) { default: case ReoGridRenderHorAlign.Left: sf.Alignment = System.Drawing.StringAlignment.Near; break; case ReoGridRenderHorAlign.Center: sf.Alignment = System.Drawing.StringAlignment.Center; break; case ReoGridRenderHorAlign.Right: sf.Alignment = System.Drawing.StringAlignment.Far; break; } switch (cell.InnerStyle.VAlign) { case ReoGridVerAlign.Top: sf.LineAlignment = System.Drawing.StringAlignment.Near; break; default: case ReoGridVerAlign.Middle: sf.LineAlignment = System.Drawing.StringAlignment.Center; break; case ReoGridVerAlign.Bottom: sf.LineAlignment = System.Drawing.StringAlignment.Far; break; } #endregion // Align StringFormat g.DrawString(cell.DisplayText, scaledFont, b, textBounds, this.sf); } } }
public void DrawLeadHeadArrow(Rectangle bounds, SolidColor startColor, SolidColor endColor) { }
public void BeginCappedLine(LineCapStyles startCap, Size startSize, LineCapStyles endCap, Size endSize, SolidColor color) { throw new NotImplementedException(); }
public void DrawRunningFocusRect(float x, float y, float w, float h, SolidColor color, int runningOffset) { }
public void BeginDrawLine(RGFloat width, SolidColor color) { throw new NotImplementedException(); }
public void DrawCellText(ReoGridCell cell, SolidColor textColor, DrawMode drawMode, RGFloat scale) { throw new NotImplementedException(); }
private void InitLayout() { this.padding1 = new Padding(0.01, 0.01); this.Children.Add(this.padding1); this.color1 = new SolidColor(0.02, 0.02); this.color1.Color = new Cairo.Color(0.25, 0.25, 0.25, 0.3); this.padding1.Children.Add(this.color1); this.padding10 = new Padding(0.02, 0.02); this.color1.Children.Add(this.padding10); this.box1 = new Box(Direction.Horizontal); this.padding10.Children.Add(this.box1); this.box2 = new Box(Direction.Vertical); this.box1.Children.Add(this.box2); this.adapter1 = new Adapter(Direction.Vertical); this.adapter1.Alignment = Alignment.Left; this.box2.Children.Add(this.adapter1); this.box3 = new Box(Direction.Horizontal); this.box3.Alignment = Alignment.Left; this.adapter1.Children.Add(this.box3); this.padding4 = new Padding(0.02, 0.02); this.box3.Children.Add(this.padding4); this.playerPic = new Picture(); this.padding4.Children.Add(this.playerPic); this.box5 = new Box(Direction.Vertical); this.box3.Children.Add(this.box5); this.playerLabel = new Label(); this.playerLabel.Font = Pango.FontDescription.FromString("Librarian 16"); this.box5.Children.Add(this.playerLabel); this.adapter2 = new Adapter(Direction.Vertical); this.adapter2.Alignment = Alignment.Left; this.box5.Children.Add(this.adapter2); this.box6 = new Box(Direction.Horizontal); this.adapter2.Children.Add(this.box6); this.padding8 = new Padding(0.04, 0.04); this.box6.Children.Add(this.padding8); this.onlinePic = new Picture(); this.padding8.Children.Add(this.onlinePic); this.padding9 = new Padding(0.04, 0.04); this.box6.Children.Add(this.padding9); this.padding2 = new Padding(0.0, 0.02, 0.04, 0.04); this.box2.Children.Add(this.padding2); this.color2 = new SolidColor(); this.color2.Color = new Cairo.Color(0.25, 0.25, 0.25, 0.3); this.padding2.Children.Add(this.color2); this.playerHandPlaceholder = new GeneralPlaceholderWidget(); this.color2.Children.Add(this.playerHandPlaceholder); this.padding3 = new Padding(0.0, 0.02, 0.04, 0.04); this.box2.Children.Add(this.padding3); this.color3 = new SolidColor(); this.color3.Color = new Cairo.Color(0.25, 0.25, 0.25, 0.3); this.padding3.Children.Add(this.color3); this.playerTablePlaceholder = new GeneralPlaceholderWidget(); this.color3.Children.Add(this.playerTablePlaceholder); this.box4 = new Box(Direction.Vertical); this.box1.Children.Add(this.box4); this.padding5 = new Padding(0.06, 0.0, 0.04, 0.04); this.box4.Children.Add(this.padding5); this.playerRolePlaceholder = new CardPlaceholderWidget(); this.padding5.Children.Add(this.playerRolePlaceholder); this.padding6 = new Padding(0.06, 0.0, 0.04, 0.04); this.box4.Children.Add(this.padding6); this.characterOverlay = new Overlay(); this.padding6.Children.Add(this.characterOverlay); this.characterPlaceholder = new CardPlaceholderWidget(); this.characterOverlay.Children.Add(this.characterPlaceholder); this.padding7 = new Padding(0.06, 0.0, 0.04, 0.04); this.box4.Children.Add(this.padding7); this.cardPlaceholder1 = new CardPlaceholderWidget(); this.padding7.Children.Add(this.cardPlaceholder1); }