Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

How to load mutiple images into MDI??

Hi every body, thanks for see my topic.

My problem is =>
" I had an application to load multiple images/bitmap into MDI. For examples: I have 5 images, when i load them to my MDI(window) after that my application will generate 5 MDI(5 windows) that will contain 5 images(each window contain 1 image). "

 Please, help me!!I'm a newbabie :D
Thanks so much for send mail: tranducmille@gmail.com
0
lieunguyenhoa
Asked:
lieunguyenhoa
  • 4
  • 3
1 Solution
 
mahesh1402Commented:
so what you want to do ? want to load them all in one window or just load them in individual ?
0
 
lieunguyenhoaAuthor Commented:
' so what you want to do ? want to load them all in one window or just load them in individual ?

Hi Mahesh!
I want to load them all in one window, maybe it will be separated in each page.
Please, see my demo:
http://my.opera.com/tranducmille/homes/albums/52581/1untitled.JPG

Please, help me.
THanks so much
0
 
mahesh1402Commented:
Link is not opening.

Ok ..

>> want to load them all in one window,

well then you may use same code I have given you in my last post of your last question. .. You just need to BitBlt() on your WM_PAINT handler function. As this time you need to load multiple images that means you need multiple BitBlt().

>>maybe it will be separated in each page.

Dont know what do you mean by seperted in each page... You need to seperate by fixed distance or according to your print page.
You can change 'Y' in BitBlt() function to blit image in y dimensions.


MAHESH
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
lieunguyenhoaAuthor Commented:
Dear MAHESH !

>>As this time you need to load multiple images that means you need multiple BitBlt().

These images will be loaded from a file dialogbox, so that i can't used it with multiple BitBlt().

>>You need to seperate by fixed distance or according to your print page.

How to implement it ??

MAHESH, sorry about my VC++ language, i'm a beginner so i can't write hard codes.
Please help me!

I think link is opening and done well.
Thanks
0
 
mahesh1402Commented:
>>These images will be loaded from a file dialogbox, so that i can't used it with multiple BitBlt().

It seems you have not looked into code I have given you.. BitBlt() is used to load bitmap from BMP file only using LoadImage().

You just need following code on you WM_PAINT message handler (OnPaint).

void CMyDlg::OnPaint()
{                              
                                CPaintDC dc(this);
            HDC            hMemDC;
            HBITMAP oldBmp;
            BITMAP      bm;

                               //Just pass file name selected from File Dialog Box instead of  'c:\\test.bmp'
            hBmpThumb = (HBITMAP)LoadImage( NULL,"C:\\test.bmp", IMAGE_BITMAP, 0, 0,LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );

            hMemDC = CreateCompatibleDC( dc.GetSafeHdc());
            GetObject(m_hBmpThumb, sizeof(BITMAP), &bm );
            oldBmp = (HBITMAP)SelectObject( hMemDC, hBmpThumb );

            BitBlt( dc.GetSafeHdc(), 0, 0,bm.bmWidth ,bm.bmHeight, hMemDC, 0, 0, SRCCOPY );
            
            SelectObject( hMemDC, oldBmp );
            
            DeleteObject( oldBmp );
            DeleteObject( hMemDC );

            CDialog::OnPaint();
}

MAHESH
0
 
lieunguyenhoaAuthor Commented:
- Thanks for your answer, i done it.
and now:
 >> How could i calculate height/width of a page or an image. If "size of image" more than "size of page"=> cut part of left(image) and paste it into page 2.
How do it? THanks so much.
0
 
mahesh1402Commented:
size of page <== in what terms ? Printer Page ?

-MAHESH
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now