CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 1999
    Location
    Santa Clara, California
    Posts
    145

    Unwanted Pixels in Toolbar

    hey all,
    I'm creating a simple CToolBar which loads a 256 color bitmap for the button images. I used the SetSizes() method to reduce the size of the images to 12x12 and the buttons to 19x20. On calling DockControlBar, the bar pops up there and looks normal except that there is an undesired border surrounding it that I can't seem to get rid of, and when moved around the pixels in the border start making a small mess. By this i mean that the 2-pixel thick border seems to grab pixel values from other locations on update, alternating seemingly randomly here and there between light and dark grey which are the default system colors on this machine. Also, strangely if I coverup the toolbar by another application and then switch back to my app, the pixels in this "border" space are not updated and contian pixel data from the app which I covered it with.

    Perhaps if I can get rid of the border altogether, this would work itself out, but can't seem to make it go away. Here is a snippet of the toolbar creation code I am using:

    CToolBar m_StripColors;
    CRect rcBorders = CRect(0,0,0,0);
    SIZE bsize, isize;
    CMainFrame* pMainFrame = (CMainFrame *)theApp.m_pMainWnd;

    if (!m_StripColors.CreateEx((CWnd *)theApp.m_pMainWnd,
    TBSTYLE_FLAT,
    WS_CHILD | WS_VISIBLE | CBRS_ALIGN_ANY | CBRS_TOOLTIPS | CBRS_GRIPPER,
    rcBorders,
    IDW_STRIPCOLS) ||
    !m_StripColors.LoadBitmap(IDB_SMK) ||
    !m_StripColors.SetButtons(smks, sizeof(smks)/sizeof(UINT))) {
    TRACE0("Failed to create strip color bar\n");
    return;
    }
    bsize.cx = 19;
    bsize.cy = 20;
    isize.cx = 12;
    isize.cy = 12;
    m_StripColors.SetSizes(bsize, isize);

    anything outrageous? Any tips appreciated..

    --Kelly



  2. #2
    Join Date
    Sep 1999
    Location
    Santa Clara, California
    Posts
    145

    Re: Unwanted Pixels in Toolbar

    one more thing I've not yet discovered is how I can detect when a toolbar created in this manner has been closed by clicking on the [X]? Is there a message sent that I can trap to set a flag, allowing the user to once again activate the toolbar from a checkbox or something?

    --Kelly


  3. #3
    Join Date
    Oct 1999
    Location
    Sweden
    Posts
    1

    Re: Unwanted Pixels in Toolbar

    I have the same problem.
    My application has a toolbar without border docked at the bottom of the screen.
    There was a border drawn to the top and right of the toolbar. By using Spy++ I noticed that the toolbar
    Had the styles CBRS_BORDER_TOP | CBRS_BORDER_RIGHT which I removed.
    Probably added by MFC internally.
    The border around the toolbar except at the top disappeared.

    Maybe this will help you a bit.

    I would really happy if someone knows the solution to this problem.
    (Removing the border above the toolbar)

    / Hans H
    Code excerpt



    if (!m_pBar->Create(NULL, _T("Bar"),
    WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | CBRS_BOTTOM ,
    CRect(CPoint(0,0), szBar), this, IDW_BAR))
    {
    TRACE(_T("Cannot create Bar.\n"));
    return -1;
    }

    ((CControlBar*)m_pBar->GetParent())->ModifyStyle(CBRS_BORDER_TOP,0);
    ((CControlBar*)m_pBar->GetParent())->ModifyStyle(CBRS_BORDER_RIGHT,0);







  4. #4
    Join Date
    Sep 1999
    Location
    Santa Clara, California
    Posts
    145

    Re: Unwanted Pixels in Toolbar

    Mr Bean,
    ModifyStyle() is not removing ANY of the borders on mine. I have found, however, that the lame garbage pixels appearing in the border space of these docked toolbars (my original problem, not Bean's) is not the fault of my application. I see other applications on this system exhibiting the same behaviour, and the effect appears to be the result of the currently installed SVGA driver. Go figure. At any rate, the unwanted borders remain! Any more tips!?

    Regards,
    --Kelly



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured