怎么改变控件上的字体大小?

newhandwxc 2011-03-10 11:43:10
如题
怎样改变控件上的字体大小?
尤其是Button、静态文本 和 编辑框控件 里字体的大小。。
求各位高手指导啊。。
详细点,最好举例子,有代码。。
...全文
437 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
向立天 2011-03-31
  • 打赏
  • 举报
回复
您好
我是本版版主
此帖已多日无人关注
请您及时结帖
如您认为问题没有解决可按无满意结帖处理
另外本版设置了疑难问题汇总帖
并已在版面置顶
相关规定其帖子中有说明
您可以根据规定提交您帖子的链接
如您目前不想结帖只需回帖说明
我们会删除此结帖通知

见此回复三日内无回应
我们将强制结帖
相关规定详见界面界面版关于版主结帖工作的具体办法
Dreadnought 2011-03-10
  • 打赏
  • 举报
回复
CFont::CreateFont SelectObject TextOut
King_hhuang 2011-03-10
  • 打赏
  • 举报
回复
http://www.codeproject.com/KB/GDI/setfont.aspx
King_hhuang 2011-03-10
  • 打赏
  • 举报
回复
自己上网找啊
http://wenku.baidu.com/view/5ad89cc6aa00b52acfc7ca1d.html
  • 打赏
  • 举报
回复
SetFont
csuyuanweiqingking 2011-03-10
  • 打赏
  • 举报
回复
这个在工具->选项里面可以设置字体
_Sodo_ 2011-03-10
  • 打赏
  • 举报
回复
首先获取到静态控件的字符串,然后再用GDI+或GDI设置其大小呗。

void CColorStatic::OnPaint()
{
CPaintDC dc(this); // device context for painting

// TODO: Add your message handler code here
CRect rect;
GetClientRect(&rect);

TCHAR strText[MAX_PATH + 1];
_tcscpy(strText,m_strCaption);
//MultiByteToWideChar(CP_ACP,0,(LPTSTR)m_strCaption,-1,strText,sizeof(strText));
//::GetWindowText(m_hWnd, strText, MAX_PATH);
//memcpy(strText,m_strCaption,pcstr);
Gdiplus::SolidBrush fontBrush(Color::Black);
Gdiplus::StringFormat strformat;
strformat.SetFormatFlags(StringFormatFlags::StringFormatFlagsDirectionVertical);//垂直
strformat.SetAlignment(StringAlignment::StringAlignmentCenter);//居中
strformat.SetLineAlignment(StringAlignment::StringAlignmentCenter);//水平居中
Graphics graphics(this->m_hWnd);//this代表自绘的CStatic
graphics.DrawString(strText,wcslen(strText),&Gdiplus::Font(L"新宋体", 12),Gdiplus::RectF(0, 0, rect.Width(), rect.Height()),&strformat,&fontBrush);


// Do not call CStatic::OnPaint() for painting messages
}
newhandwxc 2011-03-10
  • 打赏
  • 举报
回复
BUTTON按钮通过自绘的方法解决了,用是的位图做按钮,
可是静态控件的字体怎样改大一点并加粗呢?

15,978

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧