private Bitmap GetImage(HighlightCondition c) { Bitmap bmp = new Bitmap(16, 16); using (Graphics g = Graphics.FromImage(bmp)) { g.FillRectangle(Brushes.White, 0, 0, 16, 16); using (TextObject sample = new TextObject()) { sample.Bounds = new RectangleF(0, 0, 15, 15); sample.ApplyCondition(c); sample.Font = new Font("Times New Roman", 12, FontStyle.Bold); sample.Text = "A"; sample.HorzAlign = HorzAlign.Center; sample.VertAlign = VertAlign.Center; using (GraphicCache cache = new GraphicCache()) { sample.Draw(new FRPaintEventArgs(g, 1, 1, cache)); } } } return(bmp); }
private void pnSample_Paint(object sender, PaintEventArgs e) { if (CurrentCondition == null) { return; } TextObject sample = new TextObject(); sample.Text = Res.Get("Misc,Sample"); sample.ApplyCondition(CurrentCondition); sample.Bounds = new RectangleF(2, 2, pnSample.Width - 4, pnSample.Height - 4); sample.HorzAlign = HorzAlign.Center; sample.VertAlign = VertAlign.Center; using (GraphicCache cache = new GraphicCache()) { sample.Draw(new FRPaintEventArgs(e.Graphics, 1, 1, cache)); } }