private void DrawVertical(Graphics graphic, float sumPercent, float sumFix) { int x = DisplayRect.X; int y = DisplayRect.Y; int width = DisplayRect.Width; int height = DisplayRect.Height - (int)sumFix; for (int i = 0; i < drawers.Count; i++) { GraphicDrawer_Abstract drawer = drawers[i]; float percent = drawerWidths[i]; bool isFix = isFixs[i]; int currentheight; if (isFix) { currentheight = (int)percent; } else { currentheight = (int)(percent / sumPercent * DisplayRect.Height); } drawer.SetDrawRect(new Rectangle(x, y, width, currentheight)); y += currentheight; drawer.Paint(graphic); } }
public override void Paint(Graphics graphic) { GraphicDrawer_Abstract drawer = drawers[CurrentIndex]; Rectangle rect = this.DisplayRect; drawer.SetDrawRect(rect); if (drawer.Control == null) { drawer.SetControl(this.Control); } drawer.Paint(graphic); }
/// <summary> /// 绘制整个图形,包括画坐标 /// </summary> /// <param name="g"></param> public virtual void DrawGraph(System.Drawing.Graphics g) { if (this.DataProvider == null) return; //画整个外边框 g.DrawRectangle(ColorConfig.Pen_FrameLine, ShowRectangle); //画刻度 DrawScale(g); //画图形 for (int i = 0; i < drawers.Count; i++) { GraphicDrawer_Abstract drawer = drawers[i]; //drawer.DrawFrame(g); drawer.Paint(g); } }
public void Switch(int index) { for (int i = 0; i < drawers.Count; i++) { GraphicDrawer_Abstract drawer = Drawers[i]; if (i == index) { drawer.IsEnable = true; } else { drawer.IsEnable = false; } } this.CurrentIndex = index; this.Paint(); }
public void AddGraphicDrawer(GraphicDrawer_Abstract drawer) { this.drawers.Add(drawer); }
public void AddGraph(GraphicDrawer_Abstract drawer, float percent, bool isFix) { drawers.Add(drawer); drawerWidths.Add(percent); isFixs.Add(isFix); }
public void AddGraph(GraphicDrawer_Abstract drawer, float percent) { AddGraph(drawer, percent, false); }