public class TabPageWithBackground : TabPage { private Rectangle _backgroundRect; private Bitmap _background; public TabPageWithBackground() { _background = Resource1.ImageBackground; _backgroundRect = new Rectangle(0, 0, _background.Width, _background.Height); this.Size = new System.Drawing.Size(100, 20); } protected override void OnPaintBackground(PaintEventArgs e) { Graphics g = e.Graphics; g.DrawImage(_background, this.ClientRectangle, _backgroundRect, GraphicsUnit.Pixel); } }
// gloable Image _img = null; // form load _img = new Bitmap("imgNimporteQuelleTaille.jpg"); // Affiche image sur page 3 du tabControl tabControl1.TabPages[2].BackgroundImage = _img;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question