Click here to Skip to main content
15,890,185 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: SMBIOS - DMI Pin
David Crow21-Feb-06 10:17
David Crow21-Feb-06 10:17 
QuestionVC++ won't install! ARGH! Pin
Lord Kixdemp21-Feb-06 8:22
Lord Kixdemp21-Feb-06 8:22 
AnswerRe: VC++ won't install! ARGH! Pin
Joe Woodbury21-Feb-06 8:29
professionalJoe Woodbury21-Feb-06 8:29 
GeneralRe: VC++ won't install! ARGH! Pin
Lord Kixdemp21-Feb-06 8:48
Lord Kixdemp21-Feb-06 8:48 
AnswerRe: VC++ won't install! ARGH! Pin
Ryan Binns21-Feb-06 18:13
Ryan Binns21-Feb-06 18:13 
GeneralRe: VC++ won't install! ARGH! Pin
Lord Kixdemp22-Feb-06 10:37
Lord Kixdemp22-Feb-06 10:37 
GeneralRe: VC++ won't install! ARGH! Pin
Ryan Binns22-Feb-06 12:16
Ryan Binns22-Feb-06 12:16 
GeneralRe: VC++ won't install! ARGH! Pin
Lord Kixdemp22-Feb-06 12:29
Lord Kixdemp22-Feb-06 12:29 
QuestionSyncing the files Pin
cuteee21-Feb-06 7:03
cuteee21-Feb-06 7:03 
AnswerRe: Syncing the files Pin
David Crow21-Feb-06 7:13
David Crow21-Feb-06 7:13 
GeneralRe: Syncing the files Pin
cuteee21-Feb-06 10:47
cuteee21-Feb-06 10:47 
QuestionRe: Syncing the files Pin
David Crow22-Feb-06 2:48
David Crow22-Feb-06 2:48 
QuestionRe: Syncing the files Pin
cuteee22-Feb-06 6:49
cuteee22-Feb-06 6:49 
QuestionRe: Syncing the files Pin
David Crow22-Feb-06 7:31
David Crow22-Feb-06 7:31 
QuestionRe: Syncing the files Pin
cuteee22-Feb-06 7:34
cuteee22-Feb-06 7:34 
AnswerRe: Syncing the files Pin
David Crow22-Feb-06 7:41
David Crow22-Feb-06 7:41 
QuestionDrawings disappear !!! Pin
llp00na21-Feb-06 6:17
llp00na21-Feb-06 6:17 
Dear all;

I am having this weird problem where I am drawing ellipses but they disppear if i resize the dialog box or move the mouse over the shapes.

I know that this problem is related to OnPaint(). Now that i have tried to call Invalidate() and UpdateWindow() after the drawings, I get a blank screen with no drawings. And because the shapes are only drawn whenever I press a specific button, I kind of see the drawings but they quickly disappear.

Here is some code to give u insights:

int CTestDlg::buttonClicked(void)
{
CClientDC dc(this);
drawShapes(dc);
drawings = TRUE;
Invalidate(TRUE);
//UpdateWindow();

}

void CTestDlg::drawShapes(CDC& cd)
{
for(int index = 0; index < 20, index ++ ){
xCentre = getRandom(0, 1000);
yCentre = getRandom(0, 700);
cd.Ellipse(xCentre + 20, yCentre + 17, xCentre - 20, yCentre - 17);
cd.TextOut(xCentre -10, yCentre-10, "A test");
}
// getRandom () is a method which returns a random number
// that is greater than 0 and smaller than 1000 for x and 700 for y
}


void CTestDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, reinterpret_cast<wparam>(dc.GetSafeHdc()), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);

CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);

if(drawings == TRUE){
drawShapes(dc);
}
}
else
{
CDialog::OnPaint();
}
}

Now can someone please tell me whats going wrong with my application ??

Thank you

llp00na

-- modified at 12:18 Tuesday 21st February, 2006
AnswerRe: Drawings disappear !!! Pin
Jim Crafton21-Feb-06 6:31
Jim Crafton21-Feb-06 6:31 
GeneralRe: Drawings disappear !!! Pin
llp00na21-Feb-06 7:05
llp00na21-Feb-06 7:05 
AnswerRe: Drawings disappear !!! Pin
David Crow21-Feb-06 7:14
David Crow21-Feb-06 7:14 
GeneralRe: Drawings disappear !!! Pin
llp00na21-Feb-06 7:20
llp00na21-Feb-06 7:20 
GeneralRe: Drawings disappear !!! Pin
David Crow21-Feb-06 9:04
David Crow21-Feb-06 9:04 
GeneralRe: Drawings disappear !!! Pin
llp00na22-Feb-06 2:05
llp00na22-Feb-06 2:05 
GeneralRe: Drawings disappear !!! Pin
Stephen Hewitt21-Feb-06 11:24
Stephen Hewitt21-Feb-06 11:24 
GeneralRe: Drawings disappear !!! Pin
Owner drawn21-Feb-06 16:46
Owner drawn21-Feb-06 16:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.