Click here to Skip to main content
13,199,311 members (59,445 online)

Size of docked picturebox inside a table cell, c#

Coffee Monster asked:

Open original thread
Help a newbie out! I'm just a hobby programmer, so bear with me.

I have a table of docked pictureboxes where I'm trying to scale the photos inside them relative to the size of the pictureboxes. So, for instance, if I maximize the window the photos will also resize. I know picturebox has properties for automatic scaling, but I'm doing other things here that would make that counterproductive. So I need to find a way to code it. Fun fun!

The problem is that I can't get the size of the pictureboxes. I think this is probably because they're docked to fill the table cell. So, I need to find another way to access their dimensions if one exists.

Also, to make things even harder on myself, I've placed this function in another class file. What I've passed to the function is the picturebox handle. I know this gives me access to it's properties, but I have a suspicion that I'll have to somehow access the parent cell's properties. Then again, those auto-size, too.. smh

Thanks, guys!
Tags: C#, Visual-Studio (VS2008)


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy |
Web02 | 2.8.171020.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100