Status
Not open for further replies.

un

Broken In
Joined
Aug 4, 2004
Messages
43
How can I make MDI to open graphics images in vc++?

Edit: [enoonmai] Edited to make it more readable.
 

enoonmai

Cyborg Agent
Joined
Oct 8, 2004
Messages
1,296
First of all, we can read perfectly normal font. There's no need to use size 18 bold red font. :D

Use the FileOpenDialog class this way:
OpenFileDialog *opfdlg=new OpenFileDialog ();
opfdlg->Filter="JPEG files (*.jpg;*.jpeg)|*.jpg;*.jpeg";
opfdlg->ShowDialog()


To show the image, use:
String *s=opfdlg->FileName;
m_bitmap=new Bitmap(s);
Invalidate();


Use the OnPaint handler this way:
Graphics *g=e->Graphics;
g->DrawImage(m_bitmap,this->AutoScrollPosition.X, this->AutoScrollPosition.Y, m_bitmap->Width,m_bitmap->Height);


That's it. You're done.
 
OP
U

un

Broken In
Joined
Aug 4, 2004
Messages
43
I had been using OnFileopen(), But you have mentioned OpenFileDialog how should I use that class?[/b]
 
Status
Not open for further replies.
Top