Example #1
0
        public override void Draw(Graphics g, TimeRuler ruler)
        {
            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                int iSecondPos = ruler.ScaleValueToPixel((double)_StartMillisecond);
                int x = iSecondPos - 1;
                int y1 = ruler.HeaderOffset / 2, y2 = ruler.Height;
                g.DrawLine(new Pen(new SolidBrush(this.Color), 3), x, y1, x, y2);

                Point   left           = new Point(iSecondPos - y1, 1);
                Point   right          = new Point(iSecondPos + y1, 1);
                Point   bottom         = new Point(iSecondPos, ruler.HeaderOffset / 2);
                Point[] trianglePoints = { left, right, bottom };
                g.FillPolygon(new SolidBrush(this.Color), trianglePoints, System.Drawing.Drawing2D.FillMode.Winding);

                g.DrawPolygon(new Pen(new SolidBrush(ruler.ForeColor)), trianglePoints);
            }
            else
            {
                int iSecondPos = ruler.ScaleValueToPixel((double)_StartMillisecond);
                int y = iSecondPos - 1;
                int x1 = ruler.HeaderOffset / 2, x2 = ruler.Height;
                g.DrawLine(new Pen(new SolidBrush(this.Color), 3), x1, y, x2, y);

                Point   left           = new Point(1, iSecondPos - x1);
                Point   right          = new Point(1, iSecondPos + x1);
                Point   bottom         = new Point(ruler.HeaderOffset / 2, iSecondPos);
                Point[] trianglePoints = { left, right, bottom };
                g.FillPolygon(new SolidBrush(this.Color), trianglePoints, System.Drawing.Drawing2D.FillMode.Winding);

                g.DrawPolygon(new Pen(new SolidBrush(ruler.ForeColor)), trianglePoints);
            }
        }
Example #2
0
        public virtual void Draw(Graphics g, TimeRuler ruler)
        {
            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                int x = ruler.ScaleValueToPixel((double)_StartMillisecond) - 1;
                int y1 = ruler.HeaderOffset, y2 = ruler.Height;
                g.DrawLine(_DrawingPen, x, y1, x, y2);

                y1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1 - 1;
                x  = ruler.ScaleValueToPixel((double)_StartMillisecond) - (y2 / 2) - 1;
                g.DrawEllipse(new Pen(new SolidBrush(ruler.ForeColor)), x, y1, y2, y2);
                g.FillEllipse(_DrawingBrush, x, y1, y2, y2);
            }
            else
            {
                int y = ruler.ScaleValueToPixel((double)_StartMillisecond) - 1;
                int x1 = ruler.HeaderOffset, x2 = ruler.Height;
                g.DrawLine(_DrawingPen, x1, y, x2, y);

                x1 = ruler.HeaderOffset / 2;
                x2 = ruler.HeaderOffset - x1 - 1;
                y  = ruler.ScaleValueToPixel((double)_StartMillisecond) - (x2 / 2) - 1;
                g.DrawEllipse(new Pen(new SolidBrush(ruler.ForeColor)), x1, y, x2, x2);
                g.FillEllipse(_DrawingBrush, x1, y, x2, x2);
            }
        }
Example #3
0
        public override bool IsHandleClick(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler, long lMillisecond)
        {
            int  y1      = 1;
            int  y2      = ruler.HeaderOffset / 2;
            int  x1      = ruler.ScaleValueToPixel((double)lMillisecond) - (y2 / 2) - 1;
            int  x2      = x1 + y2;
            bool bRetVal = false;

            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                if ((e.X >= x1) && (e.X <= x2) && (e.Y >= y1) && (e.Y <= y2))
                {
                    bRetVal = true;
                }
            }
            else
            {
                if ((e.Y >= x1) && (e.Y <= x2) && (e.X >= y1) && (e.X <= y2))
                {
                    bRetVal = true;
                }
            }

            return(bRetVal);
        }
Example #4
0
        public virtual int DistanceFromHandle(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler, long lMillisecond)
        {
            int iMousePosition = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y);
            int x = ruler.ScaleValueToPixel((double)lMillisecond);

            return(Math.Abs(x - iMousePosition));
        }
Example #5
0
        public override void Draw(Graphics g, TimeRuler ruler)
        {
            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                int x1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - 1;
                int y1 = ruler.HeaderOffset, y2 = ruler.Height;
                g.DrawLine(_DrawingPen, x1, y1, x1, y2);

                x1 = ruler.ScaleValueToPixel((double)_EndMillisecond) - 1;
                y1 = ruler.HeaderOffset;
                y2 = ruler.Height;
                g.DrawLine(_DrawingPen, x1, y1, x1, y2);

                y1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1;
                x1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - 2;
                int x2 = ruler.ScaleValueToPixel((double)_EndMillisecond);
                x2 = x2 - x1;
                g.DrawRectangle(new Pen(new SolidBrush(ruler.ForeColor)), x1, y1, x2, y2);
                g.FillRectangle(_DrawingBrush, x1, y1, x2, y2);

                y1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1;
                x1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - (y2 / 2) - 1;
                g.FillRectangle(new SolidBrush(ruler.ForeColor), x1, y1, y2, y2);

                y1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1;
                x1 = ruler.ScaleValueToPixel((double)_EndMillisecond) - (y2 / 2) - 1;
                g.FillRectangle(new SolidBrush(ruler.ForeColor), x1, y1, y2, y2);
            }
            else
            {
                int y1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - 1;
                int x1 = ruler.HeaderOffset, x2 = ruler.Width;
                g.DrawLine(_DrawingPen, x1, y1, x2, y1);

                y1 = ruler.ScaleValueToPixel((double)_EndMillisecond) - 1;
                x1 = ruler.HeaderOffset;
                x2 = ruler.Height;
                g.DrawLine(_DrawingPen, x1, y1, x2, y1);

                x1 = ruler.HeaderOffset / 2;
                x2 = ruler.HeaderOffset - x1;
                y1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - 2;
                int y2 = ruler.ScaleValueToPixel((double)_EndMillisecond);
                y2 = y2 - y1;
                g.DrawRectangle(new Pen(new SolidBrush(ruler.ForeColor)), x1, y1, x2, y2);
                g.FillRectangle(_DrawingBrush, x1, y1, x2, y2);

                x1 = ruler.HeaderOffset / 2;
                x2 = ruler.HeaderOffset - x1;
                y1 = ruler.ScaleValueToPixel((double)_StartMillisecond) - (x2 / 2) - 1;
                g.FillRectangle(new SolidBrush(ruler.ForeColor), x1, y1, x2, x2);

                x1 = ruler.HeaderOffset / 2;
                y2 = ruler.HeaderOffset - y1;
                y1 = ruler.ScaleValueToPixel((double)_EndMillisecond) - (x2 / 2) - 1;
                g.FillRectangle(new SolidBrush(ruler.ForeColor), x1, y1, x2, x2);
            }
        }