I have this code:
private void HandleGUI()
{
if (_currentForm == null)
{
navigationSideBar1.Visible = false;
pnlToolbar.Visible = false;
return;
}
if (_currentForm.ShowNavigationBar)
{
HandleNavigationButton(_currentForm);
}
btnSave.Visible = _currentForm.ShowSaveButton;
btnClose.Visible = _currentForm.ShowCloseButton;
btnSave.Paint += new PaintEventHandler(btnSave_Paint);
navigationSideBar1.Visible = _currentForm.ShowNavigationBar;
pnlToolbar.Visible = _currentForm.ShowToolBar;
btnSave.Refresh();
btnSave.Invalidate();
}
I am registered on the onpaint event of the save button (btnSave), but this event is not fired, even when I call Refresh or Invalidate. How is this possible?
EDIT:
This is how the saave button class looks like:
public class SaveButton : ButtonX
{
public SaveButton()
{
this.Image = Properties.Resources.Save;
this.Text = "Opslaan";
this.Size = new Size(108, 39);
}
}
Try adding a regular DevComponent button (i.e. not a subclass of it) to a test form and see if it ever fires its Paint event. They may have exposed a Paint event (so that their interface matches that of a regular button) but not actually implemented it.