Click here to Skip to main content
15,884,991 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a winform on which I have tab control and I'm adding a picture box control to the tab page. I want to load an image to this picturebox control in the tab page. I'm adding the control to tab page is as follows:

C#
m_Canvas = new PhotoCanvas();
// initializing the picture box control
m_Canvas.BackColor = Color.White;
m_Canvas.Width = 500;
m_Canvas.Height = 400;
m_Canvas.Left = 0;
m_Canvas.Top = 0;
this.MainTab.TabPages[0].Controls.Add(m_Canvas);
//adding the picture box control to tabpage


I have tried to load the image using

C#
if (m_OpenFileDialog.ShowDialog() == DialogResult.OK)
 {
     m_Canvas.Image = new Bitmap(m_OpenFileDialog.FileName);

 }


but it's not working means the image is not loading please help.Thanks in advance
Posted
Updated 27-Mar-13 2:32am
v5
Comments
[no name] 27-Mar-13 8:28am    
"it's not working" is not at all a helpful description of any kind of a problem. Do you call up your mechanic and and tell him "car broke" and expect he knows exactly what is wrong with your car?
Sreeju padmanabhan 27-Mar-13 8:31am    
sorry :) it's not showing the image or the image is not loading to the picture box
Sreeju padmanabhan 27-Mar-13 9:16am    
How can i access the pictureBox inside a tabpage of any tab control??
Sergey Alexandrovich Kryukov 27-Mar-13 10:05am    
What is PhotoCanvas? The question was about a picture box, and this is a different type. Did you test it? Does it work at all?
First of all, show the code which compiles.

m_Canvas = new PhotoCanvas(); // will not compile
—SA
Sreeju padmanabhan 27-Mar-13 11:14am    
Photo canvas is a class which is inherited from PictureBox.Here i'm using PhotoCanvas as same as a paint page on which i'm able to draw shapes like rectangle,ellipse ... .Now my task is to load an image in to the picturebox control (photocanvas).Hope you can help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900