Пример #1
0
 //============================================================
 // <T>设置处理。</T>
 //============================================================
 public void Setup()
 {
     if (!_designLightColor.HasBrush())
     {
         _designLightColor.Set(255, 255, 255, 255);
         _designLightColor.brush = _context.Device.CreateSolidBrush(_designLightColor);
     }
     if (!_designDarkColor.HasBrush())
     {
         _designDarkColor.Set(0, 0, 0, 255);
         _designDarkColor.brush = _context.Device.CreateSolidBrush(_designDarkColor);
     }
     if (!_designBorderForeColor.HasBrush())
     {
         _designBorderForeColor.Set(255, 255, 255, 255);
         _designBorderForeColor.brush = _context.Device.CreateSolidBrush(_designBorderForeColor);
     }
     if (!_designBorderBackColor.HasBrush())
     {
         _designBorderBackColor.Set(0, 0, 0, 255);
         _designBorderBackColor.brush = _context.Device.CreateSolidBrush(_designBorderBackColor);
     }
     _designLineStrokeStyle = _context.Device.CreateStrokeStyle(EDxCapStyle.Flat, EDxCapStyle.Flat, EDxCapStyle.Flat, EDxDashStyle.Custom, new float[] { 6, 1 });
     if (!_designGroundColor.HasBrush())
     {
         _designGroundColor.Set(255, 255, 255, 255);
         _designGroundColor.brush = _context.Device.CreateSolidBrush(_designGroundColor);
     }
     // 设置文本格式
     _defaultTextFormat = _context.Device.CreateTextFormat("NSimSun", "Normal", "Normal", "Normal", 12.0f, "NSimSun");
 }
Пример #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;
 }
Пример #3
0
        //============================================================
        // <T>创建线条样式。</T>
        //
        // @parma beginCap 开始样式
        // @parma endCap 结束样式
        // @parma lineCap 线条样式
        // @parma lineStyle 线条样式
        // @parma dashs 点集合
        // @return 线条样式
        //============================================================
        public FDxStrokeStyle CreateStrokeStyle(EDxCapStyle beginCap, EDxCapStyle endCap, EDxCapStyle lineCap, EDxDashStyle lineStyle, float[] dashs = null)
        {
            FDxStrokeStyle result = new FDxStrokeStyle();

            result.Device   = this;
            result.BeginCap = beginCap;
            result.EndCap   = endCap;
            result.DashCap  = lineCap;
            if (dashs != null)
            {
                result.DashStyle = EDxDashStyle.Custom;
                result.Dashs     = dashs;
            }
            else
            {
                result.DashStyle = lineStyle;
            }
            result.Setup();
            return(result);
        }
Пример #4
0
 //============================================================
 // <T>绘制矩形。</T>
 //
 // @param brush 色刷
 // @param x 横向位置
 // @param y 纵向位置
 // @param width 宽度
 // @param height 高度
 // @param strokeWidth 样式宽度
 // @param style 样式
 //============================================================
 public void DrawRectangle(FDxBrush brush, float x, float y, float width, float height, float strokeWidth, FDxStrokeStyle style)
 {
     _target.DrawRectangle(brush.Native, new RectangleF(x, y, width, height), strokeWidth, style.Native);
 }
Пример #5
0
 //============================================================
 // <T>绘制线条。</T>
 //
 // @param x1 起始横向位置
 // @param y1 起始纵向位置
 // @param x2 结束横向位置
 // @param y2 结束纵向位置
 // @param brushBack 色刷
 // @param brushFore 色刷
 // @param strokeWidth 宽度
 // @param strokeStyle 样式
 //============================================================
 public void DrawLineLayer(float x1, float y1, float x2, float y2, FDxBrush brushBack, FDxBrush brushFore, float strokeWidth, FDxStrokeStyle strokeStyle)
 {
     _target.DrawLine(brushBack.Native, x1, y1, x2, y2, strokeWidth);
     _target.DrawLine(brushFore.Native, x1, y1, x2, y2, strokeWidth, strokeStyle.Native);
 }
Пример #6
0
 //============================================================
 // <T>绘制线条。</T>
 //
 // @param brush 色刷
 // @param x1 起始横向位置
 // @param y1 起始纵向位置
 // @param x2 结束横向位置
 // @param y2 结束纵向位置
 // @param strokeWidth 宽度
 // @param strokeStyle 样式
 //============================================================
 public void DrawLine(FDxBrush brush, float x1, float y1, float x2, float y2, float strokeWidth, FDxStrokeStyle strokeStyle)
 {
     _target.DrawLine(brush.Native, x1, y1, x2, y2, strokeWidth, strokeStyle.Native);
 }
Пример #7
0
        //============================================================
        // <T>绘制线条。</T>
        //
        // @param color 颜色
        // @param x1 起始横向位置
        // @param y1 起始纵向位置
        // @param x2 结束横向位置
        // @param y2 结束纵向位置
        // @param strokeWidth 宽度
        // @param strokeStyle 样式
        //============================================================
        public void DrawLine(int color, float x1, float y1, float x2, float y2, float strokeWidth, FDxStrokeStyle strokeStyle)
        {
            FDxSolidBrush brush = BuildSoldBrush(color);

            _target.DrawLine(brush.Native, x1, y1, x2, y2, strokeWidth, strokeStyle.Native);
        }