?
Solved

CToolBar Problem or ?

Posted on 2003-11-21
3
Medium Priority
?
722 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 150 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

800 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