文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 精品软件 | 下载排行 | 推荐下载 | 免费看大片 | WPS | 杀毒软件
清风网络
首 页 软件下载 网络学院 数码学院
QQ 电脑入门 游戏 操作系统 图形处理 办公软件 媒体动画 精文荟萃 工具软件 网络编程 程序开发 网络技术 认证考试 网站建设 文章专栏
当前位置:清风网络学院程序开发C/C++Windows API-GDI入门基础知识详解(2)
精品推荐
特别推荐
·C语言编程易犯毛病集合
·C语言编程常见问题解答(目录)
·C#程序开发中的常用函数汇总
·C/C++笔试、面试题目大汇总
·Beej的网络socket编程指南
·socket编程原理
·C语言的常用库函数使用方法分析及用途
·在C语言中如何处理时间和日期
·C++设计模式之Singleton
·VC++动态链接库编程之MFC扩展 DLL
·TCP/IP网络重复型服务器通信软件的设计
·DirectX游戏开发入门
·经典与现代的结合:在MFC中集成RAD .NET框架
·Windows API-GDI入门基础知识详解(2)
·Visual C++ 入门精解
·C#基础概念二十五问
·用C#实现pdf文件的完整性验证
·成为嵌入式程序员应知道的0x10个问题
·TCP/IP编程实现远程文件传输
·几个C#编程的小技巧
热点TOP10
·学生成绩管理系统实习
·C#编写的windows计算器-源代码
·socket编程原理
·飞机订票系统设计
·C/C++笔试、面试题目大汇总
·TCP/IP编程实现远程文件传输
·C语言图形函数
·Visual C++ 实现数字化图像的分割
·改编 的 C版 职工管理系统
·C#基础概念二十五问
·C语言的常用库函数使用方法分析及用途
·C#源码读取excel数据到程序中-SQL SERVER-到dataset中
·用C语言实现Ping程序功能
·C# GridView 排序及分页
·进程调度模拟程序
·Windows下C语言网络编程快速入门
·通讯录的源代码(用链表实现)
·DirectX游戏开发入门
·在Visual Studio.NET中使用Crystal Report(上)
·asp.net中调用javascript函数实现多功能日期控件示例

Windows API-GDI入门基础知识详解(2)

日期:2007年6月24日 作者: 查看:[大字体 中字体 小字体]


  2. 变宽字体

  等宽字体意味着所有的字符宽度都是一致的,但随着计算技术的不断发展和推广,这种等宽字体就不再能够满足需要,于是变宽字体出现了,变宽字体不同的字符宽度都不一定相同。

  系统字体是一种点阵字体,字体被定义成了一个个的像素点,字体的确切大小取决于显示器的大小(分辨率的大小)。

字符大小

  如果要使用TextOut函数显示多行文字,那么就必须确定字体字符的大小,字体的高度确定了下一行字符的显示位置,字体的宽度确定了下一列的显示位置。

  屏幕的分辨率和字符大小是确定如何显示字符的主要依据,为了获得当前系统上各种与视觉属性相关的信息,我们可以调用GetSystemMetrics函数获取,调用GetTextMetrics函数可以获取字体大小。

  以下是这两个函数的原形以及参数的详细定义:

int GetSystemMetrics(

  int nIndex  // 索引

);

  GetSystemMetrics函数是完成Windows图形输出的重要函数,它返回Windows中各种与视觉属性相关的信息,该函数需要只需要一个参数,它是一个索引,这些索引是在Windows头文件中定义的一些常量,这些常量分别指定了不同的与视觉相关的设备属性,这些索引的多少取决与Windows的版本。

  以下是这些索引的含义:

Value Meaning SM_ARRANGE Flags specifying how the system arranged minimized windows. For more information about minimized windows, see the following Remarks section. SM_CLEANBOOT Value that specifies how the system was started: 0 Normal boot
1 Fail-safe boot
2 Fail-safe with network boot Fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user's startup files. SM_CMONITORS Number of display monitors on the desktop. See Remarks for more information. Windows NT, Windows 95:  This value is not supported. SM_CMOUSEBUTTONS Number of buttons on mouse, or zero if no mouse is installed. SM_CXBORDER, SM_CYBORDER Width and height of a window border, in pixels. This is equivalent to the SM_CXEDGE value for windows with the 3-D look. SM_CXCURSOR, SM_CYCURSOR Width and height of a cursor, in pixels. The system cannot create cursors of other sizes. SM_CXDLGFRAME, SM_CYDLGFRAME Same as SM_CXFIXEDFRAME and SM_CYFIXEDFRAME. SM_CXDOUBLECLK, SM_CYDOUBLECLK Width and height of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within this rectangle for the system to consider the two clicks a double-click. (The two clicks must also occur within a specified time.) To set the width and height of the double-click rectangle, call SystemParametersInfo with the SPI_SETDOUBLECLKHEIGHT and SPI_SETDOUBLECLKWIDTH flags. SM_CXDRAG, SM_CYDRAG Width and height of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins. These values are in pixels. It allows the user to click and release the mouse button easily without unintentionally starting a drag operation. SM_CXEDGE, SM_CYEDGE Dimensions of a 3-D border, in pixels. These are the 3-D counterparts of SM_CXBORDER and SM_CYBORDER. SM_CXFIXEDFRAME, SM_CYFIXEDFRAME Thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. SM_CXFIXEDFRAME is the height of the horizontal border and SM_CYFIXEDFRAME is the width of the vertical border. Same as SM_CXDLGFRAME and SM_CYDLGFRAME. SM_CXFOCUSBORDER, SM_CYFOCUSBORDER Width of the left and right edges and the height of the top and bottom edges of the focus rectangle drawn by DrawFocusRect. These values are in pixels. Windows 2000/NT, Windows Me/98/95:  This value is not supported. SM_CXFRAME, SM_CYFRAME Same as SM_CXSIZEFRAME and SM_CYSIZEFRAME. SM_CXFULLSCREEN, SM_CYFULLSCREEN Width and height of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value. SM_CXHSCROLL, SM_CYHSCROLL Width of the arrow bitmap on a horizontal scroll bar, in pixels; and height of a horizontal scroll bar, in pixels. SM_CXHTHUMB Width of the thumb box in a horizontal scroll bar, in pixels. SM_CXICON, SM_CYICON Default width and height of an icon, in pixels. The LoadIcon function can load only icons of these dimensions. SM_CXICONSPACING, SM_CYICONSPACING Dimensions of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of this size when arranged. These values are always greater than or equal to SM_CXICON and SM_CYICON. SM_CXMAXIMIZED, SM_CYMAXIMIZED Default dimensions, in pixels, of a maximized top-level window on the primary display monitor. SM_CXMAXTRACK, SM_CYMAXTRACK Default maximum dimensions of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override these values by processing the WM_GETMINMAXINFO message. SM_CXMENUCHECK, SM_CYMENUCHECK Dimensions of the default menu check-mark bitmap, in pixels. SM_CXMENUSIZE, SM_CYMENUSIZE Dimensions of menu bar buttons, such as the child window close button used in the multiple document interface, in pixels. SM_CXMIN, SM_CYMIN Minimum width and height of a window, in pixels. SM_CXMINIMIZED, SM_CYMINIMIZED Dimensions of a minimized window, in pixels. SM_CXMINSPACING SM_CYMINSPACING Dimensions of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. These values are always greater than or equal to SM_CXMINIMIZED and SM_CYMINIMIZED. SM_CXMINTRACK, SM_CYMINTRACK Minimum tracking width and height of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override these values by processing the WM_GETMINMAXINFO message. SM_CXSCREEN, SM_CYSCREEN Width and height of the screen of the primary display monitor, in pixels. These are the same values obtained by calling GetDeviceCaps(hdcPrimaryMonitor, HORZRES/VERTRES). SM_CXSIZE, SM_CYSIZE Width and height of a button in a window's caption or title bar, in pixels. SM_CXSIZEFRAME, SM_CYSIZEFRAME Thickness of the sizing border around the perimeter of a window that can be resized, in pixels. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border. Same as SM_CXFRAME and SM_CYFRAME. SM_CXSMICON, SM_CYSMICON Recommended dimensions of a small icon, in pixels. Small icons typically appear in window captions and in small icon view. SM_CXSMSIZE SM_CYSMSIZE Dimensions of small caption buttons, in pixels. SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN Width and height of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN metrics are the coordinates of the top-left corner of the virtual screen. Windows NT, Windows 95:  This value is not supported. SM_CXVSCROLL, SM_CYVSCROLL Width of a vertical scroll bar, in pixels; and height of the arrow bitmap on a vertical scroll bar, in pixels. SM_CYCAPTION Height of a caption area, in pixels. SM_CYKANJIWINDOW For double byte character set versions of the system, this is the height of the Kanji window at the bottom of the screen, in pixels. SM_CYMENU Height of a single-line menu bar, in pixels. SM_CYSMCAPTION Height of a small caption, in pixels. SM_CYVTHUMB Height of the thumb box in a vertical scroll bar, in pixels. SM_DBCSENABLED TRUE or nonzero if User32.dll supports DBCS; FALSE or zero otherwise. Windows Me/98/95:   TRUE or nonzero if the double-byte character-set (DBCS) version of User.exe is installed; FALSE or zero otherwise. SM_DEBUG TRUE or nonzero if the debug version of User.exe is installed; FALSE or zero otherwise. SM_IMMENABLED TRUE or nonzero if Input Method Manager/Input Method Editor features are enabled; FALSE or zero otherwise. Windows NT, Windows Me/98/95:  This value is not supported. SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application. To ensure that a language-dependent IME works, check SM_DBCSENABLED and the system ANSI code page. Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts or registry setting may not be present. SM_MENUDROPALIGNMENT TRUE or nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; FALSE or zero if the menus are left-aligned. SM_MIDEASTENABLED TRUE if the system is enabled for Hebrew and Arabic languages. SM_MOUSEPRESENT TRUE or nonzero if a mouse is installed; FALSE or zero otherwise. SM_MOUSEWHEELPRESENT TRUE or nonzero if a mouse with a wheel is installed; FALSE or zero otherwise. Windows 3.51 and earlier, Windows 95:  This value is not supported. SM_NETWORK Least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use. SM_PENWINDOWS TRUE or nonzero if the Microsoft Windows for Pen computing extensions are installed; FALSE or zero otherwise. SM_REMOTECONTROL This system metric is used in a Terminal Services environment. Its value is TRUE if the current session is remotely controlled; FALSE otherwise. Windows 2000/NT, Windows Me/98/95:  This value is not supported. SM_REMOTESESSION This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is TRUE or nonzero. If the calling process is associated with the Terminal Server console session, the return value is zero. Windows NT 4.0 SP3 and earlier, Windows Me/98/95:  This value is not supported. SM_SECURE TRUE if security is present; FALSE otherwise. SM_SAMEDISPLAYFORMAT TRUE if all the display monitors have the same color format, FALSE otherwise. Note that two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel's color value. Windows NT, Windows 95:  This value is not supported. SM_SHOWSOUNDS TRUE or nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; FALSE, or zero, otherwise. SM_SHUTTINGDOWN TRUE if the current session is shutting down; FALSE otherwise. Windows 2000/NT, Windows Me/98/95:  This value is not supported. SM_SLOWMACHINE TRUE if the computer has a low-end (slow) processor; FALSE otherwise. SM_SWAPBUTTON TRUE or nonzero if the meanings of the left and right mouse buttons are swapped; FALSE or zero otherwise. SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN Coordinates for the left side and the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN metrics are the width and height of the virtual screen. Windows NT, Windows 95:  This value is not supported.

BOOL GetTextMetrics(

  HDC hdc,              // 当前的设备描述表句柄

  LPTEXTMETRIC lptm   // 指向TEXTMETRICS结构对象的指针

);


上一页 [1] [2] [3] [4] 下一页 




上一篇:Windows API-GDI入门基础知识详解(3)

下一篇:Windows API-GDI入门基础知识详解(1)

Windows API-GDI入门基础知识详解(2) 相关文章:
·Windows Vista震撼1600X1200高清壁纸
·最详细的黑客入门法则
·WindowsXP超级技巧
·BIOS详解
·Windows XP的20个超级实用技巧大全
·最全面的WindowsXP修改大全
·让Windows XP系统快10倍
·Windows Vista Ultimate中文旗舰版下载+简单破解(支持迅雷HTTP & BT)
·破解windowsXP,window2000的开机密码
·图文详解 Windows 2003服务器集群安装
Windows API-GDI入门基础知识详解(2) 相关软件:
·孙鑫VC++从入门到精通开发详解视频教程FLASH版
·SQL Server 2000 基础系列课程视频
·计算机基础知识教程
·Windows主题70合一典藏版
·Photoshop 入门教程
·CorelDraw12 入门与实例(图文教程 菜鸟先飞系列教材)
·Windows 2003 Server 简体中文企业版(免激活)ISO
·ASP入门教程
·Windows 98简体中文第二版
·催眠大师密训专业教程之入门指导手册(繁体版)

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.vipcn.net
| 帮助(?) | 版权声明 | 友情连接 | 关于我们 | 信息发布
Copyright 2007 www.vipcn.net All Rights Reserved. 鄂ICP备05000083号Powered by:viphot