奇谭怪剑

“奇谭怪剑”————奇谈怪见是也!你想说什么就说什么;你想知道什么就能知道什么;你想要什么就有什么;来吧朋友————天剑这儿应有尽有!..........*^-^*..........

881 成员697 主题2,175 回复0 张照片

如何获取GDI对象的属性信息

天
天 剑
2000-05-18 19:27
如何获取GDI对象的属性信息

可以调用GDIObject:: GetObject。这个函数将指定图表设备的消息写入到缓冲区。下例创建了几个有用的辅助函数。
//Determine if font is bold.
BOOL IsFontBold (const CFont&font)
{
LOGFONT stFont
font.GetObject (sizeof (LOGFONT), &stFont)
return (stFont.lfBold)? TRUE: FALSE
}
//Return the size of a bitmap.
CSize GetBitmapSize (const CBitmap&bitmap)
{
BITMAP stBitmap
bitmap.GetObject (sizeof (BITMAP), &stBitmap)
return CSize (stBitmap.bmWidth, stBitmap.bmHeight)
}
//Create a pen with the same color as a brush.
BOOL CreatePenFromBrush (Cpen&pen, cost Cbrush&brush)
{
LOGBRUSH stBrush
brush.Getobject (sizeof (LOGBRUSH), &stBrush)
return pen. Createpen (PS_SOLID, 0, stBrush.ibColor)
}
1 / 1

登录后回复。