Ejemplo n.º 1
0
        private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            Graphics g = e.Graphics;

            if ((e.State & DrawItemState.ComboBoxEdit) > 0)
            {
                TextRenderer.DrawText(g, ComboBoxEx.Text, e.Font, e.Bounds.Location, e.ForeColor, e.BackColor);
            }
            else if (e.Index >= 0)
            {
                string name = (string)Items[e.Index];
                using (TextObject sample = new TextObject())
                {
                    sample.Bounds    = new RectangleF(e.Bounds.Left + 2, e.Bounds.Top + 2, e.Bounds.Width - 4, e.Bounds.Height - 4);
                    sample.Text      = name;
                    sample.HorzAlign = HorzAlign.Center;
                    sample.VertAlign = VertAlign.Center;
                    if (FReport != null)
                    {
                        int index = FReport.Styles.IndexOf(name);
                        if (index != -1)
                        {
                            sample.ApplyStyle(FReport.Styles[index]);
                        }
                    }
                    using (GraphicCache cache = new GraphicCache())
                    {
                        sample.Draw(new FRPaintEventArgs(g, 1, 1, cache));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            e.DrawBackground();
            Graphics g = e.Graphics;

            if (e.Index >= 0)
            {
                string name = (string)Items[e.Index];
                using (TextObject sample = new TextObject())
                {
                    sample.Bounds    = new RectangleF(e.Bounds.Left + 2, e.Bounds.Top + 2, e.Bounds.Width - 4, e.Bounds.Height - 4);
                    sample.Text      = name;
                    sample.HorzAlign = HorzAlign.Center;
                    sample.VertAlign = VertAlign.Center;
                    if (FStyles != null)
                    {
                        int index = FStyles.IndexOf(name);
                        if (index != -1)
                        {
                            sample.ApplyStyle(FStyles[index]);
                        }
                    }
                    using (GraphicCache cache = new GraphicCache())
                    {
                        sample.Draw(new FRPaintEventArgs(g, 1, 1, cache));
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void pnSample_Paint(object sender, PaintEventArgs e)
 {
     if (CurrentStyle == null)
     {
         return;
     }
     FSample.ApplyStyle(CurrentStyle);
     FSample.Bounds    = new RectangleF(2, 2, pnSample.Width - 4, pnSample.Height - 4);
     FSample.HorzAlign = HorzAlign.Center;
     FSample.VertAlign = VertAlign.Center;
     using (GraphicCache cache = new GraphicCache())
     {
         FSample.Draw(new FRPaintEventArgs(e.Graphics, 1, 1, cache));
     }
 }