Beispiel #1
0
            public void ShowEditControl(Graphics.Rectangle bounds, Cell cell)
            {
                var sheet = this.canvas.CurrentWorksheet;

                Color textColor;

                if (!cell.RenderColor.IsTransparent)
                {
                    textColor = cell.RenderColor;
                }
                else if (cell.InnerStyle.HasStyle(PlainStyleFlag.TextColor))
                {
                    // cell text color, specified by SetRangeStyle
                    textColor = cell.InnerStyle.TextColor;
                }
                else
                {
                    // default cell text color
                    textColor = this.canvas.controlStyle[ControlAppearanceColors.GridText];
                }

                Canvas.SetLeft(this.editTextbox, bounds.X);
                Canvas.SetTop(this.editTextbox, bounds.Y);

                this.editTextbox.Width      = bounds.Width;
                this.editTextbox.Height     = bounds.Height;
                this.editTextbox.RenderSize = bounds.Size;

                this.editTextbox.CellSize   = cell.Bounds.Size;
                this.editTextbox.VAlign     = cell.InnerStyle.VAlign;
                this.editTextbox.FontFamily = new FontFamily(cell.InnerStyle.FontName);
                this.editTextbox.FontSize   = cell.InnerStyle.FontSize * sheet.ScaleFactor * 96f / 72f;
                this.editTextbox.FontStyle  = PlatformUtility.ToWPFFontStyle(cell.InnerStyle.fontStyles);
                this.editTextbox.Foreground = this.Renderer.GetBrush(textColor);
                this.editTextbox.Background = this.Renderer.GetBrush(cell.InnerStyle.HasStyle(PlainStyleFlag.BackColor)
                                        ? cell.InnerStyle.BackColor : this.canvas.controlStyle[ControlAppearanceColors.GridBackground]);
                this.editTextbox.SelectionStart = this.editTextbox.Text.Length;
                this.editTextbox.TextWrap       = cell.InnerStyle.TextWrapMode != TextWrapMode.NoWrap;
                this.editTextbox.TextWrapping   = (cell.InnerStyle.TextWrapMode == TextWrapMode.NoWrap)
                                        ? TextWrapping.NoWrap : TextWrapping.Wrap;

                this.editTextbox.Visibility = Visibility.Visible;
                this.editTextbox.Focus();
            }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public void DrawRectangle(Pen p, Rectangle rect)
 {
     this.g.DrawRectangle(p, rect.X, rect.Y, rect.Width, rect.Height);
 }
Beispiel #4
0
 public void DrawHeaderText(string text, System.Drawing.Brush brush, Rectangle rect)
 {
     base.PlatformGraphics.DrawString(text, scaledHeaderFont, brush, rect, this.headerSf);
 }
Beispiel #5
0
        //public void DrawText(string text, string fontName, float size, SolidColor color, Rectangle rect)
        //{
        //	if (color.IsTransparent)
        //	{
        //		return;
        //	}

        //	var font = this.resourceManager.GetFont(fontName, size, WFFontStyle.Regular);

        //	if (font != null)
        //	{
        //		lock (this.sf)
        //		{
        //			sf.Alignment = StringAlignment.Near;
        //			sf.LineAlignment = StringAlignment.Near;

        //			g.DrawString(text, font, this.resourceManager.GetBrush(color), rect, sf);
        //		}
        //	}
        //}

        public void DrawText(string text, string fontName, float size, SolidColor color, Rectangle rect,
                             ReoGridHorAlign halign, ReoGridVerAlign valign)
        {
            if (color.IsTransparent)
            {
                return;
            }

            var font = this.resourceManager.GetFont(fontName, size, WFFontStyle.Regular);

            if (font != null)
            {
                lock (this.sf)
                {
                    switch (halign)
                    {
                    default: sf.Alignment = StringAlignment.Near; break;

                    case ReoGridHorAlign.Center: sf.Alignment = StringAlignment.Center; break;

                    case ReoGridHorAlign.Right: sf.Alignment = StringAlignment.Far; break;
                    }

                    switch (valign)
                    {
                    default: sf.LineAlignment = StringAlignment.Near; break;

                    case ReoGridVerAlign.Middle: sf.LineAlignment = StringAlignment.Center; break;

                    case ReoGridVerAlign.Bottom: sf.LineAlignment = StringAlignment.Far; break;
                    }

                    g.DrawString(text, font, this.resourceManager.GetBrush(color), rect, sf);
                }
            }
        }
Beispiel #6
0
 public void PushClip(Rectangle clip)
 {
     clipStack.Push(this.g.ClipBounds);
     this.g.SetClip(clip, CombineMode.Intersect);
 }
Beispiel #7
0
 public void DrawEllipse(Pen pen, Rectangle rect)
 {
     this.g.DrawEllipse(pen, rect);
 }
Beispiel #8
0
 public void FillEllipse(Brush b, Rectangle rect)
 {
     this.g.FillEllipse(b, rect);
 }
Beispiel #9
0
 public void FillRectangleLinear(SolidColor startColor, SolidColor endColor, float angle, Rectangle rect)
 {
     using (System.Drawing.Drawing2D.LinearGradientBrush lgb =
                new System.Drawing.Drawing2D.LinearGradientBrush(rect, startColor, endColor, angle))
     {
         this.g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
         this.g.FillRectangle(lgb, rect);
         this.g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Default;
     }
 }
Beispiel #10
0
 public void DrawImage(Image image, Rectangle bounds)
 {
     this.g.DrawImage(image, bounds);
 }
Beispiel #11
0
 public void DrawAndFillRectangle(Rectangle rect, SolidColor lineColor, IColor fillColor, float weight, LineStyles lineStyle)
 {
     FillRectangle(rect, fillColor);
     DrawRectangle(rect, lineColor, weight, lineStyle);
 }
Beispiel #12
0
 public void DrawAndFillRectangle(Rectangle rect, SolidColor lineColor, IColor fillColor)
 {
     FillRectangle(rect, fillColor);
     DrawRectangle(rect, lineColor);
 }
Beispiel #13
0
 public void FillRectangle(HatchStyle style, SolidColor hatchColor, SolidColor bgColor, Rectangle rect)
 {
     this.FillRectangle(style, hatchColor, bgColor, rect.X, rect.Y, rect.Width, rect.Height);
 }
Beispiel #14
0
 public void FillRectangle(HatchStyles style, SolidColor hatchColor, SolidColor bgColor, Rectangle rect)
 {
     this.g.FillRectangle(this.resourceManager.GetHatchBrush((HatchStyle)style, hatchColor, bgColor), rect);
 }
Beispiel #15
0
 public void ShowEditControl(Graphics.Rectangle bounds, ReoGridCell cell)
 {
     // TODO
 }