以下是我的代码,大神看看我的代码有什么问题?GDI没有释放?
CRect rect;
GetDlgItem(IDC_STATIC_Status)->GetClientRect(&rect);
FillRect((GetDlgItem(IDC_STATIC_Status)->GetDC())->GetSafeHdc(),&rect,CBrush(GetSysColor(COLOR_3DFACE)));
CDC *pDC=GetDC();
GetDlgItem(IDC_STATIC_Status)->GetWindowRect(&rect);
ScreenToClient(&rect);
CPen pen1;
pen1.CreatePen(PS_SOLID,30,RGB(48,128,20));
pDC->SelectObject(&pen1);
pDC->MoveTo(int(rect.left+rect.Width()/4.0),int(rect.top+rect.Height()/3.0));
pDC->LineTo(int(rect.left+rect.Width()/4.0),int(rect.top+rect.Height()/3.0));
pen1.DeleteObject();
pen1.CreatePen(PS_SOLID,30,RGB(255,215,0));
pDC->SelectObject(&pen1);
pDC->MoveTo(int(rect.left+rect.Width()*2.0/4.0),int(rect.top+rect.Height()/3.0));
pDC->LineTo(int(rect.left+rect.Width()*2.0/4.0),int(rect.top+rect.Height()/3.0));
pen1.DeleteObject();
pen1.CreatePen(PS_SOLID,30,RGB(255,0,0));
pDC->SelectObject(&pen1);
pDC->MoveTo(int(rect.left+rect.Width()*3.0/4.0),int(rect.top+rect.Height()/3.0));
pDC->LineTo(int(rect.left+rect.Width()*3.0/4.0),int(rect.top+rect.Height()/3.0));
pen1.DeleteObject();
CFont font;
font.CreatePointFont(150,"宋体");
pDC->SelectObject(&font);
pDC->SetTextColor(RGB(0,0,0));
pDC->SetBkMode(TRANSPARENT);
pDC->TextOutA(int(rect.left+rect.Width()/4.0-25),int(rect.top+rect.Height()*2.0/3.0),"正常");
pDC->TextOutA(int(rect.left+rect.Width()*2.0/4.0-25),int(rect.top+rect.Height()*2.0/3.0),"预警");
pDC->TextOutA(int(rect.left+rect.Width()*3.0/4.0-25),int(rect.top+rect.Height()*2.0/3.0),"危险");
font.DeleteObject();
ReleaseDC(pDC);