Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. Custom Draw confusion

Custom Draw confusion

Scheduled Pinned Locked Moved Windows API
visual-studiocomgraphicsdata-structurestutorial
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Craig Longman
    wrote on last edited by
    #1

    I'm trying to figure out how to remove the dashed focus cue from around one of my controls, a track bar. Based on the documentation on MSDN for custom drawing, here: http://msdn.microsoft.com/en-us/library/ff919569(v=VS.85).aspx#CustomDraw_DrawingItemsYourself I've set up the following in the parent window NM_CUSTOMDRAW handler:

    NMCUSTOMDRAW* pzCustomDraw;

    LRESULT lResult = CDRF_DODEFAULT;

    switch( iID )
    {
    case IDC_FONTSIZE_SLIDER:
    case IDC_OFFSET_X_SLIDER:
    case IDC_OFFSET_Y_SLIDER:
    case IDC_CHOOSECOLOUR:
    pzCustomDraw = reinterpret_cast< NMCUSTOMDRAW* >( pzNMHdr );

    if( pzCustomDraw->dwDrawStage == CDDS\_PREPAINT )
    {
    

    // lResult = CDRF_SKIPPOSTPAINT;
    lResult = CDRF_NOTIFYITEMDRAW;
    }
    else if( pzCustomDraw->dwDrawStage == CDDS_ITEMPREPAINT )
    {
    lResult = CDRF_SKIPPOSTPAINT;
    }

    break;
    

    }

    bHandled = TRUE;

    return lResult;

    The MSDN article linked above states: CDRF_SKIPPOSTPAINT - The control will not draw the focus rectangle around an item. But doesn't indicate that the dwDrawState is anything other than the CDDS_PREPAINT, however as you can see I tried both for CDDS_PREPAINT and CDDS_ITEMPREPAINT. Neither of these actually do anything. The result is set correct, and returned, but the control still draws the focus cue. I'm thinking that the documentation just fails to indicate that this only works on list-view and tree-view controls, or can someone see something I'm doing wrong? Thanks, CraigL

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups