Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Display images

Posted on 1998-07-07
3
174 Views
Last Modified: 2010-04-01
I have searched for some time to find a way to display Bitmap image files which are determined at run time and/or hardcoded file names, but all of the examples and discussions are Around-A-Bout or just plain evasive.

I did get close recently, but the image still did not become visible. I used the following code:

void CMainFrame::OnKraphicsSee()
{
CPaintDC  dc(this); //Display a default image
      //************* Load Bmp file
strcpy (filename, "D:\\Graphics\\Images\\GailGrp1.bmp");

  ptrdib = new CDib (filename); // load the file into a dib
  if (!ptrdib || !ptrdib->IsValid ())
  MessageBox("Invalid Bitmap File - Try Again", "Bitmap
  set up the dib size in a rectangle File Error", MB_OK);
  else {
   dibrect.left = dibrect.top = 0;
   dibrect.right = ptrdib->GetDibWidth();
   dibrect.bottom = ptrdib->GetDibHeight();
  }
  //***** Now that the file is loaded convert it and display
  if (ptrdib && ptrdib->IsValid ()) { // successful load?
      // finish conversion
    if (effecttype!=CM_NORMAL) ConvertToMemoryDC ();
             // still a success, finish up
          if (ptrdib->IsValid ()) {
                        // clear scroll position
                  current_vpel = 0;
                  current_hpel = 0;
                   // by adjusting the new scroller range
                  AdjustScroller ();
                   // insert filename into window title
                  UpdateCaption ();
              // force the image to be displayed
                        Invalidate();
                  MessageBox("Where is the Bitmap ?", "Bitmap Should be displayed", MB_OK);
  }
 }
      //************* End See if we can display a default image

 
   //************** End See
}

In a perfect world for me I would be able to create a dialog box and place controls on it to navigate through accessiable directories. I would be able to place the full path and image names into a listbox or just select the image names in a listbox and the image would be displayed.

I would like to place a Frame or Image control on my dialogbox and change the name of the image to be viewed as I wish.

Please help.......................
0
Comment
Question by:kraphics
3 Comments
 

Author Comment

by:kraphics
ID: 1167307
Edited text of question
0
 
LVL 2

Expert Comment

by:lucidity
ID: 1167308
where are you planning to display this image?

I can give code to display a background in a dialog and add bitmaps to buttons that will give a spiffy looking interface.

(DIBs not BMPs, but since its hardcoded it doesn't matter)
0
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 1167309
I would suggest you look into
http://www.codeguru.com/bitmap/bitmap_toc.shtml
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question