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
Solved

CToolBar Problem or ?

Posted on 2003-11-21
3
708 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
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 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