Refresh toolbar icon

  • Thread starter Thread starter Peter Hartlén
  • Start date Start date
P

Peter Hartlén

Hi!

Using PocketPC 2003 SE, CF 1 SP3

I'm switching the toolbar icon of a certain toolbar button. The icon is
identical except for a red cross in the upper right corner. The problem is
that when switching from the icon with red cross to the icon without, the
cross remains.

I've tried toolBar.Refresh, toolBar.Invalidate(), and
this.Invalidate(toolBar.ClientRectangle) but it seems this can't be done
this way. Leaving and entering the screen works however...

I just change the image index of the ToolBarButton like this:

if ( foo )
toolBar.Buttons[m_iBtnCameraIndex].ImageIndex = m_iIcoCamera1Index;
else
toolBar.Buttons[m_iBtnCameraIndex].ImageIndex = m_iIcoCamera2Index;

//toolBar.Refresh();
//toolBar.Invalidate();
this.Invalidate(toolBar.ClientRectangle);

Any ideas?

Thanks,

Peter
 
I solved this by hiding and showing the icon.

if ( foo )
{
toolBar.Buttons[m_iBtnCameraIndex].Visible = false;
toolBar.Buttons[m_iBtnCameraIndex].ImageIndex = m_iIcoCamera1Index;
toolBar.Buttons[m_iBtnCameraIndex].Visible = true;
}
else
toolBar.Buttons[m_iBtnCameraIndex].ImageIndex = m_iIcoCamera2Index;

Regards,

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top