void ContainerBox::OnPaint(IRenderTarget* pRT)
{
CRect rcClient = GetClientRect();
CPoint ptCenter = rcClient.CenterPoint();
SStringW sstrFontFormat = L"face:宋体,bold:0,italic:0,underline:0,strike:0,size:30";
SOUI::IFontPtr pFont = SFontPool::GetFont(sstrFontFormat, GetScale());
pRT->SelectObject(pFont);
CRect rcTemp;
rcTemp.left = ptCenter.x - 100;
rcTemp.right = ptCenter.x + 100;
rcTemp.top = ptCenter.y - 50;
rcTemp.bottom = ptCenter.y + 50;
SStringW sstrTxt = L"1234567890A";
{
{
COLORREF clrBkgnd = GETCOLOR(L"RGB(0,255,0)");
CAutoRefPtr<IBrush> brush, oldbrush;
pRT->CreateSolidColorBrush(clrBkgnd, &brush);
pRT->SelectObject(brush, (IRenderObj**)&oldbrush);
pRT->FillRectangle(&rcTemp);
pRT->SelectObject(oldbrush, NULL);
}
pRT->DrawText(sstrTxt, -1, (LPRECT)rcTemp, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
}
{
CRect rcMirror(rcTemp);
rcMirror.left = rcTemp.right;
rcMirror.right = rcMirror.left + rcTemp.Width();
SMatrix matrix;
matrix.setScale2(-1, 1, ptCenter.x, ptCenter.y);
pRT->SetTransform(matrix.fMat, NULL);
pRT->DrawText(sstrTxt, -1, (LPRECT)rcMirror, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
pRT->SetTransform(SMatrix().fMat, NULL);
}
{
CRect rcMirror(rcTemp);
rcMirror.left = rcTemp.left - rcTemp.Width();
rcMirror.right = rcTemp.left;
SMatrix matrix;
matrix.setScale2(-1, 1, ptCenter.x, ptCenter.y);
pRT->SetTransform(matrix.fMat, NULL);
pRT->DrawText(sstrTxt, -1, (LPRECT)rcMirror, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
pRT->SetTransform(SMatrix().fMat, NULL);
}
{
CRect rcMirror(rcTemp);
rcMirror.top = rcTemp.bottom;
rcMirror.bottom = rcMirror.top + rcTemp.Height();
SMatrix matrix;
matrix.setScale2(1, -1, ptCenter.x, ptCenter.y);
pRT->SetTransform(matrix.fMat, NULL);
pRT->DrawText(sstrTxt, -1, (LPRECT)rcMirror, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
pRT->SetTransform(SMatrix().fMat, NULL);
}
{
CRect rcMirror(rcTemp);
rcMirror.bottom = rcTemp.top;
rcMirror.top = rcTemp.top - rcTemp.Height();
SMatrix matrix;
matrix.setScale2(1, -1, ptCenter.x, ptCenter.y);
pRT->SetTransform(matrix.fMat, NULL);
pRT->DrawText(sstrTxt, -1, (LPRECT)rcMirror, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
pRT->SetTransform(SMatrix().fMat, NULL);
}
}