winApi一日一练之 SetTextColor (和Textout)函数
2011-10-14 13:52
411 查看
记得先要#include <iostream> ////声明字符串 std::wstring strShow(_T("Test String")); hdc = BeginPaint(hWnd, &ps); TextOut(hdc,10,30,strShow.c_str(),(int)strShow.length()); SetTextColor(hdc,RGB(0,255,0)); TextOut(hdc,10,60,strShow.c_str(),(int)strShow.length()); SetTextColor(hdc,RGB(12,56,89)); TextOut(hdc,10,80,strShow.c_str(),(int)strShow.length()); // TODO: 在此添加任意绘图代码... EndPaint(hWnd, &ps);
drawText 调用示例:
////声明字符串 std::wstring strShow(_T("Test String")); ////声明一个矩形 RECT rcText; rcText.left = 10; rcText.right=100; rcText.top = 20; hdc = BeginPaint(hWnd, &ps); DrawText(hdc,strShow.c_str(),(int)strShow.length(),&rcText, DT_LEFT|DT_SINGLELINE|DT_END_ELLIPSIS); SetTextColor(hdc,RGB(0,255,0)); rcText.left = 10; rcText.top = 40; DrawText(hdc,strShow.c_str(),(int)strShow.length(),&rcText, DT_LEFT|DT_SINGLELINE|DT_END_ELLIPSIS); rcText.left = 10; rcText.top = 60; SetTextColor(hdc,RGB(12,56,89)); DrawText(hdc,strShow.c_str(),(int)strShow.length(),&rcText, DT_LEFT|DT_SINGLELINE|DT_END_ELLIPSIS); // TODO: 在此添加任意绘图代码... EndPaint(hWnd, &ps);
相关文章推荐
- Windows API一日一练(23)SetTextColor函数
- 函数SetTextColor()设置方法浅析
- Windows文本字体函数 - SetTextColor
- 在场景中输出文字--SetTextColor(),SetBkMode(),TextOut()的使用
- WinAPI: SetTextColor - 设置设备环境的文本颜色
- WinAPI: SetTextColor - 设置设备环境的文本颜色
- GetTextColor和SetTextColor这两个函数应该怎么用啊?
- SetTextColor
- Android遇到setTextColor无效的解决办法
- WinAPI: SetTextCharacterExtra - 设置字符间距
- Android中设置TextView的颜色setTextColor
- 【Android基础】setTextColor(),setBackgroundColor的参数设置方式
- Windows API一日一练(22)TextOut函数
- Android,setTextColor等背景选择器设置失败问题,及多种设置方法
- android setTextColor()的参数设置不起作用的解决方法
- 利用SetConsoleTextAttribute函数设置控制台颜色
- Android中设置TextView的颜色setTextColor
- WinAPI: SetTextJustification - 设置两端对齐
- Android中设置TextView的颜色setTextColor
- CListCtrl控件的InsertItem和SetItemText和SetItem三个函数的区别