Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
B

baumchen

@baumchen
About
Posts
12
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    Cliff thanks! looks it is easier to live with two sets of scrollbars.

    C / C++ / MFC question c++ tutorial announcement

  • MFC CScrollView update problem when scrolling
    B baumchen

    I am using a rather old vc, 2003. It is amazing to see that mspaint doesn't have any flicker when you drag the mouse and scroll it around. dunno how they achieved that. I tried creating a DDB bitmap, but it doesn't help.

    C / C++ / MFC c++ help question announcement

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    nelek thanks for the detailed info.

    C / C++ / MFC question c++ tutorial announcement

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    Cliff, thanks for the clue, it is very useful.

    BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT, CCreateContext* pContext)
    {
    // create a splitter with 1 row, 2 columns
    if (!m_SplitterController.CreateStatic(this, 1, 2, WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL))
    {
    return FALSE;
    }

    CRect		lRect;
    
    GetClientRect(lRect);
    
    // add the first splitter pane - the default view in column 0
    if (!m\_SplitterController.CreateView(0, 0, pContext->m\_pNewViewClass, 
    	CSize(lRect.Width() >> 1, lRect.Height()), pContext))
    {
    	return FALSE;
    }
    
    // add the second splitter pane - an input view in column 1
    if (!m\_SplitterController.CreateView(0, 1, pContext->m\_pNewViewClass, 
    	CSize((lRect.Width() + 1) >> 1, lRect.Height()), pContext))
    {
    	return FALSE;
    }
    
    // activate the input view
    SetActiveView((CView\*)m\_SplitterController.GetPane(0, 1));
    
    m\_IsInitialized = TRUE;
    
    return TRUE;
    

    however, it only partly works at here --- there is only one vertical scroll bar, but there are two horizontal scroll bars, did I miss anything? and, how do you answer scroll message? I added it to CChildFrame, which is a subclass of CMDIChildWnd, but it was never called.

    afx\_msg void	OnHScroll(UINT nSBCode, UINT nPos, CScrollBar\* pScrollBar);
    afx\_msg void	OnVScroll(UINT nSBCode, UINT nPos, CScrollBar\* pScrollBar);
    

    ...

    BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
    ON_WM_HSCROLL()
    ON_WM_VSCROLL()
    ON_WM_MOUSEWHEEL()
    ON_WM_SIZE()
    END_MESSAGE_MAP()

    ...

    void CChildFrame::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    {
    CMDIChildWnd::OnHScroll(nSBCode, nPos, pScrollBar);
    }

    any idea? many thanks!

    C / C++ / MFC question c++ tutorial announcement

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    i planed to use two views, and attached a scrollbar to CMDIChildWnd (i can't attach scrollbar to CDocument, as it is not a CWnd). UpdateAllView only affect views, but not their container CMDIChildWnd. If using scrollviews, I need to synchronize two scrollbars.....

    C / C++ / MFC question c++ tutorial announcement

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    Nelek wrote:

    Or just setting the scroll for both views where you need

    could you give a little bit more info? are both views scrollviews or there is a scrollbar on top of them? if both are scrollviews, how can I set scroll for both views? which class should handle scroll message? thanks!

    C / C++ / MFC question c++ tutorial announcement

  • MFC CScrollView update problem when scrolling
    B baumchen

    Nelek thanks for the reply. Do you have a counter to count how many times OnDraw is called per scroll? in my code, I found it was called 2 or 3 times per scroll, and it caused flicker when scrolling (when dragging the scrollbar). any clue? thanks!

    C / C++ / MFC c++ help question announcement

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    exactly. but I don't want to use two scrollbars, is it achievable?

    C / C++ / MFC question c++ tutorial announcement

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    it is not, it is a CFrameWnd, container of CDocument and CView.

    C / C++ / MFC question c++ tutorial announcement

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    thanks for the reply. but updateview doesn't solve my problem, as scrollbar doesn't belong to a specific view (it belongs to CMDIChildWnd), and I need to update it too. any idea? thanks!

    C / C++ / MFC question c++ tutorial announcement

  • MFC How to update CMDIChildWnd from CDocument
    B baumchen

    Hi, folks I am thinking of writing a program which opens two files in one window. and these two files needs to be scrolled simulateneously. (I have to put the scrollbar here as I have multiple views). I plan to use such a structure CMDIChildWnd, which has a scrollbar, and CSplitterWnd, its role is to change answer scroll related message such as OnSize, OnScroll. CView, handles OnDraw, displays file. CDocument, which has files info. (I need to take advantage of OnOpenDocument) the question is, when I load a file (which is handled by CDocument) either by OnOpenDocument() or some user defined open file function, how could I update CMDIChildWnd? thanks in advance! baum

    C / C++ / MFC question c++ tutorial announcement

  • MFC CScrollView update problem when scrolling
    B baumchen

    Hi, folks I met such a problem when implementing a CScrollView class. what i want to do is to show two images in one CScrollView instance, so I have the following code (below only shows one image in the left part of the window).

    void OnDraw(CDC* pDC)
    {
    CDC dcMem;
    CRect lRect;

    GetClientRect(lRect);
    lRect.NormalizeRect();

    dcMem.CreateCompatibleDC(pDC);

    CBitmap* pOldBitmap = (CBitmap*) dcMem.SelectObject(m_SourceBitmap);
    CPoint scrollPosition = GetScrollPosition();

    pDC->BitBlt(scrollPosition.x, scrollPosition.y, lRect.Width() / 2, lRect.Height(), &dcMem, scrollPosition.x, scrollPosition.y, SRCCOPY);

    DeleteDC(dcMem);
    }

    however, when I scroll the window, right half part of the window always has some problem, either too much background (scrolling left) or too few background (scrolling right). when I hide and show the window, everything is fine. alternatively, I tried calling Invalidate() from OnScroll, flicker happens because OnDraw is called multiple times. anyone got a solution? thanks! baum

    C / C++ / MFC c++ help question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups