-
Can someone Help me?
hai,someone is good in programming.
i have one question that i cracked my head.i really don't know how to do it.can someone pls lead me to it?it will be very appreciated if u can help me.
here is the question!
write a pro to display a bitmap in the client area and provide a menu with the options:
1.normal size
2.double size
3.half size.
i hope u can give me solution as soon as u can coz i have to finish it up soon.Arigatou! This is my first time i am around in here.
-
look into StretchBlt() .This copies and can compress/enlarge a bitmap.
-
Is there a way?
moshi,stonedcoder
yes,how to look in the stretchbit?would u tell me this one?i am new in here. would it make it into double size and half size of the bitmap size?looking forward...............urs response.
-
HELP!
anyone who can help me with that question,pls?i need to finish it as soon by the day after tomolo?can u pls give me some code for that question?i really don't know how to do it? thax....really need the help for once in here.
-
Multiple posting/thread bumping is against the rules, please don't do it.
If you want help with your code, post it, and tell us where it is broken.
-
www.msdn.microsoft.com
The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.
BOOL StretchBlt(
HDC hdcDest, // handle to destination device context
int nXOriginDest, // x-coordinate of upper-left corner of dest. rectangle
int nYOriginDest, // y-coordinate of upper-left corner of dest. rectangle
int nWidthDest, // width of destination rectangle
int nHeightDest, // height of destination rectangle
HDC hdcSrc, // handle to source device context
int nXOriginSrc, // x-coordinate of upper-left corner of source rectangle
int nYOriginSrc, // y-coordinate of upper-left corner of source rectangle
int nWidthSrc, // width of source rectangle
int nHeightSrc, // height of source rectangle
DWORD dwRop // raster operation code
);
If you need more help, show us what you've got so far.
-
Look at GetObject() and BITMAP structure.
In these two are the secret / answer.
The rest is simple math and StretchBlt().
-
is this the way?
write a pro to display a bitmap in the client area and provide a menu with the options:
1.normal size
2.double size
3.half size.
i have written a program.i have error in it.i don't whether it's correct or not.is there anyone can correct it for me and see whether it meets the requirement of the question? thaxx......
#include<afxwin.h>
#include"resource.h"
class MyWindow:public CFrameWnd
{
public:
void OnLButtonDown(UINT flags,CPoint Point1);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(MyWindow,CFrameWnd)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
void OnBitmap::OnLButtonDown(UINT flags,CPoint Point1)
{
CBitmap bmp;
BITMAP bm;
CClientDC d(this);
CDC memdc;
bmp.LoadBitmap(IDB_BITMAP1);
bmp.GetObject(sizeof(BITMAP),&bm);
memdc.CreateCompatibleDC(&d);
memdc.SelectObject(&bmp);
d.BitBIt(0,0,bm.bmWidth,bm.bmheight,&memdc,0,0,SRC COPY);
};
BOOL StretchBlt( 0,0,bm.bmwidth,*2,&memdc,0,0,SRCCOPY
HDC hdcDest,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
DWORD dwRop
);
class MyApp:public CWinApp
{
public:
BOOL InitInstance();
BOOL ExitInstance();
};
BOOL MyApp::InitInstance()
{
::MessageBox(0,"Sample Window","InitInstance",MB_OK|MB_ICONASTERISK);
MyWindow *MyWindowObject;
MyWindowObject=new MyWindow;
m_pMainWnd=MyWindowObject;
MyWindowObject->ShowWindow(SW_SHOWMAXIMIZED);
hCursor=LoadCursor(MAKEINTRESOURCE(IDC_CURSOR1));
return TRUE;
}
BOOL MyApp::ExitInstance()
{
::MessageBox(0,"Sample Window","ExitInstance",MB_OK|MB_ICONHAND);
return TRUE;
}
MyApp ApplicationObject;
hope someone there can fixed this out for me. Urgent!
-
For starters and without even looking at the errors:
>provide a menu with the options
I don't see any menu in your code.
-
URGENT!
#include<afxwin.h>
#include"resource.h"
class MyWindow::public CFrameWnd
{
protected:
CMenu *m_MyMenu;
public:
void OnLButtonDown(UINT flags,CPoint Point1);
MyWindow();
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(MyWindow,CFrameWnd)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
void OnBitmap::OnLButtonDown(UINT flags,CPoint Point1)
{
CBitmap bmp;
BITMAP bm;
CClientDC d(this);
CDC memdc;
bmp.LoadBitmap(IDB_BITMAP1);
bmp.GetObject(sizeof(BITMAP),&bm);
memdc.CreateCompatibleDC(&d);
memdc.SelectObject(&bmp);
d.BitBIt(0,0,bm.bmWidth,bm.bmheight,&memdc,0,0,SRC COPY);
};
BOOL StretchBlt( 0,0,bm.bmwidth,bm.bmheight*2,&memdc,0,0,SRCCOPY
HDC hdcDest,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
DWORD dwRop
);
class MyAppublic CWinApp
{
public:
BOOL InitInstance();
BOOL ExitInstance();
};
BOOL MyApp::InitInstance()
{
::MessageBox(0,"Sample Window","InitInstance",MB_OK|MB_ICONASTERISK);
MyWindow *MyWindowObject;
MyWindowObject=new MyWindow;
m_pMainWnd=MyWindowObject;
MyWindowObject->ShowWindow(SW_SHOWMAXIMIZED);
hCursor=LoadCursor(MAKEINTRESOURCE(IDC_CURSOR1));
return TRUE;
}
BOOL MyApp::ExitInstance()
{
::MessageBox(0,"Sample Window","ExitInstance",MB_OK|MB_ICONHAND);
return TRUE;
}
MyApp ApplicationObject;
so,tell me what is wrong? plss...it's urgent!!!
-
some moderator plss!!!!!
hello,i really need a help in here. why no ones correct the coding for me? i really need to finish it by tomolo............ can someone plss help me? :((( urgent plsss
-
When using MFC StretchBlit() is a member of CDC, so you want to remove the global function (I'm not sure what it's doing there anyway). Then replace the d.BitBlt() call with d.StretchBlt().
-
Hello Zen!!
i am not so sure of that. can u pls....show me where is it broken or where is it wrong? maybe i have a suggestion...would u pls...
write the whole coding in there? i just wanna someone to fix it up for me. i really need it tomolo morning..... it's so urgent......
help help help plssssssssssss.................. :(((
-
What exactly don't you understand?
-
>why no ones correct the coding for me?
>i just wanna someone to fix it up for me.
This board is a board of volunteers. So if noone stepped up to help you, noone was motivated to do so. Some people already pointed out where you have to look for help. Stop with the Bitmap for a moment. Can you finish the rest of your assignment ? Do you have a specific question ? We aren't here to do homework for you. We will help you to learn C/C++ and we will help you to learn learning. The StretchBlt function will do what you want. Can you implement in pseudocode what you want your functions to do ?