Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 19-05-2010, 06:54 PM   #1 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Panel Control in C#


hello,
i have a panel.
i add label and a pictureBox using this :
Code:
private void AddLabelAndImage(ref Point startPoint, string labelText, System.Drawing.Image image)
        {
            Label label = new Label();
            panel1.Controls.Add(label);
            label.Text = labelText;
            label.Name = "text";
            label.Width = 100;
            label.Height = 30;
            label.Location = startPoint;
            startPoint.Y += label.Height;

            System.Windows.Forms.PictureBox box = new PictureBox();
            panel1.Controls.Add(box);
            box.Name = "image";
            box.Size = image.Size;
            box.Image = image;
            box.Location = startPoint;
            startPoint.Y += box.Height + 10;
what i want is to retrieve the picturebox control as System.Windows.Forms.PictureBox.
every function like find() returns Control[]

how to do this??
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 27-05-2010, 02:27 PM   #2 (permalink)
Always confused
 
vamsi360's Avatar
 
Join Date: May 2008
Location: Mandriva Control Center
Posts: 349
Default Re: Panel Control in C#

you have to returen the reference of the control i guess. I will try and tell you...
__________________
Vamsi Subhash
visit my blog at www.vamsisubhash.co.cc and taste a bit of IT!
vamsi360 is offline   Reply With Quote
Old 27-05-2010, 10:32 PM   #3 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Re: Panel Control in C#

^ do you mean ::

PictureBox p1= panel1[i] ????
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Old 08-06-2010, 04:08 AM   #4 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: Panel Control in C#

It's simple.

Cast the Control returned to PictureBox.
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline   Reply With Quote
Old 08-06-2010, 09:45 AM   #5 (permalink)
Fullbring
 
Zangetsu's Avatar
 
Join Date: Jan 2008
Location: Soul Society
Posts: 5,523
Default Re: Panel Control in C#

Quote:
Originally Posted by arpanmukherjee1 View Post
hello,
i have a panel.
i add label and a pictureBox using this :
Code:
private void AddLabelAndImage(ref Point startPoint, string labelText, System.Drawing.Image image)
        {
            Label label = new Label();
            panel1.Controls.Add(label);
            label.Text = labelText;
            label.Name = "text";
            label.Width = 100;
            label.Height = 30;
            label.Location = startPoint;
            startPoint.Y += label.Height;

            System.Windows.Forms.PictureBox box = new PictureBox();
            panel1.Controls.Add(box);
            box.Name = "image";
            box.Size = image.Size;
            box.Image = image;
            box.Location = startPoint;
            startPoint.Y += box.Height + 10;
what i want is to retrieve the picturebox control as System.Windows.Forms.PictureBox.
every function like find() returns Control[]

how to do this??
u r using a subroutine.....& adding label & picturebox in panel.....
but i didnt get ur question...u want to get the picturebox then u can use
panel.findcontrol() method......
__________________
I'm the One you've been Waiting for...
Zangetsu is offline   Reply With Quote
Old 09-06-2010, 12:16 AM   #6 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Re: Panel Control in C#

it's done. it returned PictureBox type .

thanks 2 u all 4 ur efforts...............
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SamSung 226BW Review rajesh201985 QnA (read only) 7 19-10-2007 02:58 PM
How To HIDE applets from the Control Panel. anandk Tutorials 7 11-02-2007 05:41 PM
How to use flashget in opera 8 Gaurav Software Q&A 6 22-10-2005 11:19 PM
Use "Windows" your own way ! rajkumar_personal Software Q&A 6 26-02-2005 11:40 PM
Lost Control over Control Panel! lamrinnirmal QnA (read only) 5 16-11-2004 08:35 PM

 
Latest Threads
- by Charan
- by Charan
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 03:18 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2