Text auf PictureBox



  • Hallo Zusammen,

    ich würde gerne wissen, wie genau ich einen Text auf eine PictureBox schreiben kann.
    Wenns geht natürlich ohne Labels.

    Schon einmal Vielen Dank.

    Viele Grüße
    Sven



  • Habs hiermit gelöst

    StringFormat strFormat = new StringFormat();
                SolidBrush myBrush = new SolidBrush(Color.Black);
                Font myfont = new Font("Arial", 16, FontStyle.Bold);
                int fheight =(int)e.Graphics.MeasureString("Test", myfont).Height;
                strFormat.Alignment = StringAlignment.Center;
    
                e.Graphics.DrawString("Test", myfont, myBrush, (credit_button.Width / 2), (int)(credit_button.Height / 2 - 0.5 * fheight), strFormat);
    

Anmelden zum Antworten