Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 3
0
        /// <summary>
        /// 设置适配器
        /// </summary>
        /// <param name="adapter"></param>
        public void setAdapter(ReportViewAdapter adapter)
        {
            this.adapter = adapter;
            int count = adapter.getCount();

            adapter.next();
            if (isVerticalShowData)
            {
                //设置高度
                int height = adapter.getPositionRect().bottom - adapter.getPositionRect().top + padding;
                //this.Height = height * count + padding;

                Label lable = new Label();
                lable.Location = new Point(0, height * count + padding);
                lable.Text     = "";
                lable.Width    = 0;
                this.Controls.Add(lable);
            }
            else
            {
                //设置宽度
                int width = adapter.getPositionRect().right - adapter.getPositionRect().left + padding;
                this.Width = width * count + padding;
            }

            adapter.setIndex(-1);
        }
Esempio n. 4
0
        /// <summary>
        /// 设置适配器
        /// </summary>
        /// <param name="adapter"></param>
        internal void setAdapter(ReportViewAdapter adapter)
        {
            this.adapter = adapter;
            //设置高度
            int count = adapter.getCount();

            adapter.next();
            int height = adapter.getPositionRect().bottom - adapter.getPositionRect().top + adapter.getPadding();

            this.Height = height * count + adapter.getPadding();
            adapter.setIndex(-1);
        }
Esempio n. 5
0
        /// <summary>
        /// 设置适配器
        /// </summary>
        public void setAdapter(ReportViewAdapter adapter)
        {
            this.adapter = adapter;
            int count = adapter.getCount();

            adapter.next();
            if (adapter.IsVerticalShowData)
            {
                if (adapter.PosRectData != null)
                {
                    //设置高度
                    int height = adapter.PosRectData.bottom - adapter.PosRectData.top + adapter.PosRectData.PaddingIn;
                    MaxHeight = height * count;
                }
            }
            adapter.setIndex(-1);
        }
Esempio n. 6
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();
            }
        }