Click here to Skip to main content
15,879,095 members
Articles / Desktop Programming / MFC

"Skinned" UI control library (VC++)

Rate me:
Please Sign up or sign in to vote.
3.74/5 (8 votes)
27 Mar 2007CPOL4 min read 89.7K   15K   71  
This article demonstrates how to leverage the power of images and inheritance to achieve a "skinned" look for your Windows applications.
#ifndef _DECLARE_GLOBAL_FUNCTION

#define _DECLARE_GLOBAL_FUNCTION

#define NUM_SCALES				14
#define NUM_SCALARS				22
#define APPOBJ					((CLifeTunerApp*)AfxGetApp())
#define NUM_SPANSTRINGS			7

#include "..\..\Common\GlobalConstants.h"

BOOL FindControlEdge(CWnd* pWnd, CDC *dcControl, COLORREF colToSkip, HRGN &hRgn);
void DisplayLastError();

int RoundUpEx(int nNumber);
int RoundDownEx(int nNumber);
double GetRoundedValue(double dValue);

int FindGraphScaleYEx(int nMin, int nMax);
int FindGraphScaleXEx(int nMin, int& nNextHigher);
UINT RoundEx(long double dValue);

CString FormatNumberString(CString csNumberString);
CString UnFormatNumberString(CString csFormattedString);

int MessageBoxEng(CWnd* pWnd,
				  UINT nMsgID, 
				  UINT nMsgType, 
				  LPCTSTR lpszMsgTitle,
				  LPCTSTR lpszMsgExtra);

BOOL IsFieldEmpty(LPCTSTR lpszText);
BOOL IsValidAge(CString csDOB, CString csCurrentDate, int& nAge);
BOOL IsValidDate(CString csDate, CString& csRetMsg);
BOOL IsFieldTypeValid(UINT nType, LPCTSTR lpszText);
BOOL IsDateGreaterThanTheSystemDate(CString csDate);

int GetCurrentYear();
int GetCurrentMonth();
int GetCurrentDay();

HBITMAP LoadGIFEng(HINSTANCE hInstance, LPCTSTR lpGIFName, CBitmap* pBmp);

void PaintRectEx(CDC* pDC, int x, int y, int w, int h, COLORREF color);
void PaintGradiantRectEx(CDC *pDC, const RECT &rect,COLORREF clrFrom, COLORREF clrTo, 
                       BOOL hori, BOOL ascend);
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO IDYeah Creations
India India
My company: http://www.idyeah.com
My blog: http://blog.idyeah.com

Comments and Discussions