CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Using 2D Array - Displaying Bitmap Image with Scrolling

    Hi,

    My requirement is,

    Read *.bmp image and displaying bitmap image with scrollbar in a MFC dialog application.
    I was done using this

    I was read the *.bmp image as a pixel data and stored by 2D Array,

    Now i want to Display this 2D array as bitmap image with scrollbar separately in the same dialog. How can i display bitmap with scrollbar using 2D array?

    Pls clear me.
    Regards,

    SaraswathiSrinath

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by saraswathisrinath View Post
    I was read the *.bmp image as a pixel data and stored by 2D Array,

    Now i want to Display this 2D array as bitmap image
    This is really bad idea. All you need is using LoadImage.
    Best regards,
    Igor

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by saraswathisrinath View Post
    Now i want to Display this 2D array as bitmap image with scrollbar separately in the same dialog. How can i display bitmap with scrollbar using 2D array?
    As Igor already mentioned "read the *.bmp image as a pixel data and stored by 2D Array" is not a good idea.
    And how to display a bitmap you could learn from this J.Newcomer's essay.
    Victor Nijegorodov

  4. #4
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by Igor Vartanov View Post
    This is really bad idea.
    My dialog size is 1024*768.
    I want to display BMP image using stored *.bmp image or *.csv file from opendialog file path.
    Using this image i prepared 2D array for further algorithm process and display the algorithm processed image also in the same dialog.

    If my BMP image size is 1024*500, then i did not load both images(Real & Processed Image).

    For this purpose only, i asked to display Scrollable bitmap images from various input(*.bmp/*.csv)
    Regards,

    SaraswathiSrinath

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by saraswathisrinath View Post
    My dialog size is 1024*768.
    I want to display BMP image using stored *.bmp image or *.csv file from opendialog file path.
    Whatever. In case you to operate with several graphical representations of anything you want, you better deal with those via GDI/GDI+ instead of home-bred solutions.

    Anyway, you always can go your 2D-array way. Based on the data you have you just create DIB bitmap each time your dataset changes.
    Best regards,
    Igor

  6. #6
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by Igor Vartanov View Post
    Whatever. In case you to operate with several graphical representations of anything you want, you better deal with those via GDI/GDI+ instead of home-bred solutions.

    Anyway, you always can go your 2D-array way. Based on the data you have you just create DIB bitmap each time your dataset changes.
    I am new in visual programming . Just concentrate on the Image processing related topics for my project. I'm not well in visual programming, Although in GDI. I'm referring few concept which i was using in my project. because of the project schedule time.

    I'm studying Visual C++ by Google only, reading some Microsoft VC++ pages or any other paragraph, very difficult to understand by me. If i execute any simple examples, it makes me to clear the concept rather than read the theory/ code hint.

    Is possible, pls refer any MFC Dialog based example for me?
    Regards,

    SaraswathiSrinath

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by saraswathisrinath View Post
    Is possible, pls refer any MFC Dialog based example for me?
    I already provided the link in the post#3.
    Victor Nijegorodov

  8. #8
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Yes Mr.Victor. I started to read. Thanks.
    If i have any doubt, i will come back
    Regards,

    SaraswathiSrinath

  9. #9
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by saraswathisrinath
    I was done using this
    Quote Originally Posted by saraswathisrinath View Post
    Is possible, pls refer any MFC Dialog based example for me?
    What's wrong with the project you've been starting with? This is exactly an MFC Dialog based sample. The code loads image from resources while you need to load bitmaps from file. In both cases LoadImage is perfectly fine, you just need a little tweak to make it working. So, don't hesitate and go forward.

    Quote Originally Posted by saraswathisrinath
    I'm not well in visual programming, Although in GDI ... I'm studying Visual C++ by Google only, reading some Microsoft VC++ pages or any other paragraph, very difficult to understand by me.
    Well, you either solve this your education issue or not. The way you educate yourself is absolutely up to you, but this forum is for communication on concrete technical issues, and not about teaching anybody. Please come up with some code and related issues, and people here will be glad to help you.
    Best regards,
    Igor

  10. #10
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by Igor Vartanov View Post
    but this forum is for communication on concrete technical issues, and not about teaching anybody. Please come up with some code and related issues, and people here will be glad to help you.
    Displaying Bitmap Images with Scrolling this example teach me how to load a bitmap in to the dialog box during run-time?

    I have a 2D array. In that example they define a bitmap (m_hBmpNew). I don't know, how to replace my 2D array instead of bitmap file name.

    Code:
    m_hBmpNew = (HBITMAP) LoadImage(
    AfxGetInstanceHandle(), // handle to instance
    filename, // name or identifier of the image,
    // say, "C:\\NewFolder\\1.bmp"
    IMAGE_BITMAP, // image types
    0, // desired width
    0, // desired height
    LR_LOADFROMFILE);
    Regards,

    SaraswathiSrinath

  11. #11
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Using 2D Array - Displaying Bitmap Image with Scrolling

    Quote Originally Posted by saraswathisrinath View Post
    Displaying Bitmap Images with Scrolling this example teach me how to load a bitmap in to the dialog box during run-time?

    I have a 2D array. In that example they define a bitmap (m_hBmpNew). I don't know, how to replace my 2D array instead of bitmap file name.
    At the first step get rid of your 2D array and use .bmp file instead. Try to understand how this code works.
    At the next step you can then try to work with the 2D array as Igor mentioned in the post#5.
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured