Passing a PictureBox to a method in a class

I am trying to find information about transferring an image to a method, I tried to pass it with an object, but to no avail.

Can someone point me in the right direction to explore the answer myself, I have tried many searches, but I am not sure that the correct wording will be used when searching for such an answer.

I create a class that manipulates the field of the image that was passed to it.

public class picBoxStuff
{
    public void doStuff(Object pictureBox)
    {
        pictureBox.dooooostufff....
    }
}

Thanks, please, in advance,

EDIT:

Thanks guys, Unfortuanlty, I can’t vote for you as answers, and both of you are fantastic, Add a note to add to what you both mentioned for people who are looking for this in the future.

system.windows.forms, .net-. " System.Windows.Forms;". , , pictureBox .

, refrence windows.forms:)

,

+3
2

PictureBox - , , PictureBox Object. , PictureBox, Object, , .

using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            someMethod(pictureBox1);
        }

        private void someMethod(PictureBox p)
        {
            p.BackColor = Color.Blue;
            // this is an example of pictureBox being passed as 
            // a paramter to this method
        }
    }
}

enter image description here

+3

, ?

using System.Windows.Forms;

//rest of your code
+1

All Articles