本文介绍了如何找出DC的尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我说我可以处理设备上下文(自然是在Windows环境中):
Let's say I have a handle to device context (naturally, in Windows environment):
HDC hdc;
如何获取宽度和高度?
推荐答案
设备上下文(DC)是一种结构,它定义了一组图形对象及其关联的属性以及影响输出的图形模式。
A device context (DC) is a structure that defines a set of graphic objects and their associated attributes, and the graphic modes that affect output.
按宽度和高度,我猜您指的是绘制的位图?
如果是这样,我想您可以尝试以下操作:
By width and height I'm guessing you are referring to the bitmap painted ?
If so then i guess you can try the following :
BITMAP structBitmapHeader;
memset( &structBitmapHeader, 0, sizeof(BITMAP) );
HGDIOBJ hBitmap = GetCurrentObject(hDC, OBJ_BITMAP);
GetObject(hBitmap, sizeof(BITMAP), &structBitmapHeader);
//structBitmapHeader.bmWidth
//structBitmapHeader.bmHeight
这篇关于如何找出DC的尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!