GDIPlus的Pen的一个小Bug
来源:互联网 发布:老鼠夹编程乐高 编辑:程序博客网 时间:2024/05/21 05:42
首先是MSDN里面Pen的SetTransform Method的说明
Pen::SetTransform Method
The SetTransform method sets the world transformation of this Pen object.
Syntax
Status SetTransform(
const Matrix *matrix
);
Parameters
- matrix
- [in] Pointer to a Matrix object that specifies the world transformation.
Return Value
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
附MSDN上面的使用例子:
VOID Example_SetTransform(HDC hdc)
{
Graphics graphics(hdc);
Matrix matrix(20, 0, 0, 10, 0, 0); // scale
// Create a pen, and use it to draw a rectangle.
Pen pen(Color(255, 0, 0, 255), 2);
graphics.DrawRectangle(&pen, 10, 50, 150, 100);
// Scale the pen width by a factor of 20 in the horizontal
// direction and a factor of 10 in the vertical direction.
pen.SetTransform(&matrix);
// Draw a rectangle with the transformed pen.
graphics.DrawRectangle(&pen, 200, 50, 150, 100);
}
这里没有说明的是:
Pen pen(Color(255, 0, 0, 255), 2);
这里设置的线宽小于等于1.5时,则后面设置的坐标变换将不起作用,画出的线宽会变为1。
此外如果在设置坐标变换后,在某个方向的变换后线宽如果小于1,则也会失效,具体如下:
Pen pen(Color(255, 255, 0, 0), 2);
Matrix ctmBase(10, 0, 0, 0.5, 0, 100);
pen.SetTransform(&ctmBase);
GraphicsPath Path;
Path.AddLine(100, 300, 300, 300);
Path.AddLine(100, 300, 100, 600);
graphics.DrawPath(&pen, &Path);
你会发现两条线都为1线宽,只要把0.5增加一点,坐标变换就会正确作用了。
- GDIPlus的Pen的一个小Bug
- Gdiplus::Pen的使用
- Gdiplus使用中出现的一个Bug记录
- VC6.0中gdiPlus的使用以及一个小例子
- VC6.0中gdiPlus的使用以及一个小例子
- VC6.0中gdiPlus的使用以及一个小例子
- TEmbeddedwb的一个小bug
- gcc的一个小bug
- CStdioFile的一个小Bug
- gmail的一个小bug
- csdn的一个小bug
- Firtex的一个小bug
- tinyxml 的一个小 bug
- tinyxml 的一个小 bug
- 一个VS2005的小Bug
- chapter7的一个小bug
- CodeBlocks的一个小bug
- strcpy的一个小bug
- IME输入法编程 第一章
- 一个打印的小经验
- 网卡地址和多点播送(组播)及广播---转
- 如何解决J2ME开发中遇到提示 ALERT: java/lang/ClassFormatError: Bad version information.的问题?
- 在应用程序中使用启动屏幕和登陆窗口
- GDIPlus的Pen的一个小Bug
- IME输入法编程 第二章
- 备份工具,svn的有效补充,不用扩建分支了
- 关于软件工程的两句话
- Oprofile使用指南
- 一个人的快乐,不是因为他拥有的多,而是因为他计较的少。
- IME输入法编程 第三章
- IME输入法编程 第四章
- jsp错误页面导航error page的使用