How i can change border color of Rectangle function in C++/MASM32?
Change border color of Rectangle function in c++
3.8k views Asked by Majed Maniat At
2
There are 2 answers
0
On
you can try something like this, I am just just giving example you can change it according to your requirement.
BOOL CRectangleDlg::OnEraseBkgnd(CDC* pDC)
{
CBrush brushBlue(RGB(0, 0, 255));// inner color blue.
CBrush* pOldBrush = pDC->SelectObject(&brushBlue);
// create and select a thick, black pen
CPen penBlack;
penBlack.CreatePen(PS_SOLID, 3, RGB(255, 0, 0));// red color with width 3
CPen* pOldPen = pDC->SelectObject(&penBlack);
// get our client rectangle
CRect rect;
GetClientRect(rect);// pass rect coordinates here
// shrink our rect 20 pixels in each direction
rect.DeflateRect(20, 20);
// draw a thick black rectangle filled with blue
pDC->Rectangle(rect);
// put back the old objects
pDC->SelectObject(pOldBrush);
pDC->SelectObject(pOldPen);
return true;//CDialog::OnEraseBkgnd(pDC);
}
Here is a quick MASM32 example that I whipped up quick for you: