Пример #1
0
        public ObjectPoint GetValueFromPos(float X, float Y, ref FormulaArea fa)
        {
            ObjectPoint    point   = new ObjectPoint();
            FormulaHitInfo hitInfo = this.GetHitInfo(X, Y);

            if (fa == null)
            {
                fa = hitInfo.Area;
            }
            point.Y = fa.AxisY.GetValueFromY(Y - this.Rect.Y) * fa.AxisY.MultiplyFactor;
            int cursorPos = hitInfo.CursorPos;

            double[] numArray = this.DataProvider["DATE"];
            if ((numArray != null) && (numArray.Length > 0))
            {
                if (cursorPos < 0)
                {
                    point.X = numArray[0] + cursorPos;
                    return(point);
                }
                if (cursorPos >= numArray.Length)
                {
                    point.X = numArray[numArray.Length - 1] + ((cursorPos - numArray.Length) + 1);
                    return(point);
                }
                point.X = numArray[cursorPos];
            }
            return(point);
        }
Пример #2
0
        public void SelectAreaByPos(float X, float Y)
        {
            FormulaHitInfo hitInfo = this.GetHitInfo(X, Y);

            if (hitInfo.Area != null)
            {
                this.SelectedArea = hitInfo.Area;
            }
        }
Пример #3
0
        public FormulaHitInfo GetHitInfo(float X, float Y)
        {
            FormulaHitInfo info = new FormulaHitInfo();

            if (this.DataProvider != null)
            {
                X           -= this.Rect.X;
                Y           -= this.Rect.Y;
                info.X       = X;
                info.Y       = Y;
                info.HitType = FormulaHitType.htNoWhere;
                int x    = (int)X;
                int y    = (int)Y;
                int num3 = 0;
                foreach (FormulaArea area in this.Areas)
                {
                    if (!area.Visible)
                    {
                        continue;
                    }
                    if (num3 == 0)
                    {
                        Rectangle rect = area.Canvas.Rect;
                        int       num4 = ((int)X) - rect.X;
                        info.CursorPos = area.Canvas.Stop + ((int)(((double)num4) / this.ColumnWidth));
                        num3++;
                    }
                    if (Math.Abs((int)(area.Rect.Bottom - y)) < 3)
                    {
                        info.Area    = area;
                        info.HitType = FormulaHitType.htSize;
                        return(info);
                    }
                    if (area.Rect.Contains(x, y))
                    {
                        info.Area    = area;
                        info.HitType = FormulaHitType.htArea;
                        foreach (FormulaAxisY sy in area.AxisYs)
                        {
                            if (sy.Visible && sy.FrameRect.Contains(x, y))
                            {
                                info.HitType = FormulaHitType.htAxisY;
                                info.AxisY   = sy;
                                break;
                            }
                        }
                        foreach (FormulaAxisX sx in area.AxisXs)
                        {
                            if (sx.Visible && sx.Rect.Contains(x, y))
                            {
                                info.HitType = FormulaHitType.htAxisX;
                                info.AxisX   = sx;
                                break;
                            }
                        }
                        continue;
                    }
                }
            }
            return(info);
        }
Пример #4
0
        public void DrawCursor(Graphics g, float X, float Y, bool ChangeCursorPosByXY)
        {
            if ((this.DataProvider != null) && this.ShowCursorLabel)
            {
                this.CurrentGraph = g;
                FormulaHitInfo hitInfo = this.GetHitInfo(X, Y);
                if (hitInfo.HitType != FormulaHitType.htArea)
                {
                    this.HideCursor(g);
                }
                else if (this.Rect.Contains((int)X, (int)Y))
                {
                    int num = 0;
                    if (this.ShowHLine)
                    {
                        if ((this.BitmapCache && !this.LastHLine.IsEmpty) && (this.MemBmp != null))
                        {
                            this.RestoreMemBmp(g, this.LastHLine);
                        }
                        g.DrawLine(this.CursorPen, (float)this.Rect.X, Y, (float)this.Rect.Right, Y);
                        if (Y != Math.Floor((double)Y))
                        {
                            num = 1;
                        }
                        this.LastHLine.X      = 0f;
                        this.LastHLine.Y      = (Y - this.Rect.Y) - num;
                        this.LastHLine.Width  = this.Rect.Width;
                        this.LastHLine.Height = this.CursorPen.Width + num;
                    }
                    if (this.ShowVLine)
                    {
                        if ((this.BitmapCache && !this.LastVLine.IsEmpty) && (this.MemBmp != null))
                        {
                            this.RestoreMemBmp(g, this.LastVLine);
                        }
                        g.DrawLine(this.CursorPen, X, (float)this.Rect.Y, X, (float)this.Rect.Bottom);
                        if (X != Math.Floor((double)X))
                        {
                            num = 1;
                        }
                        this.LastVLine.X      = (X - this.Rect.X) - num;
                        this.LastVLine.Y      = 0f;
                        this.LastVLine.Width  = this.CursorPen.Width + num;
                        this.LastVLine.Height = this.Rect.Height;
                    }
                    if (ChangeCursorPosByXY)
                    {
                        this.SetCursorPos(X, Y);
                    }
                    this.DrawValueText(g);
                    foreach (FormulaArea area in this.Areas)
                    {
                        if (area.Visible && (area != hitInfo.Area))
                        {
                            foreach (FormulaAxisY sy in area.AxisYs)
                            {
                                this.RestoreMemBmp(g, sy.LastCursorRect);
                                sy.LastCursorRect = RectangleF.Empty;
                            }
                            continue;
                        }
                    }
                    foreach (FormulaAxisY sy2 in hitInfo.Area.AxisYs)
                    {
                        sy2.DrawCursor(g, this, hitInfo.Area, Y);
                    }
                    for (int i = this.Areas.Count - 1; i >= 0; i--)
                    {
                        if (this.Areas[i].AxisX.Visible)
                        {
                            this.Areas[i].AxisX.DrawCursor(g, this, this.Areas[i], X);
                            break;
                        }
                    }

                    //  WaterMark(g, this.Areas[0].Rect, this.Code);
                }
            }
        }
Пример #5
0
        public void SetCursorPos(float X, float Y)
        {
            FormulaHitInfo hitInfo = this.GetHitInfo(X, Y);

            this.CursorPos = hitInfo.CursorPos;
        }