Beispiel #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");
 }
Beispiel #2
0
        //============================================================
        // <T>创建字体格式。</T>
        //
        // @parma fontFamilyName 字体名称
        // @parma fontWeight 字体粗细
        // @parma fontStyle 字体样式
        // @parma fontStretch 字体拉伸
        // @parma fontSize 字体大小
        // @parma localName 本地名称
        // @return 字体格式
        //============================================================
        public FDxTextFormat CreateTextFormat(string fontFamilyName, string fontWeight = "Normal", string fontStyle = "Normal", string fontStretch = "Normal", float fontSize = 9.0f, string localName = null)
        {
            FDxTextFormat format = new FDxTextFormat();

            format.Device         = this;
            format.FontFamilyName = fontFamilyName;
            format.FontWeight     = fontWeight;
            format.FontStyle      = fontStyle;
            format.FontStretch    = fontStretch;
            format.FontSize       = fontSize;
            format.LocalName      = localName;
            format.Setup();
            return(format);
        }
Beispiel #3
0
        //============================================================
        // <T>开始绘制处理。</T>
        //
        // @param args 参数
        //============================================================
        public override void OnDrawBegin(SUiDrawArgs args)
        {
            base.OnDrawBegin(args);
            // 绘制文本
            string    label = ControlResource.Label;
            SIntSize2 size  = ControlResource.Size;

            if (!RString.IsEmpty(label))
            {
                FDxTextFormat labelFormat = _context.DefaultTextFormat;
                labelFormat.AlignmentCd          = EDxTextAlignment.Leading;
                labelFormat.ParagraphAlignmentCd = EDxParagraphAlignment.Center;
                _context.Context.DrawText(label, _context.DefaultTextFormat, EditResource.Font.Color, new SIntRectangle(0, 0, size.Width, size.Height));
            }
        }
Beispiel #4
0
        //============================================================
        // <T>开始绘制处理。</T>
        //
        // @param args 参数
        //============================================================
        public override void OnDrawBegin(SUiDrawArgs args)
        {
            base.OnDrawBegin(args);
            // 绘制处理
            if (TestVisible())
            {
                // 绘制背景资源
                DrawResource(_groundResource);
            }
            // 绘制文本
            FRcButton resource = ButtonResource;
            string    text     = resource.FormatDisplay();

            if (!RString.IsEmpty(text))
            {
                SIntSize2     size        = resource.Size;
                FDxTextFormat labelFormat = _context.DefaultTextFormat;
                labelFormat.AlignmentCd          = EDxTextAlignment.Center;
                labelFormat.ParagraphAlignmentCd = EDxParagraphAlignment.Center;
                _context.Context.DrawText(text, _context.DefaultTextFormat, resource.Font.Color, new SIntRectangle(0, 0, size.Width, size.Height));
            }
        }
Beispiel #5
0
        //============================================================
        // <T>开始绘制处理。</T>
        //
        // @param args 参数
        //============================================================
        public override void OnDrawBegin(SUiDrawArgs args)
        {
            base.OnDrawBegin(args);
            // 绘制处理
            if (TestVisible())
            {
                // 绘制背景资源
                DrawResource(_groundResource);
            }
            _context.Context.FillRectangle(0x7F888800, 2, 2, _designSize.Width - 4, 24);
            // 绘制文本
            FRcWindow resource = WindowResource;
            string    text     = resource.Label;

            if (!RString.IsEmpty(text))
            {
                SIntSize2     size        = resource.Size;
                FDxTextFormat labelFormat = _context.DefaultTextFormat;
                labelFormat.AlignmentCd          = EDxTextAlignment.Center;
                labelFormat.ParagraphAlignmentCd = EDxParagraphAlignment.Center;
                _context.Context.DrawText(text, _context.DefaultTextFormat, 0, new SIntRectangle(0, 0, size.Width, size.Height));
            }
        }
Beispiel #6
0
 //============================================================
 // <T>绘制文本。</T>
 //
 // @param text 文本
 // @param format 字体格式
 // @param brush 刷子
 // @param x 横坐标
 // @param y 纵坐标
 // @param width 宽度
 // @param height 高度
 //============================================================
 public void DrawText(string text, FDxTextFormat format, FDxBrush brush, int x, int y, int width, int height)
 {
     _target.DrawText(text, format.Native, new Rectangle(x, y, width, height), brush.Native);
 }
Beispiel #7
0
 //============================================================
 // <T>绘制文本。</T>
 //
 // @param text 文本
 // @param format 字体格式
 // @param brush 刷子
 // @param rectangle 范围
 //============================================================
 public void DrawText(string text, FDxTextFormat format, FDxBrush brush, SIntRectangle rectangle)
 {
     _target.DrawText(text, format.Native, new Rectangle(rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height), brush.Native);
 }
Beispiel #8
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);
        }