public MedCurve(MedPointList points, int xaxisindex, int yaxisindex, MedSymbol symbol, System.Drawing.Pen pen, string title, bool hasLine) { this._points = points; this._XaxisIndex = xaxisindex; this._YaxisIndex = yaxisindex; if (_pen != null) { _pen.Dispose(); } this._pen = pen; if (_symbol != null) { _symbol.Dispose(); } if (symbol == null) { this._symbol = new MedSymbol(MedSymbolType.None); } else { this._symbol = symbol; } _symbol.Pen = _pen; _title = title; _hasLine = hasLine; }
///修改备注 ///2008-6-9 于占涛增加Add方法重载,用来判断数据值是否偏离参考值范围 public void Add(double x, double y, MedSymbol symbol, string memo, bool isAbnormal) { MedPoint MedPoint1 = new MedPoint(x, y, symbol, memo); MedPoint1.IsAbnormal = isAbnormal; List.Add(MedPoint1); }
///修改备注 ///2008-6-8 于占涛增加Add方法重载,用来在首界面保存检查,检验,血气分析主键ID用 public void Add(double x, double y, MedSymbol symbol, string memo, string keys) { MedPoint MedPoint1 = new MedPoint(x, y, symbol, memo); MedPoint1.RefKeyID = keys; List.Add(MedPoint1); }
public MedPoint(double X, double Y, MedSymbol symbol, string memo) { this.X = X; this.Y = Y; this.symbol = symbol; this.Memo = memo; }
public MedCurve addCurve(string title, MedPointList points, MedSymbol symbol, Pen pen, int xaxisindex, int yaxisindex) { MedCurve curve = new MedCurve(points, xaxisindex, yaxisindex, symbol, pen); curve.Title = title; _curveList.Add(curve); return(curve); }
public void AddPoint(DateTime timePoint, int index, string text, MedSymbol symbol, Color color, string alias) { //if(IndexOf(timePoint) >= 0) //{ // throw new Exception("该时间点已存在"); //} _points.Add(new EventMarkPoint(timePoint, index, text, symbol, color, alias)); }
public EventMarkPoint(DateTime timePoint, int index, string text, MedSymbol symbol, Color color, string alias) { _index = index; _timePoint = timePoint; _symbol = symbol; _text = text; _color = color; _alias = alias; }
public MedVitalSignCurve(string text, int yAxisIndex, Color color, MedSymbol symbol, bool isDigit) { _text = text; _yAxisIndex = yAxisIndex; _color = color; _symbol = symbol; _symbol.Pen.Color = color; _isDigit = isDigit; }
public void Draw(Graphics g, RectangleF rectF) { using (Brush brush = new SolidBrush(ForeColor)) { if (Image != null) { g.DrawImage(Image, rectF); } else if (_symbolType != MedSymbolType.None) { MedSymbol symbol = new MedSymbol(_symbolType); symbol.Size = 8; symbol.Pen = new Pen(ForeColor); symbol.Draw(g, rectF.X + symbol.Size / 2, rectF.Y + symbol.Size / 2); } else if (_multiLine) { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Near; g.DrawString(Text, Font, brush, rectF, sf); } else { switch (TextAlign) { case ContentAlignment.MiddleCenter: g.DrawString(Text, Font, brush, rectF.X + (rectF.Width - g.MeasureString(Text, Font).Width) / 2, rectF.Y + (rectF.Height - g.MeasureString(Text, Font).Height) / 2); break; default: g.DrawString(Text, Font, brush, rectF.X, rectF.Y); break; } } } }
/// <summary> /// 构造方法 /// </summary> /// <param name="text">文本(名称)</param> /// <param name="yAxisIndex">Y坐标索引</param> /// <param name="color">颜色</param> /// <param name="symbol">标识</param> public MedVitalSignCurve(string text, int yAxisIndex, Color color, MedSymbol symbol) : this(text, yAxisIndex, color, symbol, false) { }
public MedCurve addCurve(MedPointList points, MedSymbol symbol, Pen pen, int xaxisindex, int yaxisindex) { return(addCurve("", points, symbol, pen, xaxisindex, yaxisindex)); }
public MedPoint(double X, double Y, MedSymbol symbol) : this(X, Y, symbol, null) { }
public void Add(double x, double y, MedSymbol symbol, string memo) { List.Add(new MedPoint(x, y, symbol, memo)); }
public MedCurve addCurve(string title, MedPointList points, MedSymbol symbol, Pen pen) { return(addCurve(title, points, symbol, pen, 0, 0)); }
public MedCurve(MedPointList points, System.Drawing.Image image) : this(points) { _symbol = new MedSymbol(image); _symbol.Pen = _pen; }
public void Add(double x, double y, MedSymbol symbol) { List.Add(new MedPoint(x, y, symbol)); }
public MedCurve(MedPointList points, int xaxisindex, int yaxisindex, MedSymbol symbol, System.Drawing.Pen pen) : this(points, xaxisindex, yaxisindex, symbol, pen, null) { }
public MedCurve(MedPointList points, int xaxisindex, int yaxisindex, MedSymbol symbol, System.Drawing.Pen pen, string title) : this(points, xaxisindex, yaxisindex, symbol, pen, title, true) { }
public MedCurve addCurve(MedPointList points, MedSymbol symbol, Pen pen) { return(addCurve("", points, symbol, pen)); }
public void ReCalLastIndex(Dictionary <string, MedLegeng> symbolDict) { using (Graphics g = this.CreateGraphics()) { List <string> aliass = new List <string>(); RectangleF rectF = new RectangleF(OriginRect.X + 6, OriginRect.Y + 2, OriginRect.Width - 4, OriginRect.Height - 4); int index = 0; int idx = 0; if (_legendType == LegengType.Vertical) { //float offX = 5; float rowHeight = g.MeasureString("平均动脉压", Font).Height; foreach (string str in symbolDict.Keys) { idx++; if (string.IsNullOrEmpty(str) || aliass.Contains(str)) { continue; } if ((idx - 1) >= _startLegendIndex) { if (rectF.Y + 1 + (index + 1) * rowHeight > rectF.Bottom) { break; } aliass.Add(str); index++; } } } else if (_legendType == LegengType.Horizontal) { //float rowHeight = g.MeasureString("平均动脉压", Font).Height + 2; float rowHeight = g.MeasureString("平均动脉压", Font).Height; MedSymbol symbol = null; float symbolPosX = 0, symbolStringPosY = 0, symbolPosY; float offX = 5; float rowSplitWidth = 10; //行项与项之间距 symbolPosX = rectF.X + offX; // symbolPosY = rectF.Y + (rowHeight) / 2; symbolPosY = rectF.Y + this.Height / 2; symbolStringPosY = rectF.Y + this.Height / 2 - rowHeight / 2; foreach (string str in symbolDict.Keys) { idx++; if (string.IsNullOrEmpty(str) || aliass.Contains(str)) { continue; } float rowWidth = g.MeasureString(str, Font).Width + 4f; if ((idx - 1) >= _startLegendIndex) { symbol = symbolDict[str].LegengSymbol; if ((symbolPosX + symbol.Size + offX + g.MeasureString(str, Font).Width + rowSplitWidth + offX) > rectF.Right) { break; } aliass.Add(str); symbolPosY = rectF.Y + (this.Height - symbol.Size) / 2; symbolPosX += symbol.Size + offX; //加上偏移 symbolPosX += g.MeasureString(symbolDict[str].LegengName, Font).Width + rowSplitWidth + offX; index++; } } } _endLegendIndex = idx == 0 ? 0 : (idx - 1); } }
public override void DrawGraphics(Graphics g) { base.DrawGraphics(g); using (SolidBrush solidBrush = new SolidBrush(Color.White)) { g.FillRectangle(solidBrush, OriginRect); } RectangleF rectF = new RectangleF(OriginRect.X + 2, OriginRect.Y + 2, OriginRect.Width - 4, OriginRect.Height - 4); if (_vitalSign != null && _legendType == LegengType.Vertical) { _vitalSign.DrawLegend(g, rectF); } else { List <string> aliass = new List <string>(); int index = 0; int idx = 0; if (_legendType == LegengType.Vertical) { float offX = 5; float rowHeight = g.MeasureString("平均动脉压", Font).Height; foreach (string str in _symbolDict.Keys) { idx++; if (string.IsNullOrEmpty(str) || aliass.Contains(str)) { continue; } if ((idx - 1) >= _startLegendIndex) { if (rectF.Y + 1 + (index + 1) * rowHeight > rectF.Bottom) { break; } aliass.Add(str); _symbolDict[str].LegengSymbol.Draw(g, rectF.X + offX, rectF.Y + (rowHeight) / 2 + index * rowHeight); using (SolidBrush solidBrush = new SolidBrush(_symbolDict[str].LegengSymbol.Pen.Color)) { g.DrawString(_symbolDict[str].LegengName, Font, solidBrush, rectF.X + 3 + _symbolDict[str].LegengSymbol.Size, rectF.Y + 1 + index * rowHeight); } index++; } } } else if (_legendType == LegengType.Horizontal) { //float rowHeight = g.MeasureString("平均动脉压", Font).Height + 2; float rowHeight = g.MeasureString("平均动脉压", Font).Height; MedSymbol symbol = null; float symbolPosX = 0, symbolStringPosY = 0, symbolPosY; float offX = 5; float rowSplitWidth = 10; //行项与项之间距 symbolPosX = rectF.X + offX; //symbolPosY = rectF.Y + (rowHeight) / 2; symbolPosY = rectF.Y + this.Height / 2; symbolStringPosY = rectF.Y + this.Height / 2 - rowHeight / 2; foreach (string str in _symbolDict.Keys) { idx++; if (string.IsNullOrEmpty(str) || aliass.Contains(str)) { continue; } float rowWidth = g.MeasureString(str, Font).Width + 4f; if ((idx - 1) >= _startLegendIndex) { symbol = _symbolDict[str].LegengSymbol; if ((symbolPosX + symbol.Size + offX + g.MeasureString(str, Font).Width + rowSplitWidth + offX) > rectF.Right) { break; } symbolPosY = rectF.Y + (this.Height - symbol.Size) / 2; aliass.Add(str); symbol.Draw(g, symbolPosX, symbolPosY); symbolPosX += symbol.Size + offX; //加上偏移 using (SolidBrush solidBrush3 = new SolidBrush(symbol.Pen.Color)) { g.DrawString(_symbolDict[str].LegengName, Font, solidBrush3, symbolPosX, symbolStringPosY); } symbolPosX += g.MeasureString(_symbolDict[str].LegengName, Font).Width + rowSplitWidth + offX; index++; } } } _endLegendIndex = idx == 0 ? 0 : (idx - 1); } PaintEventHandler eventHandle = Events[_customDraw] as PaintEventHandler; if (eventHandle != null) { eventHandle(this, new PaintEventArgs(g, ClientRectangle)); } }