Solved

CToolBar Problem or ?

Posted on 2003-11-21
3
706 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 96
ASCII Non-Printable characters/codes and their HTML equivalents 6 115
noX challenge 17 116
Problem to event 3 95
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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 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