Solved

CToolBar Problem or ?

Posted on 2003-11-21
3
715 Views
Last Modified: 2013-11-20
Hi All, this is my first time here and I have a little MFC problem.

Here is the code:

// in my CMain class
CToolBar m_wndToolBar;
CStatusBar m_wndStatusBar;

// in CMain::OnCreate

if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
      | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
      !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))
      {
      return -1;      // failed
      }

      if(!m_wndStatusBar.Create(this))
      {
            return -1; // failed
      }

Question:

Everything works fine when I run my app I got the ToolBar and StatusBar, now my question is
when I resize my window, inside my toolbar/statusbar I can see some kind of white lines or some flashes like changing color very fast grey->white->grey any ideas how I can fix it ? or it should be like that ? :) thx in Advance.

Sorry for my BAD english :)
0
Comment
Question by:ocZio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 9796618
Hi ocZio,

I assume CMain is you frame window (either main or child frame), CFrameWnd derived

if so, do you call RecalcLayout() after creating the toolbar/statusbar?

ZOPPO
0
 

Author Comment

by:ocZio
ID: 9797779
Hi ZOPPO,
No I don't have the RecalcLayout() after the creation, even If I put there it doesnt change something I still have the same effect :), at msdn it tells that it will be called on Resize or when the controlbars are toggled on or of, I tried to use it in CMain::OnSize() with the MESSAGE_MAP but still the same result :O
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 50 total points
ID: 9802697
'I can see some kind of white lines or some flashes like changing color very fast grey->white->grey'

That sounds like a normal repainting of the toolbar/statusbar.
Windows repainting involves a WM_ERASEBACKGROUND message and then a separate WM_PAINT message.  This can lead to flickering.
It can be annoying but it doesn't cause any problems.
The only way I know of (possibly) curing this is to create your own custom class and handle the erasing of the background and the painting yourself.  That is not so trivial (the background is, the painting unfortunately not).


ps. Your english is fine.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question