Esempio n. 1
0
        //============================================================
        // <T>绘制线。</T>
        //============================================================
        public void DrawLine()
        {
            // 获取格子宽 高
            int cellWidth  = _cellSize.Width;
            int cellHeight = _cellSize.Height;
            // 创建格子颜色
            FDxSolidBrush brush = _context.Device.CreateSolidBrush(Color.White);

            // 绘制竖线
            for (int n = 0; n <= _cellCount.Width; n++)
            {
                int beginLocationX = n * cellWidth;
                int beginLocationY = 0;
                int endLocationX   = n * cellWidth;
                int endLocationY   = _cellCount.Height * cellHeight;
                _context.DrawLine(brush, beginLocationX - _location.X, beginLocationY - _location.Y, endLocationX - _location.X, endLocationY - _location.Y);
            }
            // 绘制横线
            for (int n = 0; n <= _cellCount.Height; n++)
            {
                int beginLocationX = 0;
                int beginLocationY = n * cellHeight;
                int endLocationX   = _cellCount.Width * cellWidth;
                int endLocationY   = n * cellHeight;
                _context.DrawLine(brush, beginLocationX - _location.X, beginLocationY - _location.Y, endLocationX - _location.X, endLocationY - _location.Y);
            }
        }
Esempio n. 2
0
 //============================================================
 // <T>设置处理。</T>
 //============================================================
 public void Setup()
 {
     // 设置环境
     _context.Setup();
     // 创建辅助线刷
     _designBackBrush     = _context.BuildDesignColor(_designBackColor);
     _lineForeBrush       = _context.Device.CreateSolidBrush(1.0f, 1.0f, 1.0f, 1.0f);
     _lineBackBrush       = _context.Device.CreateSolidBrush(0.0f, 0.0f, 0.0f, 1.0f);
     _lineForeStrokeStyle = _context.Device.CreateStrokeStyle(EDxCapStyle.Flat, EDxCapStyle.Flat, EDxCapStyle.Flat, EDxDashStyle.Custom, new float[] { 6, 2 });
     // 创建背景刷
     _backBrush.Device = _context.Device;
     using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(16, 16)) {
         for (int y = 0; y < 16; y++)
         {
             for (int x = 0; x < 16; x++)
             {
                 if (((x < 8) && (y < 8)) || ((x > 8) && (y > 8)))
                 {
                     bitmap.SetPixel(x, y, System.Drawing.Color.White);
                 }
                 else
                 {
                     bitmap.SetPixel(x, y, System.Drawing.Color.LightGray);
                 }
             }
         }
         _backBrush.LoadBitmap(bitmap);
     }
     _backBrush.Setup();
     _setuped = true;
 }
Esempio n. 3
0
        //============================================================
        // <T>创建色刷。</T>
        //
        // @parma color 颜色
        // @return 色刷
        //============================================================
        public FDxSolidBrush CreateSolidBrush(Color color)
        {
            FDxSolidBrush result = new FDxSolidBrush();

            result.Device = this;
            result.Color.Set(color.R, color.G, color.B, color.A);
            result.Setup();
            return(result);
        }
Esempio n. 4
0
        //============================================================
        // <T>创建色刷。</T>
        //
        // @parma red 红色
        // @parma green 绿色
        // @parma blue 蓝色
        // @parma alpha 透明度
        // @return 色刷
        //============================================================
        public FDxSolidBrush CreateSolidBrush(float red = 1.0f, float green = 1.0f, float blue = 1.0f, float alpha = 1.0f)
        {
            FDxSolidBrush result = new FDxSolidBrush();

            result.Device = this;
            result.Color.SetFloat(red, green, blue, alpha);
            result.Setup();
            return(result);
        }
Esempio n. 5
0
        //============================================================
        // <T>创建色刷。</T>
        //
        // @parma color 颜色
        // @return 色刷
        //============================================================
        public FDxSolidBrush CreateSolidBrush(SColor color)
        {
            FDxSolidBrush result = new FDxSolidBrush();

            result.Device = this;
            result.Color.Assign(color);
            result.Setup();
            return(result);
        }
Esempio n. 6
0
        //============================================================
        // <T>创建色刷。</T>
        //============================================================
        public FDxSolidBrush CreateSolidBrush(float r, float g, float b)
        {
            FDxSolidBrush brush = new FDxSolidBrush();

            brush.Device = this;
            brush.Color.Set(r, g, b);
            brush.Setup();
            return(brush);
        }
Esempio n. 7
0
        //============================================================
        // <T>创建色刷。</T>
        //============================================================
        public FDxSolidBrush CreateSolidBrush(Color color)
        {
            FDxSolidBrush brush = new FDxSolidBrush();

            brush.Device = this;
            brush.Color.Set(color.R, color.G, color.B);
            brush.Setup();
            return(brush);
        }
Esempio n. 8
0
        //============================================================
        // <T>根据指定颜色生成默认色刷。</T>
        //
        // @param color 颜色
        // @return 色刷
        //============================================================
        public FDxSolidBrush BuildSoldBrush(int color)
        {
            string        code  = color.ToString();
            FDxSolidBrush brush = _designColors.Find(code);

            if (brush == null)
            {
                brush = _device.CreateSolidBrush(Color.FromArgb(color));
                _designColors.Set(code, brush);
            }
            return(brush);
        }
Esempio n. 9
0
 //============================================================
 // <T>配置颜色处理。</T>
 //
 // @param color 颜色
 //============================================================
 public void SetupColor(FUiColor color)
 {
     if (color == null)
     {
         return;
     }
     if (!color.Valid)
     {
         return;
     }
     if (color.brush == null)
     {
         color.brush = _context.Device.CreateSolidBrush(color);
     }
     else
     {
         FDxSolidBrush brush = color.brush as FDxSolidBrush;
         if (brush.Color.ToValue() != color.ToValue())
         {
             color.brush = _context.Device.CreateSolidBrush(color);
         }
     }
 }
Esempio n. 10
0
        //============================================================
        // <T>绘制线条。</T>
        //
        // @param color 颜色
        // @param x1 起始横向位置
        // @param y1 起始纵向位置
        // @param x2 结束横向位置
        // @param y2 结束纵向位置
        // @param strokeWidth 宽度
        //============================================================
        public void DrawLine(int color, float x1, float y1, float x2, float y2, float strokeWidth = 1.0f)
        {
            FDxSolidBrush brush = BuildSoldBrush(color);

            _target.DrawLine(brush.Native, x1, y1, x2, y2, strokeWidth);
        }
Esempio n. 11
0
        //============================================================
        // <T>绘制文本。</T>
        //
        // @param text 文本
        // @param format 字体格式
        // @param color 颜色
        // @param rectangle 范围
        //============================================================
        public void DrawText(string text, FDxTextFormat format, int color, SIntRectangle rectangle)
        {
            FDxSolidBrush brush = BuildSoldBrush(color);

            _target.DrawText(text, format.Native, new Rectangle(rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height), brush.Native);
        }
Esempio n. 12
0
        //============================================================
        // <T>填充矩形。</T>
        //
        // @param color 颜色
        // @param x 横向位置
        // @param y 纵向位置
        // @param width 宽度
        // @param height 高度
        //============================================================
        public void FillRectangle(int color, float x, float y, float width, float height)
        {
            FDxSolidBrush brush = BuildSoldBrush(color);

            _target.FillRectangle(brush.Native, new RectangleF(x, y, width, height));
        }