Newbie question : Form and Classes interaction

P

pat.saunders

Hi,
I am using Visual Studio 2005 and am using Visual C#. I notice
that the program.cs creates an instance of a form and runs it. I have
a PictureBox in the form and a Class File x.cs and in the Class file
x.cs want to access some of the picturebox parameters e.g size but I
do not have access to these parameters. I could write a function in
form.cs to return these parameters but as I don't have access to an
instance of form I cannot call the function . How do I get around this
problem. I know I could pass the PictureBox as a parameter from the
form to the Class but I would like to know how classes interact with
the Form ??
 
I

Ignacio Machin ( .NET/ C# MVP )

Hi,
        I am using Visual Studio 2005 and am using Visual C#. I notice
that the program.cs creates an instance of a form and runs it. I have
a PictureBox in the form and a Class File x.cs and in the Class file
x.cs want to access some of the picturebox parameters e.g size but I
do not have access to these parameters. I could write a function in
form.cs to return these parameters but as I don't have access to an
instance of form I cannot call the function . How do I get around this
problem. I know I could pass the PictureBox as a parameter from the
form to the Class but I would like to know how classes interact with
the Form ??

Hi,

I do not completely understand what you want, but you can pass a
parameter of type PictureBox to the class from the form
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top