how to creat a scrollbar in mode SDI ??? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how to creat a scrollbar in mode SDI ???

nhocgrubynhocgruby Posts: 4Member
I have an application MFC Wizard (exe) in mode SDI , I want to creat a scrollbar in my program . Can you help me step by step ? Thank you very much .

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : I have an application MFC Wizard (exe) in mode SDI , I want to creat
    : a scrollbar in my program . Can you help me step by step ? Thank you
    : very much .
    :
    [color=Blue]When you create your CView-based class specify WS_VSCROLL style and that should do it.[/color]
  • nhocgrubynhocgruby Posts: 4Member
    : : I have an application MFC Wizard (exe) in mode SDI , I want to creat
    : : a scrollbar in my program . Can you help me step by step ? Thank you
    : : very much .
    : :
    : [color=Blue]When you create your CView-based class specify
    : WS_VSCROLL style and that should do it.[/color]

    I don't understand . Can you help me again?

    I have an application ( SDI ) like the Wordpad Window Program, and when i touch many words , i can not see all them because i have not a scrollbar . It is my problem .


  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : : : I have an application MFC Wizard (exe) in mode SDI , I want to creat
    : : : a scrollbar in my program . Can you help me step by step ? Thank you
    : : : very much .
    : : :
    : : [color=Blue]When you create your CView-based class specify
    : : WS_VSCROLL style and that should do it.[/color]
    :
    : I don't understand . Can you help me again?
    :
    : I have an application ( SDI ) like the Wordpad Window Program, and
    : when i touch many words , i can not see all them because i have not
    : a scrollbar . It is my problem .
    :
    :
    :
    [color=Blue]
    Find this code in your MFC application and add a scroll bar style (RED):
    [/color]
    [code]
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;

    // create a view to occupy the client area of the frame
    if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW | [color=Red]WS_VSCROLL[/color],
    CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    {
    TRACE0("Failed to create view window
    ");
    return -1;
    }
    return 0;
    }
    [/code]
    [color=Blue]
    Now, add the scrolling handler to your CView-based window:
    [code]
    void CChildView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    {
    }
    [/code]
    [/color]
  • nhocgrubynhocgruby Posts: 4Member
    : : : : I have an application MFC Wizard (exe) in mode SDI , I want to creat
    : : : : a scrollbar in my program . Can you help me step by step ? Thank you
    : : : : very much .
    : : : :
    : : : [color=Blue]When you create your CView-based class specify
    : : : WS_VSCROLL style and that should do it.[/color]
    : :
    : : I don't understand . Can you help me again?
    : :
    : : I have an application ( SDI ) like the Wordpad Window Program, and
    : : when i touch many words , i can not see all them because i have not
    : : a scrollbar . It is my problem .
    : :
    : :
    : :
    : [color=Blue]
    : Find this code in your MFC application and add a scroll bar style
    : (RED):
    : [/color]
    : [code]:
    : int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    : {
    : if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    : return -1;
    :
    : // create a view to occupy the client area of the frame
    : if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW | [color=Red]WS_VSCROLL[/color],
    : CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    : {
    : TRACE0("Failed to create view window
    ");
    : return -1;
    : }
    : return 0;
    : }
    : [/code]:
    : [color=Blue]
    : Now, add the scrolling handler to your CView-based window:
    : [code]:
    : void CChildView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
    : {
    : }
    : [/code]:
    : [/color]


    In my file mainframe , i only see some code :

    [code]int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;

    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_MAINFRAME))
    {
    TRACE0("Failed to create toolbar
    ");
    return -1; // fail to create
    }

    if (!m_wndStatusBar.Create(this) ||
    !m_wndStatusBar.SetIndicators(indicators,
    sizeof(indicators)/sizeof(UINT)))
    {
    TRACE0("Failed to create status bar
    ");
    return -1; // fail to create
    }

    // TODO: Delete these three lines if you don't want the toolbar to
    // be dockable
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar);

    return 0;
    }
    [/code]

    I dont see things you talk to me ???

Sign In or Register to comment.