|
Hello Friends,
I'm developing an application in which there are few dialog boxes and i decided to make them colourful using bitmaps,So i used the OnEraseBkGnd function to load the bitmaps .but there was an mismatch between the dialog size and bitmap size so i decided to capture the size of the dialog and the bitmap,after which i repainted the dialog calling the BitBlt function many number of times.
Is there anyother way to load the bitmaps so that i dont have to call the BitBlt function more than once.I've attached the piece of code what i'm using now.it'd be great if someone could help me in this...
BOOL dialog::OnEraseBkgnd(CDC* pDC)
{
CBitmap bmp;
CBitmap *ptrBmpOld;
CDC dcMemory;
BITMAP bm;
CRect rect;
int i, j;
int nHor, nVer;
bmp.LoadBitmap(IDB_BITMAP1);
bmp.GetBitmap(&bm);
GetClientRect(rect);
nHor=rect.Width()/bm.bmWidth+1;
nVer=rect.Height()/bm.bmHeight+1;
dcMemory.CreateCompatibleDC(pDC);
ptrBmpOld=dcMemory.SelectObject(&bmp);
for(i=0; i<nhor; i++)
{
for(j="0;" j<nver;="" j++)
{
pdc-="">BitBlt
(
i*bm.bmWidth,
j*bm.bmHeight,
bm.bmWidth,
bm.bmHeight,
&dcMemory,
0,
0,
SRCCOPY
);
}
}
dcMemory.SelectObject(ptrBmpOld);
return TRUE;
}
Rajeev
-- modified at 8:05 Monday 3rd October, 2005
|
|
|
|
|
You could use CStatic objects, to which you set the bitmaps using SetBitmap(HBITMAP hBitmap)
SkyWalker
-- modified at 8:28 Monday 3rd October, 2005
|
|
|
|
|
Hey Rajeev
How ru ?
Just dont use any type of coding .
Put a CStatic control for displaying
the bitmap u want.
This will be more siple .
enjoy
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Yeh ur true Rajeev
As the the OnEraseBkgnd will be oftenly called
if ur going to do BitBlt in that function the
5speed will be slow .
Have u tried to use the same code with OnDraw
member function.
U can aslo try to add the code on WM_INITDIALOG.
take care
send me the feedback when u have dont it.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
how many message maps in MFC
please give me answer.
Thank you CodeProject
|
|
|
|
|
to get an answer, you might ask a correct question...
Santosh Kumar79 wrote:
please give me answer.
please give me a question to answer...
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 3:20 Tuesday 4th October, 2005
|
|
|
|
|
Have you looked through MFC's source files?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Pls explain in Detail ???
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Too many.
Search WM_ messages in MSDN you can get your answer
Iman Ghasrfakhri
|
|
|
|
|
3 I guess. 1 for CDialog and 1 for CWnd and 1 for hummm. dont know.
-prakash
|
|
|
|
|
|
Jose Lamas Rios wrote:
42
Hi Jose....how you reach to the fiqure of 42?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote:
Hi Jose....how you reach to the fiqure of 42?
Probably a bad joke, but since you ask...
I asked Deep Thought, of course!
"I checked it very thoroughly," said the computer, "and that quite definitely is the answer. I think the problem, to be quite honest with you, is that you've never actually known what the question is."
See The Answer to Life, the Universe, and Everything[^]
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose Lamas Rios wrote:
See The Answer to Life, the Universe, and Everything[^]
Great
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Santosh Kumar79 wrote:
how many message maps in MFC
ONE:-
DECLARE_MESSAGE_MAP()
BEGIN_MESSAGE_MAP()
END_MESSAGE_MAP()
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
a great joke as i like to wake up...
well, that worthes a '5' from me
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
i want to make the frame of the application in the center
of the screen ,when the application is started. how can i do it?
thank you!
libo
|
|
|
|
|
|
If this is an MFC application, have you considered CenterWindow() ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
R u doing MFC?
If so then
Do u mean the Main Window or
the child window
There is a good application
in codeproject for child window
so search that & study .I had
just gone throught it but
cant remember the URL
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
vikas amin wrote:
Do u mean the Main Window or
the child window
I Believe he is asking for some Function or api that help him to Center his Window to the desktop/Monitor.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi everybody. Something seems weird to me in the MFC, maybe I just haven't explored all options, but it looks like I can't export one of my interfaces from the project. I designed a new DIALOG, and its saved by the VC++6 IDE in the resources of the project. Now... what if I will make in the future a similar project and I just want to copy-paste that interface in my new project. It seems that I can't export the dialogue at all!!! So do I have to re-create dialogues from scratch? I don't think so. I think I'm missing something.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
You do not need to re-create dialogue.
You just need open your new project . then open the “ResourceView" ---> "Dialog", then use main menu "File"
"open" ,choose your old project's resource file(*.rc), and open it. Finally copy-paste between the two resource file.(I usually drag the old dialog into the new project).
I am sorry for my poor English not to express myself clearly.
libo
China
|
|
|
|
|
Thanks Intertherain ::- ). It works!
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|