Beispiel #1
0
        /// <summary>
        /// 鼠标移动事件, 委托给用户鼠标经过的图形化位置数据
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseMove(MouseEventArgs e)
        {
            int x = e.X;
            int y = e.Y;

            if (adapter != null)
            {
                //设置起始位置
                adapter.setIndex(-1);
                //遍历所有数据源
                while (adapter.next())
                {
                    DataModel data = adapter.getItem();
                    if (data.Area.isInRect(x, y))
                    {
                        //判定鼠标是否在这个区域上面
                        data.Area.IsMouseIn = true;
                        //委托事件传递
                        if (OnMouseMove_ReportViewPanelEvent != null)
                        {
                            OnMouseMove_ReportViewPanelEvent(data);
                        }
                    }
                    else
                    {
                        data.Area.IsMouseIn = false;
                    }
                }
            }
            //PopView显示具体某条数据
            if (toolTip != null)
            {
                //如果超出边界
                if (x > this.Width - toolTip.Width - padding)
                {
                    if (x > this.Width - padding)
                    {
                        toolTip.isVisible = false;
                    }
                    else
                    {
                        x = this.Width - toolTip.Width - 2 * padding;
                        toolTip.isVisible = true;
                    }
                }
                if (x < 0)
                {
                    toolTip.isVisible = false;
                }
                if (y > this.Height - toolTip.Height - padding)
                {
                    y = this.Height - toolTip.Height - padding;
                }
                toolTip.LocalPosition = new Point(x, y);
            }
            this.Invalidate();
        }
Beispiel #2
0
        /// <summary>
        /// 绘制操作
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            //自己声明的Graphics
            Graphics g = e.Graphics;

            if (backGroundColor != null)
            {
                Brush     background = new SolidBrush(backGroundColor);
                Rectangle rect       = new Rectangle(0, 0, this.Width, this.Height);
                g.FillRectangle(background, rect);
                background.Dispose();
            }
            if (adapter != null)
            {
                adapter.setIndex(-1);
                DataModel        data     = null;
                PositionRectData rectData = null;
                while (adapter.next())
                {
                    data     = adapter.getItem();
                    rectData = adapter.getPositionRect();
                    childPaint(e, rectData, myColor, TextColor);
                    rectData.right = this.Width;
                    list.Add(rectData);
                }

                introducePaint(g, currentData, myColor, TextColor);
            }
            //释放资源
            //utils.disposeGraphics(g);
            //g.Dispose();
        }
Beispiel #3
0
        /// <summary>
        /// 鼠标移动事件, 委托给用户鼠标经过的图形化位置数据
        /// </summary>
        protected override void OnMouseMove(MouseEventArgs e)
        {
            int x = e.X;
            int y = e.Y;

            if (adapter != null)
            {
                //设置起始位置
                adapter.setIndex(-1);
                //遍历所有数据源
                while (adapter.next())
                {
                    DataModel data = adapter.getItem();
                    if (data == null)
                    {
                        return;
                    }
                    //判定鼠标是否在这个区域上面
                    bool isIn;
                    if (IsCoordinateReportView)
                    {
                        isIn = data.Area.isInRect(x, y, true);
                    }
                    else
                    {
                        isIn = data.Area.isInRect(x, y, false);
                    }
                    if (isIn)
                    {
                        if (animalion != null && !isNotAllowShowAnimalion)
                        {
                            //触发动画效果
                            animalion.IsPrepareAnimaled = true;
                        }
                        data.Area.IsMouseIn = true;
                        //委托事件传递
                        if (OnMouseMove_ReportViewPanelEvent != null)
                        {
                            OnMouseMove_ReportViewPanelEvent(data);
                        }
                    }
                    else
                    {
                        data.Area.IsMouseIn = false;
                    }
                }
            }
            //PopView显示具体某条数据
            if (toolTip != null)
            {
                if (x > this.Width - toolTip.Width - padding)
                {
                    //如果没有超出边界
                    if (x < (this.Width - padding))
                    {
                        if (isNeedReLocationToopTip)
                        {
                            x = this.Width - toolTip.Width - 2 * padding;
                        }
                    }
                }
                if (y > this.Height - toolTip.Height)
                {
                    y = this.Height - toolTip.Height;
                }
                toolTip.LocalPosition = new Point(x, y);
            }

            if (animalion == null || !animalion.IsPrepareAnimaled)
            {
                InvalidateView();
            }
        }