Working with custom controls

Posted on 2004-11-12
Last Modified: 2010-04-15
I'm quite new to C#, so here is my probelm...

I have created a custom control that holds PictureBox (thumbnail) and Label control (image name).
In program I walk through directory for images and for each image i put my custom control on panel. By default custom control shows special icon instead of a thumbnail.

When all placeholders are set, I create a thread that process images in background  and when thumbnail created, change default icon with thumbnail.

If I change default icon with thumbnail "manually" like this..
MyControl1.pictureBox1.Image = new Bitmap(_image, width, height);

Problem arise when i create controls programaticaly. How do I find out "pointer/reference" to control?

for (int i = 0; i < this.my_panel.Controls.Count; i++)
... image processing...

?????????????.pictureBox1.Image = new Bitmap(_image, width, height);


Any ideas?
Question by:gruntar
    LVL 8

    Accepted Solution

    Hi gruntar,
    > for (int i = 0; i < this.my_panel.Controls.Count; i++)
    > {
    > ... image processing...
    (my_panel.Controls[i] as MyControl).pictureBox1.Image = new Bitmap(_image, width, height);
    > }

    LVL 9

    Author Comment

    That was easy one. What was I thinking :D

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now