Problem Refreshing Screen
-
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
-
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
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 inRegisterClass
documentation) or HandleWM_PAINT
message to draw your Image Every Time the Windows Refreshes. also you can manually refresh your window by usingCWnd::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
-
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 inRegisterClass
documentation) or HandleWM_PAINT
message to draw your Image Every Time the Windows Refreshes. also you can manually refresh your window by usingCWnd::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
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); }
-
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); }
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
-
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
-
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
-
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
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
-
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