Пример #1
0
        /// <summary>
        /// 设置圆的颜色
        /// </summary>
        /// <param name="color">颜色</param>
        public void SetCircularColor(Color color)
        {
            using (Graphics g = Circular.CreateGraphics())
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                g.FillEllipse(new SolidBrush(color), Circular.ClientRectangle);
            }
            CircularInfo circularInfo = new CircularInfo();

            circularInfo.Color = color;
        }
Пример #2
0
        /// <summary>
        /// 将文本画在控件中心
        /// </summary>
        /// <param name="Test">显示文字</param>
        /// <param name="Family">字体</param>
        /// <param name="size">字体大小</param>
        /// <param name="color">字体颜色</param>
        /// <param name="style">字体类型</param>
        public void WriteTestInMiddle(string Test, string Family, float size, Color color, FontStyle style = FontStyle.Bold)
        {
            StringFormat sf = new StringFormat()
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            };
            Font f = new Font(Family, size, style);

            Graphics g = Circular.CreateGraphics();

            g.DrawString(Test, f, new SolidBrush(color), Circular.ClientRectangle, sf);

            FontInfo info = new FontInfo();

            info.Test   = Test;
            info.Family = Family;
            info.Size   = size;
            info.Color  = color;
            info.style  = style;

            fontInfo = info;
        }