Click here to Skip to main content
16,009,114 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionrichedit controls Pin
Waldermort17-Mar-06 7:47
Waldermort17-Mar-06 7:47 
AnswerRe: richedit controls Pin
Waldermort17-Mar-06 8:26
Waldermort17-Mar-06 8:26 
QuestionTrackbar Control Pin
amanoullah17-Mar-06 7:44
amanoullah17-Mar-06 7:44 
AnswerRe: Trackbar Control Pin
Waldermort17-Mar-06 7:53
Waldermort17-Mar-06 7:53 
GeneralRe: Trackbar Control Pin
Ravi Bhavnani17-Mar-06 11:33
professionalRavi Bhavnani17-Mar-06 11:33 
QuestionWhere are IE favourites in registry Pin
Chintoo72317-Mar-06 6:10
Chintoo72317-Mar-06 6:10 
AnswerRe: Where are IE favourites in registry Pin
Michael Dunn17-Mar-06 6:53
sitebuilderMichael Dunn17-Mar-06 6:53 
QuestionHow do i create my own bitmap? Pin
woosoo17-Mar-06 5:23
woosoo17-Mar-06 5:23 
I used MFC AppWizard->Selected Single Document Interface-> and all nexts then clicked ok at step six using Visual Studio 6.0.
I then put this following code in the OnDraw() function in FilenameView.cpp.
I didn't change any other codes than this.

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

///////////////////////
// MY CODE STARTS HERE
///////////////////////

///////////////////////////////////////
// i tried to make a pointer and put in some numbers 0~255 to make a rectangle pyramid.
///////////////////////////////////////
int size;
unsigned char *p;
p = (unsigned char*)malloc(size*size);
for(int y = 0; y<size; y++)
{
="" for(int="" x="0;" x<size;x++)
{
="" if="" ((x="">=0 && x<(size/2))&&(y>=0 && y<(size/2)))
*(p+size*y+x) = (x+y);
else if ((x<size &&="" x="">=(size/2))&&(y>=0 && y<(size/2)))
*(p+size*y+x) = (size-x+y-1);
else if ((x>=0 && x<(size/2))&&(y<size &&="" y="">=(size/2)))
*(p+size*y+x) = (size+x-y-1);
else if ((x<size &&="" x="">=(size/2))&&(y<size &&="" y="">=(size/2)))
*(p+size*y+x) = (2*size-2-x-y);
}
}

////////////////////////////////////
CBitmap bitmap; // i made a bitmap
CDC memDC; // and a device context
memDC.CreateCompatibleDC(pDC);// then made it compatible
bitmap.CreateBitmap(size,size,1,8,p);//**************problem line
memDC.SelectObject(bitmap);// then let the device context select it.
pDC->StretchBlt(0,0,size,size,&memDC,0,0,size,size,SRCCOPY);// and displayed.
free(p);
}
///////////////////////
// MY CODE ENDS HERE
///////////////////////
}

***********problem line, which is ====> bitmap.CreateBitmap(size,size,1,8,p);
// here's the problem. when i change the 4th value 8 to 1, a monochrome pyramid appears when executed. but i'm trying to make the pyramid smoother just like the greyscale. so 8 should be left 8, i think....


Right now, nothing appears on screen.
someone plz helpme~~



woosoo


-- modified at 12:02 Friday 17th March, 2006
AnswerRe: How do i create my own bitmap? Pin
PJ Arends17-Mar-06 13:45
professionalPJ Arends17-Mar-06 13:45 
GeneralRe: How do i create my own bitmap? Pin
woosoo18-Mar-06 5:38
woosoo18-Mar-06 5:38 
Questionx ==> next biggest power of two Pin
peterchen17-Mar-06 5:06
peterchen17-Mar-06 5:06 
AnswerRe: x ==> next biggest power of two Pin
Chris Losinger17-Mar-06 5:10
professionalChris Losinger17-Mar-06 5:10 
GeneralRe: x ==> next biggest power of two Pin
peterchen17-Mar-06 6:07
peterchen17-Mar-06 6:07 
GeneralRe: x ==> next biggest power of two Pin
jhwurmbach17-Mar-06 6:51
jhwurmbach17-Mar-06 6:51 
GeneralRe: x ==> next biggest power of two Pin
peterchen17-Mar-06 13:06
peterchen17-Mar-06 13:06 
AnswerRe: x ==> next biggest power of two Pin
Gordon Brandly17-Mar-06 7:47
Gordon Brandly17-Mar-06 7:47 
AnswerRe: x ==> next biggest power of two Pin
krmed17-Mar-06 10:06
krmed17-Mar-06 10:06 
GeneralRe: x ==> next biggest power of two Pin
Jörgen Sigvardsson17-Mar-06 10:49
Jörgen Sigvardsson17-Mar-06 10:49 
GeneralRe: x ==> next biggest power of two Pin
peterchen17-Mar-06 13:09
peterchen17-Mar-06 13:09 
GeneralRe: x ==> next biggest power of two Pin
krmed18-Mar-06 3:21
krmed18-Mar-06 3:21 
AnswerRe: x ==> next biggest power of two Pin
David Crow17-Mar-06 16:42
David Crow17-Mar-06 16:42 
AnswerRe: x ==&gt; next biggest power of two Pin
cmk18-Mar-06 12:44
cmk18-Mar-06 12:44 
QuestionHow can I have a window with thick frame but no resize? Pin
Axonn Echysttas17-Mar-06 4:54
Axonn Echysttas17-Mar-06 4:54 
AnswerRe: How can I have a window with thick frame but no resize? Pin
basementman17-Mar-06 5:38
basementman17-Mar-06 5:38 
GeneralRe: How can I have a window with thick frame but no resize? Pin
Axonn Echysttas17-Mar-06 5:45
Axonn Echysttas17-Mar-06 5:45 

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.