Problem visual control in vs2005

  • Thread starter Thread starter wavemill
  • Start date Start date
W

wavemill

Hello,

I would like herited of my button control and change my background.
I have try it, but my background is always grey.
Have you got an idea?

This is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ButtonControl
{
public partial class BeButton : System.Windows.Forms.Button
{
public BeButton()
{
InitializeComponent();
}

protected override void OnPaint(PaintEventArgs e)
{
Brush myBrush = new SolidBrush(Color.Blue);
Rectangle destinationRect = new Rectangle(0, 0, this.Width,
this.Height);
e.Graphics.FillRectangle(myBrush, destinationRect);
base.OnPaint(e);
}
}
}

Thank you for your help,

wavemill
 
As long as your device has .NETCF v1.0 SP2 or later the BackColor property
of your Button will change the button's background.

Peter
 
Back
Top