本文整理汇总了C++中gdiplus::Graphics::ResetTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphics::ResetTransform方法的具体用法?C++ Graphics::ResetTransform怎么用?C++ Graphics::ResetTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdiplus::Graphics
的用法示例。
在下文中一共展示了Graphics::ResetTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawItem
void CTabsControl::DrawItem(CTabControl *item, Gdiplus::Graphics &g)
{
CRect rect = ItemRect(item);
g.ResetTransform();
g.TranslateTransform((REAL)rect.left, (REAL)rect.top);
RectF rf(0.0f, 0.0f, (REAL)rect.Width(), (REAL)rect.Height());
RectF rx;
if(item->selected)
{
#define shadowb 10
CDIB tmp;
tmp.Resize(rect.Width() + shadowb * 2, rect.Height() + shadowb * 2);
if(tmp.Ready())
{
Graphics gt(tmp.bmp);
RectF rx(0, 0, (REAL)tmp.Width(), (REAL)tmp.Height());
GraphicsPath *path = new GraphicsPath();
path->AddLine(rx.X + shadowb, rx.Y + rx.Height - shadowb, rx.X + rx.Width - 2 - shadowb, rx.Y + rx.Height - shadowb);
path->AddLine(rx.X + rx.Width - 2 - shadowb, rx.Y + rx.Height - shadowb, rx.X + rx.Width - 2, rx.Y);
path->AddLine(rx.X + rx.Width - 2, rx.Y, rx.X + rx.Width, rx.Y + rx.Height);
path->AddLine(rx.X + rx.Width, rx.Y + rx.Height, rx.X, rx.Y + rx.Height);
path->AddLine(rx.X, rx.Y, rx.X + shadowb, rx.Y + rx.Height - shadowb);
path->CloseFigure();
SolidBrush brush(0xff000000);
gt.FillPath(&brush, path);
tmp.Blur(tmp.Rect(), CRect(0, 0, 0, 0), shadowb);
g.DrawImage(tmp.bmp, rf, shadowb, shadowb, rf.Width, rf.Height, UnitPixel);
delete path;
}
}
Font font(L"Arial", item->selected ? 8.0f : 8.0f);
StringFormat *stringFormat = new StringFormat();
stringFormat->SetAlignment(StringAlignmentCenter);
stringFormat->SetLineAlignment(StringAlignmentCenter);
stringFormat->SetTrimming(StringTrimmingEllipsisCharacter);
stringFormat->SetFormatFlags(StringFormatFlagsLineLimit);
if(item->icon->Ready())
{
g.SetInterpolationMode(InterpolationModeBicubic);
rx = rf;
rx.Y += 6;
rx.Height -= (20 + rx.Y);
rx.Width = rx.Height;
rx.X += (rf.Width - rx.Width) / 2;
if(item->selected)
{
rx.Y++;
#define shadow 5
CDIB tmp;
tmp.Resize(item->icon->Width(), item->icon->Height());
if(tmp.Ready())
{
tmp.Draw(CRect(shadow, shadow,
item->icon->Width() - shadow,
item->icon->Height() - shadow),
item->icon->Rect(), item->icon);
DIB_ARGB *p = tmp.scan0;
int size = tmp.Width() * tmp.Height();
for(int i = 0; i < size; i++, p++)
{
p->r = 0;
p->g = 0;
p->b = 0;
}
tmp.Blur(tmp.Rect(), CRect(0, 0, 0, 0), shadow);
g.DrawImage(tmp.bmp, RectF(rx.X, rx.Y + shadow, rx.Width, rx.Height));
}
tmp.Assign(item->icon);
/*if(tmp.Ready())
{
DIB_ARGB *p = tmp.scan0;
int size = tmp.Width() * tmp.Height();
for(int i = 0; i < size; i++, p++)
{
p->r = 0x6f;
p->g = 0xa6;
p->b = 0xde;
}
}*/
g.DrawImage(tmp.bmp, rx);
}
else
{
g.DrawImage(item->icon->bmp, rx);
}
}
//.........这里部分代码省略.........