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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem Refreshing Screen

Problem Refreshing Screen

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
8 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.
  • P Offline
    P Offline
    popo84
    wrote on last edited by
    #1

    I am currently working out a project using Digital Gates, we've done the implementation of the circuit and the results will all ok. But there was a problem that i am facing currently, my Digital Gates will always disappear when i minimize or maximize the screen of my program. I know that i can use CWnd::UpdateWindow to refresh the screen, but i do not know how and also what are the parameters and arguments should i add in? Can anyone guide me through this difficult stage thank you. From: Guilbert

    T 1 Reply Last reply
    0
    • P popo84

      I am currently working out a project using Digital Gates, we've done the implementation of the circuit and the results will all ok. But there was a problem that i am facing currently, my Digital Gates will always disappear when i minimize or maximize the screen of my program. I know that i can use CWnd::UpdateWindow to refresh the screen, but i do not know how and also what are the parameters and arguments should i add in? Can anyone guide me through this difficult stage thank you. From: Guilbert

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      popo84 wrote: my Digital Gates will always disappear when i minimize or maximize the screen of my program. you have two solution to this problem :- either create your window with CS_SAVEBITS Class style which make your drawing on screen persistent! (look for more detail about above property in RegisterClass documentation) or Handle WM_PAINT message to draw your Image Every Time the Windows Refreshes. also you can manually refresh your window by using CWnd::Invalidate()

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta

      P 1 Reply Last reply
      0
      • T ThatsAlok

        popo84 wrote: my Digital Gates will always disappear when i minimize or maximize the screen of my program. you have two solution to this problem :- either create your window with CS_SAVEBITS Class style which make your drawing on screen persistent! (look for more detail about above property in RegisterClass documentation) or Handle WM_PAINT message to draw your Image Every Time the Windows Refreshes. also you can manually refresh your window by using CWnd::Invalidate()

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        cheers, Alok Gupta

        P Offline
        P Offline
        popo84
        wrote on last edited by
        #3

        But i did not use WM_PAINT, i created my own Function with parameters Below is what i created: void ShowBitmap(int x, int y, int Gate) { CDocument* pDoc = GetDocument(); CClientDC dc(this); CBitmap bitmap; CDC dcMemory; BITMAP bm; switch (kind) { case AND : bitmap.LoadMappedBitmap(IDB_AND,0); break; case NAND : bitmap.LoadMappedBitmap(IDB_NAND,0); break; case OR : bitmap.LoadMappedBitmap(IDB_OR,0); break; case NOR : bitmap.LoadMappedBitmap(IDB_NOR,0); break; case NOT : bitmap.LoadMappedBitmap(IDB_NOT,0); break; case XOR : bitmap.LoadMappedBitmap(IDB_XOR,0); break; case XNOR : bitmap.LoadMappedBitmap(IDB_XNOR,0); break; case DLR : bitmap.LoadMappedBitmap(IDB_DLR,0); break; case SLR : bitmap.LoadMappedBitmap(IDB_SLR,0); break; case _1TO2LR : bitmap.LoadMappedBitmap(IDB_1TO2LR,0); break; case UD : bitmap.LoadMappedBitmap(IDB_UD,0); break; case UL : bitmap.LoadMappedBitmap(IDB_UL,0); break; case UR : bitmap.LoadMappedBitmap(IDB_UR,0); break; case DL : bitmap.LoadMappedBitmap(IDB_DL,0); break; case DR : bitmap.LoadMappedBitmap(IDB_DR,0); break; case LT_ON: bitmap.LoadMappedBitmap(IDB_LT_ON); break; case LT_OFF: bitmap.LoadMappedBitmap(IDB_LT_OFF); break; case _DEL : bitmap.LoadMappedBitmap(IDB_EMPTY,0); break; case START : if(kind==START) m_dStart.DoModal(); //popup dialog box if (m_dStart.StartValue==0) bitmap.LoadMappedBitmap(IDB_START0,0); else bitmap.LoadMappedBitmap(IDB_START1,0); //UpdateData(FALSE); break; case END : bitmap.LoadMappedBitmap(IDB_END,0); break; default : break; } bitmap.GetObject(sizeof(BITMAP),&bm); dcMemory.CreateCompatibleDC(&dc); dcMemory.SelectObject(&bitmap); dc.BitBlt(x,y,bm.bmWidth,bm.bmHeight,&dcMemory,0,0,SRCCOPY); }

        T 1 Reply Last reply
        0
        • P popo84

          But i did not use WM_PAINT, i created my own Function with parameters Below is what i created: void ShowBitmap(int x, int y, int Gate) { CDocument* pDoc = GetDocument(); CClientDC dc(this); CBitmap bitmap; CDC dcMemory; BITMAP bm; switch (kind) { case AND : bitmap.LoadMappedBitmap(IDB_AND,0); break; case NAND : bitmap.LoadMappedBitmap(IDB_NAND,0); break; case OR : bitmap.LoadMappedBitmap(IDB_OR,0); break; case NOR : bitmap.LoadMappedBitmap(IDB_NOR,0); break; case NOT : bitmap.LoadMappedBitmap(IDB_NOT,0); break; case XOR : bitmap.LoadMappedBitmap(IDB_XOR,0); break; case XNOR : bitmap.LoadMappedBitmap(IDB_XNOR,0); break; case DLR : bitmap.LoadMappedBitmap(IDB_DLR,0); break; case SLR : bitmap.LoadMappedBitmap(IDB_SLR,0); break; case _1TO2LR : bitmap.LoadMappedBitmap(IDB_1TO2LR,0); break; case UD : bitmap.LoadMappedBitmap(IDB_UD,0); break; case UL : bitmap.LoadMappedBitmap(IDB_UL,0); break; case UR : bitmap.LoadMappedBitmap(IDB_UR,0); break; case DL : bitmap.LoadMappedBitmap(IDB_DL,0); break; case DR : bitmap.LoadMappedBitmap(IDB_DR,0); break; case LT_ON: bitmap.LoadMappedBitmap(IDB_LT_ON); break; case LT_OFF: bitmap.LoadMappedBitmap(IDB_LT_OFF); break; case _DEL : bitmap.LoadMappedBitmap(IDB_EMPTY,0); break; case START : if(kind==START) m_dStart.DoModal(); //popup dialog box if (m_dStart.StartValue==0) bitmap.LoadMappedBitmap(IDB_START0,0); else bitmap.LoadMappedBitmap(IDB_START1,0); //UpdateData(FALSE); break; case END : bitmap.LoadMappedBitmap(IDB_END,0); break; default : break; } bitmap.GetObject(sizeof(BITMAP),&bm); dcMemory.CreateCompatibleDC(&dc); dcMemory.SelectObject(&bitmap); dc.BitBlt(x,y,bm.bmWidth,bm.bmHeight,&dcMemory,0,0,SRCCOPY); }

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          Now Simple Draw the Bitmap using this piece of code

          void ::OnPaint()
          {
          //call your showBitmap function to draw image again
          this->ShowBitmap(x,y,Gate);
          }

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta

          P 1 Reply Last reply
          0
          • T ThatsAlok

            Now Simple Draw the Bitmap using this piece of code

            void ::OnPaint()
            {
            //call your showBitmap function to draw image again
            this->ShowBitmap(x,y,Gate);
            }

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            cheers, Alok Gupta

            P Offline
            P Offline
            popo84
            wrote on last edited by
            #5

            Hi Again thanks for your help Next Step what should i do? From: popo84

            P 1 Reply Last reply
            0
            • P popo84

              Hi Again thanks for your help Next Step what should i do? From: popo84

              P Offline
              P Offline
              popo84
              wrote on last edited by
              #6

              Hi again i already follow your instruction and putting this->ShowBitmap(x,y,Gate); but got some errors: c:\Documents and Settings\Administrator\My Documents\My Received Files\Jingpo work\E-learn_ruler_gate_SDObject\E-learn\E-learnView.cpp(1347): error C2144: syntax error : 'int' should be preceded by ')' c:\Documents and Settings\Administrator\My Documents\My Received Files\Jingpo work\E-learn_ruler_gate_SDObject\E-learn\E-learnView.cpp(1347): error C2660: 'CElearnView::ShowBitmap' : function does not take 0 arguments c:\Documents and Settings\Administrator\My Documents\My Received Files\Jingpo work\E-learn_ruler_gate_SDObject\E-learn\E-learnView.cpp(1347): error C2059: syntax error : ')' Thanks for your help really From: popo84

              T 1 Reply Last reply
              0
              • P popo84

                Hi again i already follow your instruction and putting this->ShowBitmap(x,y,Gate); but got some errors: c:\Documents and Settings\Administrator\My Documents\My Received Files\Jingpo work\E-learn_ruler_gate_SDObject\E-learn\E-learnView.cpp(1347): error C2144: syntax error : 'int' should be preceded by ')' c:\Documents and Settings\Administrator\My Documents\My Received Files\Jingpo work\E-learn_ruler_gate_SDObject\E-learn\E-learnView.cpp(1347): error C2660: 'CElearnView::ShowBitmap' : function does not take 0 arguments c:\Documents and Settings\Administrator\My Documents\My Received Files\Jingpo work\E-learn_ruler_gate_SDObject\E-learn\E-learnView.cpp(1347): error C2059: syntax error : ')' Thanks for your help really From: popo84

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                popo84 wrote: Hi again i already follow your instruction and putting this->ShowBitmap(x,y,Gate); is ShowBitmap is member of view class

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta

                P 1 Reply Last reply
                0
                • T ThatsAlok

                  popo84 wrote: Hi again i already follow your instruction and putting this->ShowBitmap(x,y,Gate); is ShowBitmap is member of view class

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta

                  P Offline
                  P Offline
                  popo84
                  wrote on last edited by
                  #8

                  Yes it is a member of the View Class and just want to tell you that our View Class is being change to ScrollView From: Guilbert:)

                  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