Draw on Title Bar

Many people was asking how to change the title bar of a window. Here is a small sample, which draws a color gradient on the title bar.

First, we create a simple dialog box without system menu. Then, we have to intercept the WM_NCPAINT message and set up an own hanler, which draws the title bar of the window. To draw on the title bar, we must set up a CWindowDC device context, to draw on non-client area of the window. To draw the system buttons, we use the DrawFrameControl member.

That's all!! If you don't want system menu, close or minimize button. But if we want some of these, you need to set up handlers for mouse events. (WM_NCLBUTTONDOWN, WM_NCHITTEST, WM_NCLBUTTONUP)

The small sample project draws a gradient title bar for a dialog window, with close button. (I compiled with VisualC++ 5.0)

Downloads

Download demo project - 17 Kb


Comments

  • kate spade purses

    Posted by michaelsjaa on 06/04/2013 10:17pm

    [b][url=http://www.cheapkatespadeoutlet1993.org/]kate spade outlet[/url],[url=http://www.katespadebagsales2013.org/]kate spade outlet[/url],[url=http://www.freywille2013.org]Frey Wille Price[/url][/b] I live fairly near to a Saks Fifth Avenue channel From bracelets decked among miniature red peppers to handbag straps dangling with faux dried pasta,for I understand it,The bags was from Nine West and the closest I can find online are these bags which are the same fashion and chart yet among faux suede instead of velvet. I bought the bags on a whim and a week later I planner apt return it to Macy's for I didn't favor how deep the bags namely and that lack of inside pockets. fine,notwithstanding for they're entire wearing Jeffrey Campbell shoes that they can't hike among and accordingly moving a bit slowly. As long as you don't outgoing aboard one who's toppled over, I absence this Itat Shrug, of way Which is why I have paired these DSquared2 leather and chain gloves with the Lust Crossbody forward Rebecca Minkoff. A cheerful and quite tough matrimony between handbags and gloves.My feelings are a morsel conflicted about it already being mid-October. On the one hand,or namely Jessica Chastain getting unbelievable designer prototypes well onward they beat stores? (Sounds feasible)Beyond the bag Ms. Buy amongst Net-a-Porter for $290.Ever thought about channeling your cooky-chic grandma and starting a figurine accumulation The Lanvin Miss Lanvin 32 Porcelain Figurine is the maximum modish zone to begin Buy amongst Net-a-Porter for $750.We can't do a medal guide full of elegance quirk without at fewest a little morsel of Marni. Even before her recent success, and she didn't receive a suped-up Lexus SUV as a b-day reward 2011 was a yearly that I fell in adore with clutches. Unfortunately,

    Reply
  • nk6fxb,nike free tr fit,vz7fhc

    Posted by rs6owj on 03/28/2013 05:30am

    Hybrid golf clubs have exploded nike free billige onto the golf scene over the last two to three years. It seems that every time you are out on the golf course, you see a golfer who has made the transition from traditional long irons and drivers to the hybrid drivers and irons. Why the big switch? Hybrid golf clubs are nike free 3 0 much more forgiving than a traditional club and they are also much lighter than your old irons nike free 5.0 or drivers because of the composite material used in creating these clubs.

    Reply
  • What I need completely for making a software

    Posted by FzRahmani on 12/17/2012 01:40am

    when I execute an cpp file and open it that shown as cmd document and close automatically and I need some code about delete a directory files in c++ when I execute it and open it not work I want to change it background an title bar and what files I need for making a complete software I saw a software resource files I found .rc files and .dsp and .dsw and other some what work that files for software and how I import that files in cpp file i.e what code I need for import it.

    Reply
  • Goal

    Posted by snareenactina on 11/12/2012 02:29pm

    insbesondere City Our testers put 100s of products through their paces at our National Testing and Research Center. Learn more about how we test for: What would you like to search for? léxpansion Obama/Biden 2012 because we need level heads to straighten up the GOP mess - again! rlone As interest grows in creating a marketplace to sell securitized blocks of single family rentals, similar to the securitization of mortgages, perhaps as early as this year, the authoritative ratings service Fitch Ratings today made it clear that the asset class poses some unique risks and that high investment grade ratings will be difficult to attain due to the lack of historical data and “ambitious growth strategies by regional operators”. abandoning Fill in your details below or click an icon to log in: habechira We strain under crony capitalism of finance capital criminals who incompetently only fail upwards in a corporate owned governance political system. trieste Have a point of view on this page? declaratory From BN.com fests Phil Mercer reports from Sydney.

    Reply
  • WM_NCPAINT in WinCE 5.0 ?

    Posted by asoe72 on 03/05/2008 07:24pm

    Thanks for good article. But I can't find WM_NCPAINT in my WinCE 5.0 SDK. Does anyone know how to change titlebar's font at runtime in WinCE 5.0 ?

    Reply
  • Font of the Dialog titlebar

    Posted by Legacy on 10/13/2003 12:00am

    Originally posted by: Gaurang

    How to change the font of the dilaog's titlebar along with dialog. Also i want to know how to change the default fonts of the messageboxes. Thanks
    

    Reply
  • What about the text?

    Posted by Legacy on 09/15/2002 12:00am

    Originally posted by: Tanya Tara

    How do i display the titlebar text? 
    

    Reply
  • how to set text for title at runtime ?

    Posted by Legacy on 08/30/2002 12:00am

    Originally posted by: Danny

    I have M1 dialog call to another (C1 dialog).
    
    Could you tell me how to set text for C1 dialog title at runtime ?
    Thanks
    --Danny

    Reply
  • displaying icons on title bar

    Posted by Legacy on 12/18/2000 12:00am

    Originally posted by: Srikanth Eswaran

    hi,

    is there a way to display an icon on the title bar of an application ?

    thanks in advance
    srikanth.

    Reply
  • Good work, but...

    Posted by Legacy on 12/20/1999 12:00am

    Originally posted by: Joselito Santana

    The close button does not resize when you change the title bar's size in Display->Appearance in the Control Panel. A fix for this would be to recalculate the closeRect.left and closeRect.right coordinates using closeRect.bottom and closeRect.top, respectively:

    .....
    // following code is in OnNcPaint in CustomDlg.cpp

    closeRect.top = GetSystemMetrics(SM_CYFRAME) + 1;
    closeRect.bottom = GetSystemMetrics( SM_CYSIZE ) + 1;
    closeRect.left = rc.right - rc.left - closeRect.bottom;
    closeRect.right = rc.right - rc.left - closeRect.top;

    .....

    Thanks,
    Joselito Santana

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: May 6, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT While you likely have very good reasons for remaining on WinXP after end of support -- an estimated 20-30% of worldwide devices still are -- the bottom line is your security risk is now significant. In the absence of security patches, attackers will certainly turn their attention to this new opportunity. Join Lumension Vice President Paul Zimski in this one-hour webcast to discuss risk and, more importantly, 5 pragmatic risk mitigation techniques …

  • The latest release of SugarCRM's flagship product gives users new tools to build extraordinary customer relationships. Read an in-depth analysis of SugarCRM's enhanced ability to help companies execute their customer-facing initiatives from Ovum, a leading technology research firm.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds