//*******************************************************************
void CButtonAppearanceDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	if (m_pUserTool != NULL)
	{
		m_pUserTool->DrawToolIcon (&dc, m_rectDefaultImage);
		return;
	}

	if (m_pButton->IsLocked ())
	{
		BOOL bText = m_pButton->m_bText;
		BOOL bImage = m_pButton->m_bImage;

		m_pButton->m_bText = FALSE;
		m_pButton->m_bImage = TRUE;

		m_pButton->OnDraw (&dc, m_rectDefaultImage, NULL, TRUE, FALSE, FALSE, FALSE, FALSE);

		m_pButton->m_bText = bText;
		m_pButton->m_bImage = bImage;

		return;
	}

	int iImage = CBCGPToolBar::GetDefaultImage (m_pButton->m_nID);
	if (iImage < 0 || !m_bImage)
	{
		return;
	}

	CBCGPToolBarImages* pImages = CBCGPToolBar::GetImages ();
	ASSERT (pImages != NULL);

	CBCGPDrawState ds(CBCGPVisualManager::GetInstance()->IsAutoGrayscaleImages());
	pImages->PrepareDrawImage (ds, m_rectDefaultImage.Size ());
	
	pImages->Draw (&dc, m_rectDefaultImage.left, m_rectDefaultImage.top, iImage);
	pImages->EndDrawImage (ds);
}