Beispiel #1
0
        //画时间段(包括X轴的刻度)
        void DrawTrackPeriod(Graphics g, TrackItem item, int x, int y)
        {
            DrawTrackGradation(g, item, x, y);

            Brush brush = new SolidBrush(_colorTrackPeriod);

            try
            {
                if ((item.TrackStyle == TrackStyle.UseB4Order && _mouseStatus == MouseStatus.UseBeforeOrderArea) ||
                    (item.TrackStyle == TrackStyle.Orders && _mouseStatus == MouseStatus.OrderAnalyseArea))
                {
                    brush = new SolidBrush(_colorTrackPeriodOver);
                }
                Rectangle rec = new Rectangle(x - _trackPeriodSize.Width / 2, y - _trackPeriodSize.Height / 2, _trackPeriodSize.Width, _trackPeriodSize.Height);

                Rectangle recShadow = rec;
                recShadow.Offset(_shadowOffset, _shadowOffset);
                var pathShadow = GetGraphicsPath(recShadow, 1);
                using (var brushShadow = new PathGradientBrush(pathShadow)
                {
                    CenterColor = Color.Black, SurroundColors = new Color[] { SystemColors.ButtonFace }
                })
                    g.FillPath(brushShadow, pathShadow); //阴影

                g.FillRectangle(brush, rec);

                if (item.TrackStyle == TrackStyle.UseB4Order && !string.IsNullOrWhiteSpace(item.Note))// && _recUseB4OrderTip == null)
                {
                    var size   = TextRenderer.MeasureText(item.Note, this.Font);
                    var width  = size.Width + 30;//留边
                    var height = size.Height + 30;
                    _recUseB4OrderTip = new Rectangle(x, y + _trackPeriodSize.Height / 2, width, height);
                }
                else if (item.TrackStyle == TrackStyle.Orders && !string.IsNullOrWhiteSpace(item.Note))// && _recOrdersTip == null)
                {
                    var size   = TextRenderer.MeasureText(item.Note, this.Font);
                    var width  = size.Width + 30;//留边
                    var height = size.Height + 30;
                    _recOrdersTip = new Rectangle(x, y + _trackPeriodSize.Height / 2, width, height);
                }


                //对敏感区域赋值
                if (item.TrackStyle == TrackStyle.UseB4Order)
                {
                    _recUseB4Order = rec;
                }
                if (item.TrackStyle == TrackStyle.Orders)
                {
                    _recOrders = rec;
                }
            }
            finally { brush.Dispose(); }
        }
Beispiel #2
0
        //画刻度
        void DrawTrackGradation(Graphics g, TrackItem item, int x, int y)
        {
            var size = TextRenderer.MeasureText(item.YText, this.Font);//居中

            g.DrawString(item.YText, this.Font, Brushes.Black, x - size.Width / 2, y - _trackPointRadius - size.Height - 6);

            var size2 = TextRenderer.MeasureText(item.XText, this.Font);//居中

            g.DrawLine(Pens.Black, x, _zeroPoint.Y, x, _zeroPoint.Y - 3);
            g.DrawString(item.XText, this.Font, Brushes.Black, x - size2.Width / 2, _zeroPoint.Y + 6);

            using (var pen = new Pen(Brushes.Gray)
            {
                DashStyle = System.Drawing.Drawing2D.DashStyle.Custom, DashPattern = new float[] { 2, 2 }
            })                                                                                                                                   //
                g.DrawLine(pen, x, y, x, _zeroPoint.Y);
        }
Beispiel #3
0
        //画时间点(包括X轴的刻度)
        void DrawTrackPoint(Graphics g, TrackItem item, int x, int y)
        {
            DrawTrackGradation(g, item, x, y);
            Rectangle rec       = new Rectangle(x - _trackPointRadius, y - _trackPointRadius, _trackPointRadius * 2, _trackPointRadius * 2);
            Rectangle recShadow = rec;

            recShadow.Offset(_shadowOffset, _shadowOffset);
            var pathShadow = GetGraphicsPath(recShadow, _trackPointRadius * 2);

            using (var brush = new SolidBrush(_colorTrackPoint))
                using (var brushShadow = new PathGradientBrush(pathShadow)
                {
                    CenterColor = Color.Black, SurroundColors = new Color[] { SystemColors.ButtonFace }
                })
                {
                    g.FillPath(brushShadow, pathShadow);//阴影
                    g.FillEllipse(brush, rec);
                }
        }
Beispiel #4
0
 public UserTrackEventArgs(TrackItem item)
 {
     Item = item;//事件传递数据
 }