Monday, November 30, 2009

Dialog Box in The Shape of Circle













BOOL CSonal2Dlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
CDialog::OnInitDialog();
CRect rect;
CRgn hc;
GetWindowRect(&rect);
hc.CreateEllipticRgn(0,0,rect.right,rect.bottom);
SetWindowRgn(hc,true);
return TRUE; // return TRUE unless you set the focus to a control
}

void CSonal2Dlg::OnPaint()
{
if (IsIconic())
{
…………
………....
}
else
{

CPaintDC pDC(this);
CRect rect;
GetClientRect(&rect);
CBrush mybrush;
mybrush.CreateSolidBrush(RGB(255,128,192));
CBrush *oldbrush=pDC.SelectObject(&mybrush);
pDC.FillRect(&rect,&mybrush);
pDC.SelectObject(oldbrush);
pDC.SetBkMode(TRANSPARENT);
CDialog::OnPaint();
}
}

No comments:

Post a Comment