更改GDI笔的颜色 [英] Change GDI pen colour

查看:161
本文介绍了更改GDI笔的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此调用创建自定义笔的颜色属性后,是否可以更改它?

Is it possible to change the custom pen colour attribute after creating it using this call?

HPEN hPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); //Create a solid pen.

或者我应该如何创建可以更改颜色的笔.

or how should i create a pen whose colour colour can be changed.

推荐答案

恐怕使用任何非深奥的方法都无法做到这一点.

I am afraid that this is not possible using any non-esoteric approach.

但是,我认为您可以使用DC_PEN库存对象和SetDCPenColor函数,如下所示:

I think, however, that you can use the DC_PEN stock object and the SetDCPenColor function, like so:

SelectObject(dc, GetStockObject(DC_PEN));
SetDCPenColor(dc, clGreen);
Rectangle(dc, 10, 10, 200, 200);
SetDCPenColor(dc, clRed);
Rectangle(dc, 300, 300, 500, 500);

使用Delphi语法.

in Delphi syntax.

这篇关于更改GDI笔的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆