protected override void DrawText(Graphics gr) { if (this.properties == null) { return; } LinkGraphic.SetGraphicsMode(gr, !Quality); Pen linepen = new Pen(Color.FromArgb(90, Color.Black)); gr.DrawLine(linepen, new Point(0, 20), new Point(Width, 20)); linepen.Dispose(); StringFormat sf = new StringFormat(); sf.FormatFlags = StringFormatFlags.NoWrap; Font ftb = new Font(Font.FontFamily, Font.Size, FontStyle.Bold, Font.Unit); gr.DrawString(Text, ftb, new Pen(this.ForeColor).Brush, new RectangleF(new PointF(4, 4), new SizeF(Width - 8, Height - 8)), sf); ftb.Dispose(); int top = 24; Size indent = new Size(0, 0); if (thumb != null) { gr.DrawImageUnscaled(thumb, 4, top, thumb.Width, thumb.Height); indent = new Size(thumb.Width + 4, top + thumb.Height + 4); } //Hashtable ht = new Hashtable(); foreach (string k in properties.Keys) { PropertyItem o = properties[k]; if (o == null) { continue; } string val = ""; val = (string)o.Value; if (val != null) { int indentx = 0; if (top < indent.Height) { indentx = indent.Width; } Font ft = new Font(Font.FontFamily, Font.Size, FontStyle.Italic, Font.Unit); gr.DrawString( k + ":", ft, new Pen(Color.FromArgb(160, this.ForeColor)).Brush, new RectangleF(new PointF(indentx + 10, top), new SizeF(Width - (24 + indentx), top + 16)), sf); SizeF sz = gr.MeasureString( k + ":", ft); gr.DrawString( val, Font, new Pen(Color.FromArgb(140, this.ForeColor)).Brush, new RectangleF(new PointF(indentx + 12 + sz.Width, top), new SizeF(Width - (24 + sz.Width + indentx), top + 16)), sf); SizeF sz2 = gr.MeasureString( val, Font); Rectangle rect = new Rectangle(new Point((int)(indentx + 12 + sz.Width), top), new Size((int)(Width - (24 + sz.Width + indentx)), top + 16)); top += (int)Math.Max(sz.Height, sz2.Height); ft.Dispose(); } } //LinkGraphic.SetGraphicsMode(gr, true); //properties = ht; }
protected void DrawText(Graphics gr, Rectangle prec, Rectangle trec) { if (this.properties == null) { return; } LinkGraphic.SetGraphicsMode(gr, !Quality); Font ftb = new Font(Font.FontFamily, Font.Size, FontStyle.Bold, Font.Unit); this.DrawCaption(gr, new Rectangle(trec.Right + 2, prec.Top, prec.Width - (trec.Right - prec.Left) - 4 - this.ImageBorderWidth, 16), ftb, false); Pen linepen = new Pen(Color.FromArgb(90, Color.Black)); gr.DrawLine(linepen, new Point(prec.Left, prec.Top + 16), new Point(prec.Right, prec.Top + 16)); linepen.Dispose(); StringFormat sf = new StringFormat(); sf.FormatFlags = StringFormatFlags.NoWrap; int top = prec.Top + 24; Size indent = new Size(trec.Right + 6, trec.Bottom - prec.Top + 7 + 2 * this.ImageBorderWidth); //Hashtable ht = new Hashtable(); foreach (string k in properties.Keys) { PropertyItem o = properties[k]; if (o == null) { continue; } string val = ""; val = (string)o.Value; if (val != null) { int indentx = prec.Left + 6; if (top < indent.Height) { indentx = indent.Width; } Font ft = new Font(Font.FontFamily, Font.Size, FontStyle.Italic, Font.Unit); gr.DrawString( k + ":", ft, new Pen(Color.FromArgb(160, this.ForeColor)).Brush, new RectangleF(new PointF(indentx, top), new SizeF(prec.Width - indentx, top + 16)), sf); SizeF sz = gr.MeasureString( k + ":", ft); gr.DrawString( val, Font, new Pen(Color.FromArgb(140, this.ForeColor)).Brush, new RectangleF(new PointF(indentx + sz.Width, top), new SizeF(prec.Width - indentx - sz.Width, top + 16)), sf); SizeF sz2 = gr.MeasureString( val, Font); Rectangle rect = new Rectangle(new Point((int)(indentx + sz.Width), top), new Size((int)(prec.Width - indentx - sz.Width), top + 16)); top += (int)Math.Max(sz.Height, sz2.Height); ft.Dispose(); } } //LinkGraphic.SetGraphicsMode(gr, true); //properties = ht; }