Click here to Skip to main content
15,926,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Separate CStrings Pin
Rob Caldecott18-Mar-06 6:14
Rob Caldecott18-Mar-06 6:14 
GeneralBTW... Pin
Rob Caldecott18-Mar-06 6:15
Rob Caldecott18-Mar-06 6:15 
GeneralRe: BTW... Pin
ThatsAlok19-Mar-06 17:28
ThatsAlok19-Mar-06 17:28 
GeneralActually... Pin
Rob Caldecott18-Mar-06 6:20
Rob Caldecott18-Mar-06 6:20 
AnswerRe: Separate CStrings Pin
Michael Dunn18-Mar-06 6:03
sitebuilderMichael Dunn18-Mar-06 6:03 
GeneralRe: Separate CStrings Pin
fambi_mail18-Mar-06 6:22
fambi_mail18-Mar-06 6:22 
QuestionImage Infos Dlg did not appear Pin
sottos18-Mar-06 5:35
sottos18-Mar-06 5:35 
QuestionCan someone explain this??? Pin
woosoo18-Mar-06 5:31
woosoo18-Mar-06 5:31 
I used MFC appwizard and made a single document interface.
I didn't add anyother codes than this code below in OnDraw function.
I wanted to make a pyramid looking bitmap in size 256*256.
But I had to make the pointer size into 256*256*16 to make it show the size of 256*256.
if i don't, a rectangle with four small boxes of pyramid and a large black box attached to it
appers. why is it?

void CWoosooView::OnDraw(CDC* pDC)
{
CWoosooDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here

int size = 256;// the size i want to make
int realsize = size*4;// this is the size i had to pump up.

// i made a pointer and added some values to make a rectangle look like a pyramid.

p = (unsigned char*)malloc(realsize*realsize);// i had to use *4 size all the way.

// below is a code for only one pyramid, but four of them appers. why is it?

for(int y = 0; y<realsize; y++){
="" for(int="" x="0;" x<realsize;x++){
="" if="" (((x="">=0) && (x<(realsize/2)))&&((y>=0) && (y<(realsize/2))))
*(p+realsize*y+x) = (int)(x+y)/4;
else if (((x<realsize) &&="" (x="">=(realsize/2)))&&((y>=0) && (y<(realsize/2))))
*(p+realsize*y+x) = (int)(realsize+(y-x))/4;
else if (((x>=0) && (x<(realsize/2)))&&((y<realsize) &&="" (y="">=(realsize/2))))
*(p+realsize*y+x) = (int)(realsize+(x-y))/4;
else if (((x<realsize) &&="" (x="">=(realsize/2)))&&((y<realsize) &&="" (y="">=(realsize/2))))
*(p+realsize*y+x) = (int)((2*realsize-x-y)/4);
}
}

CBitmap bitmap,bitmap2;
CDC memDC;
memDC.CreateCompatibleDC(pDC);
bitmap.CreateCompatibleBitmap(pDC,realsize,realsize);//realsize = *4 of the wanted size.



bitmap.SetBitmapBits(realsize*realsize,p); // here as well. i used 256*4.
free(p);
memDC.SelectObject(bitmap);
bitmap.DeleteObject();

pDC->BitBlt(0,0,size,size,&memDC,0,0,SRCCOPY);

// so i eventually only displayed the first pyramid of 4 by setting the size of BitBlt to 256*256.


bitmap2.GetBitmapBits(SRCCOPY,bitmap);
memDC.SelectObject(bitmap2);
bitmap2.DeleteObject();

pDC->StretchBlt(256,0,size/2,size/2,&memDC,0,0,size,size,SRCCOPY);
pDC->StretchBlt(384,0,size*2,size*2,&memDC,0,0,size,size,SRCCOPY);

}


woosoo


-- modified at 11:31 Saturday 18th March, 2006
AnswerRe: Can someone explain this??? Pin
Chris Losinger18-Mar-06 6:37
professionalChris Losinger18-Mar-06 6:37 
GeneralRe: Can someone explain this??? Pin
woosoo19-Mar-06 3:36
woosoo19-Mar-06 3:36 
QuestionMSDEV crashes . Pin
FarPointer18-Mar-06 5:03
FarPointer18-Mar-06 5:03 
AnswerRe: MSDEV crashes . Pin
Waldermort18-Mar-06 5:47
Waldermort18-Mar-06 5:47 
GeneralRe: MSDEV crashes . Pin
FarPointer18-Mar-06 6:08
FarPointer18-Mar-06 6:08 
QuestionError compilation Pin
kochiukhuatphuc18-Mar-06 4:38
kochiukhuatphuc18-Mar-06 4:38 
AnswerRe: Error compilation Pin
Hamid_RT18-Mar-06 5:25
Hamid_RT18-Mar-06 5:25 
AnswerRe: Error compilation Pin
Michael Dunn18-Mar-06 5:46
sitebuilderMichael Dunn18-Mar-06 5:46 
Questionhow Pin
benniej1518-Mar-06 3:55
benniej1518-Mar-06 3:55 
AnswerRe: how Pin
PJ Arends18-Mar-06 4:44
professionalPJ Arends18-Mar-06 4:44 
QuestionObtaining recycle bin folder Pin
Chintoo72318-Mar-06 3:31
Chintoo72318-Mar-06 3:31 
AnswerRe: Obtaining recycle bin folder Pin
Hamid_RT18-Mar-06 5:15
Hamid_RT18-Mar-06 5:15 
AnswerRe: Obtaining recycle bin folder Pin
Michael Dunn18-Mar-06 5:48
sitebuilderMichael Dunn18-Mar-06 5:48 
GeneralRe: Obtaining recycle bin folder Pin
Chintoo72318-Mar-06 15:58
Chintoo72318-Mar-06 15:58 
GeneralRe: Obtaining recycle bin folder Pin
Michael Dunn18-Mar-06 18:20
sitebuilderMichael Dunn18-Mar-06 18:20 
GeneralRe: Obtaining recycle bin folder Pin
Chintoo72318-Mar-06 18:47
Chintoo72318-Mar-06 18:47 
GeneralRe: Obtaining recycle bin folder Pin
Michael Dunn18-Mar-06 19:43
sitebuilderMichael Dunn18-Mar-06 19:43 

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.