Solved

CToolBar Problem or ?

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 100
Detect CR LF to each line 12 137
sumNumber challenge 16 99
fizzArray  challenge 1 47
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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now