的drawText [英] Drawtext

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

问题描述


我正在使用以下代码在SDI应用程序中绘制文本。


CFont字体;

font.CreateFont(20,100,0,0,0,0,0,0,0,0,0,0,_T("Arial"));

CFont * pOldFont = pDC-> SelectObject(& font);

pDC-> FillSolidRect(rect,RGB(128,128,128)); //深灰色

pDC-> SetBkMode(TRANSPARENT);

pDC-> SetTextColor(RGB(0,255,255));

pDC-> DrawText(L" Hello",6& rect,DT_CENTER);


当背景为白色时,文字颜色不同,而背景为darkgraycolor文本颜色看起来略有不同虽然我使用相同的文本颜色。如何使用
darkgraycolor作为背景,获得与白色背景相同的文本颜色。



谢谢。


解决方案

这是一种视觉错觉。颜色是一样的,但背景颜色让你觉得它不是。遗憾。

Hi,

I am drawing text in SDI application using below code.

CFont font;
font.CreateFont(20,100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("Arial"));
CFont* pOldFont = pDC->SelectObject(&font);
pDC->FillSolidRect(rect,RGB(128,128,128)); //dark gray
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,255,255));
pDC->DrawText(L"Hello",6, &rect, DT_CENTER);

When background is white color the text color is different whereas when the background is in darkgraycolor the text color looks slightly different eventhough I am using same text color.How to achieve same text color as getting on white background, when using darkgraycolor as background also.

Thanks.

解决方案

This is a visual illusion. The colour is the same, but the background colour makes you think that it's not. Sorry.


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

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