/// <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(); }
void form_FormClosing(object sender, FormClosingEventArgs e) { Form form = OnDoubleClickReBackViewEvent(); form.ActiveControl.Controls.Add(this); if (animalion != null) { animalion.IsPrepareAnimaled = false; } doubleClickTimes--; adapter.setIndex(-1); currentScrollY = 0; IsShowVerticalBar = false; }
/// <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(); }
/// <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); }
/// <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); }
/// <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); }