Tuesday, July 10, 2007

Gotcha: C# Windows.Forms Madness

So, if you are ever creating dynamic forms in C#, and things aren't showing up for some reason, and you sillily left one non-dynamic thing there, just to be sure that you're not loosing the whole container, check that the dynamic stuff isn't being created underneath other things. For some reason, I expect them to show up over older stuff, but apparently I'm wrong. (I.E. set form.Location = new System.Drawing.Point( [not 0], [also not 0]); )

[Spell check doesn't think that sillily is a word. Pssht.]

2 comments:

Anonymous said...

You should consider including more details! I would like to learn more about the scenario you are working in.

Linden said...

Sorry, you're right that it wasn't very clear. I was dynamically creating a row of images. The image and number of images changed based on context, so I needed to lay them out at run time.
What happened was that I left one image non-dynamic, IE hardcoded in, and all my dynamic images were being created, but at (0,0) underneath the non-dynamic image, so I couldn't see them, and I assumed they were not being created.