使用GDI+ MeasureString方法计算显示 输入文本的长度

// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__660C12D0_6133_459C_B633_7A2DFC9FFD72__INCLUDED_)
#define AFX_STDAFX_H__660C12D0_6133_459C_B633_7A2DFC9FFD72__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define VC_EXTRALEAN  // Exclude rarely-used stuff from Windows headers

#ifndef ULONG_PTR
#define ULONG_PTR unsigned long*
#endif


#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdisp.h>        // MFC Automation classes
#include <afxdtctl.h>  // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>   // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT


#include <GdiPlus.h>
using namespace Gdiplus;

#pragma comment(lib, "gdiplus.lib")

//{ {AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__660C12D0_6133_459C_B633_7A2DFC9FFD72__INCLUDED_)

 

 

 

// MeasureStringTestDlg.h : header file
//

#if !defined(AFX_MEASURESTRINGTESTDLG_H__4887F642_8530_485A_8067_D30D1664AD2D__INCLUDED_)
#define AFX_MEASURESTRINGTESTDLG_H__4887F642_8530_485A_8067_D30D1664AD2D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/
// CMeasureStringTestDlg dialog

class CMeasureStringTestDlg : public CDialog
{
// Construction
public:
 CMeasureStringTestDlg(CWnd* pParent = NULL); // standard constructor

// Dialog Data
 //{ {AFX_DATA(CMeasureStringTestDlg)
 enum { IDD = IDD_MEASURESTRINGTEST_DIALOG };
  // NOTE: the ClassWizard will add data members here
 //}}AFX_DATA

 // ClassWizard generated virtual function overrides
 //{ {AFX_VIRTUAL(CMeasureStringTestDlg)
 protected:
 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值