Ejemplo n.º 1
0
        /// <summary>
        /// 画控件亮度拉杆
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="r">拉杆所在圆弧的Rectangle</param>
        /// <param name="percentSet">亮度百分比</param>
        protected void DrawSelector(Graphics graphics, RectangleF r, float percentSet)
        {
            Pen pen = new Pen(Color.CadetBlue);

            percentSet = Math.Max(0, percentSet);
            percentSet = Math.Min(1, percentSet);

            Image image = SelectorImages.GetColorPoint();

            PointF Center = Util.Center(r);

            graphics.TranslateTransform(Center.X, Center.Y);

            float xpos = r.Top - colorSelectorSize.Width / 2;
            float ypos = r.Top + r.Height / 2 - colorSelectorSize.Height;

            float Angle = percentSet * 360;

            graphics.RotateTransform(Angle);
            Rectangle imageRect = new Rectangle(new Point((int)xpos, (int)ypos), colorSelectorSize);

            graphics.DrawImage(image, imageRect);
            //graphics.DrawImageUnscaled(image, (int)xpos, (int)ypos);//按原始大小

            graphics.ResetTransform();
        }
Ejemplo n.º 2
0
        void DrawColorSelector(Graphics dc)
        {
            Rectangle r      = Util.Rect(ColorSelectorRectangle);
            PointF    center = Util.Center(r);

            Image image = SelectorImages.Image(SelectorImages.eIndexes.Donut);//实心块

            dc.DrawImageUnscaled(image, (int)(center.X - image.Width / 2), (int)(center.Y - image.Height / 2));

            //Pen penOut = new Pen(Color.Black);  //圆圈
            //dc.DrawEllipse(penOut, r);
        }