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
  1. Home
  2. General Programming
  3. C#
  4. MFC to C#, form changing

MFC to C#, form changing

Scheduled Pinned Locked Moved C#
csharpc++question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    muharrem
    wrote on last edited by
    #1

    I am ,lets say, newcomer from MFC to C#. With MFC using SDI model, I can switch from one view to another like follow BOOL CMainFrame::ReplaceView(CRuntimeClass * pNewViewClass) { CView* pOldActiveView = GetActiveView(); CCreateContext context; context.m_pNewViewClass = pNewViewClass; context.m_pCurrentDoc = GetActiveDocument(); CView* pNewView = STATIC_DOWNCAST(CView,CreateView(&context)); if (pNewView != NULL) { pNewView->ShowWindow (SW_SHOW); pNewView->OnInitialUpdate(); SetActiveView(pNewView); pOldActiveView->ShowWindow (SW_HIDE); // DestroyWindow calls PostNcDestroy which then deletes the // pOldActiveView object. pOldActiveView->DestroyWindow(); RecalcLayout(); } return TRUE; } Questions : 1. Can I do similiar things to switch my forms ? 2. Or can you suggest another approach ? 3. And please sample project? Thanks

    Mircea PuiuM 1 Reply Last reply
    0
    • M muharrem

      I am ,lets say, newcomer from MFC to C#. With MFC using SDI model, I can switch from one view to another like follow BOOL CMainFrame::ReplaceView(CRuntimeClass * pNewViewClass) { CView* pOldActiveView = GetActiveView(); CCreateContext context; context.m_pNewViewClass = pNewViewClass; context.m_pCurrentDoc = GetActiveDocument(); CView* pNewView = STATIC_DOWNCAST(CView,CreateView(&context)); if (pNewView != NULL) { pNewView->ShowWindow (SW_SHOW); pNewView->OnInitialUpdate(); SetActiveView(pNewView); pOldActiveView->ShowWindow (SW_HIDE); // DestroyWindow calls PostNcDestroy which then deletes the // pOldActiveView object. pOldActiveView->DestroyWindow(); RecalcLayout(); } return TRUE; } Questions : 1. Can I do similiar things to switch my forms ? 2. Or can you suggest another approach ? 3. And please sample project? Thanks

      Mircea PuiuM Offline
      Mircea PuiuM Offline
      Mircea Puiu
      wrote on last edited by
      #2

      Learning things is always good. Learning new approaches is always perfect :-) Taking into account that actually you are new to the new technologies, it is, perhaps, better for you start with latest staff. Therefore, I encourage you to have a "look" at Windows Presentation Foundation, which is the new strategic graphics subsystem in Windows that provides a unified approach to user interface, 2D and 3D graphics, documents and media. You can take a tour here[^]. -- modified at 5:40 Monday 8th January, 2007

      SkyWalker

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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