コード例 #1
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));
        }
コード例 #2
0
ファイル: ColorBar.cs プロジェクト: Heide172/dpR
        protected void DrawSelector(Graphics dc, RectangleF r, Orientation orientation, float percentSet)
        {
            Pen pen = new Pen(Color.CadetBlue);

            percentSet = Math.Max(0, percentSet);
            percentSet = Math.Min(1, percentSet);
            if (orientation == Orientation.Vertical)
            {
                float selectorY = (float)Math.Floor(r.Top + (r.Height - (r.Height * percentSet)));
                if (m_valueOrientation == eValueOrientation.MaxToMin)
                {
                    selectorY = (float)Math.Floor(r.Top + (r.Height - (r.Height * percentSet)));
                }
                else
                {
                    selectorY = (float)Math.Floor(r.Top + (r.Height * percentSet));
                }

                dc.DrawLine(pen, r.X, selectorY, r.Right, selectorY);

                Image image = SelectorImages.Image(SelectorImages.eIndexes.Right);
                float xpos  = r.Right;
                float ypos  = selectorY - image.Height / 2;
                dc.DrawImageUnscaled(image, (int)xpos, (int)ypos);

                image = SelectorImages.Image(SelectorImages.eIndexes.Left);
                xpos  = r.Left - image.Width;
                dc.DrawImageUnscaled(image, (int)xpos, (int)ypos);
            }
            if (orientation == Orientation.Horizontal)
            {
                float selectorX = 0;
                if (m_valueOrientation == eValueOrientation.MaxToMin)
                {
                    selectorX = (float)Math.Floor(r.Left + (r.Width - (r.Width * percentSet)));
                }
                else
                {
                    selectorX = (float)Math.Floor(r.Left + (r.Width * percentSet));
                }

                dc.DrawLine(pen, selectorX, r.Top, selectorX, r.Bottom);

                Image image = SelectorImages.Image(SelectorImages.eIndexes.Up);
                float xpos  = selectorX - image.Width / 2;
                float ypos  = r.Bottom;
                dc.DrawImageUnscaled(image, (int)xpos, (int)ypos);

                image = SelectorImages.Image(SelectorImages.eIndexes.Down);
                ypos  = r.Top - image.Height;
                dc.DrawImageUnscaled(image, (int)xpos, (int)ypos);
            }
        }