Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
FontSize.cpp
Package: MiniCA2.rar [view]
Upload User: dengkfang
Upload Date: 2008-12-30
Package Size: 5233k
Code Size: 1k
Category:
CA program
Development Platform:
Visual C++
- // FontSize.cpp Version 1.0
- //
- // Author: Hans Dietrich
- // hdietrich2@hotmail.com
- //
- // This software is released into the public domain.
- // You are free to use it in any way you like.
- //
- // This software is provided "as is" with no expressed
- // or implied warranty. I accept no liability for any
- // damage or loss of business that this software may cause.
- //
- ///////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "FontSize.h"
- ///////////////////////////////////////////////////////////////////////////////
- // GetFontPointSize()
- int GetFontPointSize(int nHeight)
- {
- HDC hdc = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
- ASSERT(hdc);
- int cyPixelsPerInch = ::GetDeviceCaps(hdc, LOGPIXELSY);
- ::DeleteDC(hdc);
- int nPointSize = MulDiv(nHeight, 72, cyPixelsPerInch);
- if (nPointSize < 0)
- nPointSize = -nPointSize;
- return nPointSize;
- }
- ///////////////////////////////////////////////////////////////////////////////
- // GetFontHeight()
- int GetFontHeight(int nPointSize)
- {
- HDC hdc = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
- ASSERT(hdc);
- int cyPixelsPerInch = ::GetDeviceCaps(hdc, LOGPIXELSY);
- ::DeleteDC(hdc);
- int nHeight = -MulDiv(nPointSize, cyPixelsPerInch, 72);
- return nHeight;
- }