Hello,
I create a custom control inherited from Windows.System.Forms.Controls.
This is my code of this control:
public partial class MonthEventComponent : Control
{
private Color couleur;
private Label labelEvenement;
public MonthEventComponent(Color couleur_c, String labelEvenement_c )
{
InitializeComponent();
this.couleur = couleur_c;
this.labelEvenement.Text = labelEvenement_c;
this.labelEvenement.ForeColor = couleur;
this.labelEvenement.BackColor = Color.White;
this.labelEvenement.TextAlign = ContentAlignment.MiddleLeft;
this.labelEvenement.Dock = DockStyle.Fill;
this.Controls.Add(labelEvenement);
}
public MonthEventComponent()
{
InitializeComponent();
this.couleur = Color.Black;
this.labelEvenement = new Label();
this.labelEvenement.ForeColor = couleur;
this.labelEvenement.BackColor = Color.White;
this.labelEvenement.Text = "Evénement Initialiser";
this.labelEvenement.TextAlign = ContentAlignment.MiddleLeft;
this.labelEvenement.Dock = DockStyle.Fill;
this.Controls.Add(labelEvenement);
}
protected override void OnClick(EventArgs e)
{
base.OnClick(e);
MessageBox.Show("Click");
}
}
I would like to insert this control or multiple of this control on a DataGridViewCell but i don't know how to do this.
Thank you in advance for your answer,
Best Regards,
PS: I'm french, i'm apologize for any can of language errors.