Drawing outlined text!

How to draw text like this! Looks interesting right! Well this is done using plain window’s GDI functions, here is a function which does this! [sourcecode language=’cpp’]// Thanks to Charles Petzold! void CCanvas::DrawOutlineText( CDC& dc, const CString& Text ) {  const int RestorePoint = dc.SaveDC(); // Create new font  CFont NewFont;   NewFont.CreatePointFont( 700, TEXT( […]
Continue reading…

 

Using PS_USERSTYLE for creating funky pens!

Using ExtCreatePen and PS_USERSTYLE you can create funky styled pens instead of the old PS_DOT, PS_DASHDOT, PS_DASHDOTDOT style pens. When using PS_USERSTYLE for creating pens you’ve got specify an array of DWORD which holds dash and space length while drawing a user styled pen! I’ve created a sample application which demostrates marching ants demo, if […]
Continue reading…

 

How to rotate text using WinAPI?

Simple way to rotate a piece of text is to use a font object… Here is a sample which does this… [sourcecode language=’cpp’]void CSomeDlg::OnPaint() {     CPaintDC dc(this);  // Get existing dlg font     CFont NewFont;      LOGFONT lgFnt = { 0 };      GetFont()->GetLogFont(&lgFnt);  // Modify this existing font // // Face name is […]
Continue reading…

 

How to make tab control pages transparent while using XP themes?

Having trouble with tab control pages’  gray background while using XP themes? Well to solve this problem we need to do some additional housekeeping(AFAIK)… Add a message map entry for WM_CTLCOLOR… [sourcecode language=’cpp’]BEGIN_MESSAGE_MAP(CTabPage, CDialog)      ON_WM_CTLCOLOR() END_MESSAGE_MAP()[/sourcecode] Override OnCtlColor and add following code… [sourcecode language=’cpp’]HBRUSH CTabPage::OnCtlColor( CDC* pDC_i, CWnd* pWnd_i, UINT uCntrlType_i ) { // First […]
Continue reading…