Click here to Skip to main content
15,900,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: diff between C++ and VC++ Pin
_AnsHUMAN_ 26-Sep-06 3:09
_AnsHUMAN_ 26-Sep-06 3:09 
GeneralRe: diff between C++ and VC++ Pin
Prakash Nadar26-Sep-06 3:56
Prakash Nadar26-Sep-06 3:56 
GeneralRe: diff between C++ and VC++ Pin
_AnsHUMAN_ 26-Sep-06 3:59
_AnsHUMAN_ 26-Sep-06 3:59 
GeneralRe: diff between C++ and VC++ Pin
Prakash Nadar26-Sep-06 4:05
Prakash Nadar26-Sep-06 4:05 
AnswerRe: diff between C++ and VC++ Pin
Hamid_RT26-Sep-06 3:18
Hamid_RT26-Sep-06 3:18 
AnswerRe: diff between C++ and VC++ Pin
Mr.Brainley26-Sep-06 3:20
Mr.Brainley26-Sep-06 3:20 
GeneralRe: diff between C++ and VC++ Pin
Zac Howland26-Sep-06 3:35
Zac Howland26-Sep-06 3:35 
QuestionBitmap showing problem Pin
helpcode26-Sep-06 2:39
helpcode26-Sep-06 2:39 
i am doing an application where i need to load a bitmap from a file like C:\MyFolder where my bitmaps are stored. i don't want use bitmap as resource to add bitmaps to my application. Now the problem is when i run the application using LoadImage() function it is showing my bitmap in scratched or crushed format(bad format). i want to show it as it is i.e. in actual size. i have attached the code snippet i m using. please help me immediately.
thanks to everyone..






void CPictureBox::ShowBitmap(CPaintDC *pdc)
{
//Create a device context to load the bitmap into
CDC dcMem; dcMem.CreateCompatibleDC(pdc);

//Get the Display area available
CRect lRect;
GetClientRect(lRect);
lRect.NormalizeRect();

//select the bitmap into compatible device context
CBitmap* pOldBitmap = (CBitmap*)dcMem.SelectObject(&m_bmpBitmap);
//m_bmpBitmap.SetBitmapDimension(lRect.Width(),lRect.Height());
//copy & resize the window to the dialog window
int bmw, bmh ;
m_bmpBitmap.GetBitmap(&bm);
bmw = bm.bmWidth;
bmh = bm.bmHeight;
int xo=0, yo=0;
pdc->BitBlt (xo, yo, lRect.Width(),
lRect.Height(), &dcMem,
0, 0, SRCCOPY);
pdc->StretchBlt(0,0,lRect.Width(),lRect.Height(),&dcMem,0,0,bmw,bmh,SRCCOPY);
dcMem.SelectObject(pOldBitmap);
}
void CPictureBox::OnPaint()
{
CPaintDC dc(this);
// device context for painting
RECT rect;
GetClientRect(&rect);
dc.FillSolidRect(&rect, RGB(255,255,255));
if(m_sBitmap!="")
ShowBitmap(&dc);
}
void CPictureBox::SetBitmap(CString strBitmap)
{
m_sBitmap = strBitmap;
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
m_sBitmap, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION );
// Do we have a valid handle for the loaded image?
if (hBitmap)
{
// Delete the current bitmap
if (m_bmpBitmap.DeleteObject())
m_bmpBitmap.Detach(); // If there was a bitmap, detach it
// Attach the currently loaded bitmap to the bitmap object
m_bmpBitmap.Attach(hBitmap);
}
m_bmpBitmap.GetBitmap(&bm); //Get Bitmap Structure
Invalidate();

jIteen
AnswerRe: Bitmap showing problem Pin
Hamid_RT26-Sep-06 3:30
Hamid_RT26-Sep-06 3:30 
AnswerRe: Bitmap showing problem Pin
PJ Arends26-Sep-06 9:03
professionalPJ Arends26-Sep-06 9:03 
GeneralRe: Bitmap showing problem Pin
Hamid_RT27-Sep-06 7:35
Hamid_RT27-Sep-06 7:35 
AnswerRe: Bitmap showing problem Pin
nutkase28-Sep-06 18:52
nutkase28-Sep-06 18:52 
GeneralRe: Bitmap showing problem Pin
helpcode20-Dec-06 0:46
helpcode20-Dec-06 0:46 
QuestionCtreeCtrl - override the basic expand and collapse on double click Pin
partho526-Sep-06 2:12
partho526-Sep-06 2:12 
AnswerRe: CtreeCtrl - override the basic expand and collapse on double click Pin
_AnsHUMAN_ 26-Sep-06 2:36
_AnsHUMAN_ 26-Sep-06 2:36 
GeneralRe: CtreeCtrl - override the basic expand and collapse on double click Pin
partho526-Sep-06 3:17
partho526-Sep-06 3:17 
QuestionCan't maxthon/myie load BHO automatically? Pin
daheitou26-Sep-06 1:40
daheitou26-Sep-06 1:40 
QuestionC++ is 100% Object Oriented Pin
Anilkumar K V26-Sep-06 1:34
Anilkumar K V26-Sep-06 1:34 
AnswerRe: C++ is 100% Object Oriented Pin
toxcct26-Sep-06 1:41
toxcct26-Sep-06 1:41 
AnswerRe: C++ is 100% Object Oriented Pin
Waldermort26-Sep-06 1:54
Waldermort26-Sep-06 1:54 
GeneralRe: C++ is 100% Object Oriented Pin
Cedric Moonen26-Sep-06 1:59
Cedric Moonen26-Sep-06 1:59 
AnswerRe: C++ is 100% Object Oriented Pin
_AnsHUMAN_ 26-Sep-06 2:29
_AnsHUMAN_ 26-Sep-06 2:29 
GeneralRe: C++ is 100% Object Oriented Pin
Mr.Brainley26-Sep-06 3:05
Mr.Brainley26-Sep-06 3:05 
GeneralRe: C++ is 100% Object Oriented Pin
_AnsHUMAN_ 26-Sep-06 3:12
_AnsHUMAN_ 26-Sep-06 3:12 
GeneralRe: C++ is 100% Object Oriented Pin
benjymous26-Sep-06 3:30
benjymous26-Sep-06 3:30 

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.