I'm having trouble getting what I draw to a graphics object on a picturebox to appear like it should. Currently the form opens and everything appears rightly laid out but the Clear() method and any drawing methods afterwards don't seem to be producing any response.
The picture boxes just remain the same grey colour as the window that contains them.

My understanding of some OOP concepts are still solidifying at the moment so I have a suspicion it's something to do with how I've used a thread or a misunderstanding on how exactly the visual studio desiigner puts together things for me. I think anyhoo.

This is the MainWindow class of my code, hope it's not too much code to have to sift through but I'm not sure which parts are responsible:

Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;

I've tried to comment the parts that actually use the graphics to be noticeable, hope that makes it a bit easier to notice. Any help would be appreciated. Sorry if it's a really stupid fix too, if you haven't already noticed I'm still learning so your patience will be appreciated. =]

07-31-2009

valaris

You usually don't draw to a picturebox through a DC, but just supply it a bitmap as it does a lot of special optimizations to help you out. Also do you set a breakpoint in the if (Pile.pile[i, j] != null) block? Do you actually get here? The reason I ask is I see you set every pile to null, and never set it to anything else. So unless you are not showing all the code, nothing will be drawn.

07-31-2009

ThePermster

What's a DC? Pardon my ignorance, like I said I'm fairly new to this and this is my first somewhat large endeavour.

I managed to fix my problem though just by adding a call to Clear() in the paint() method but my question wasn't very clear anyhoo given the nature of the code segment. In future I shan't post whilst tired. x]
Thanks for the help anyhoo though.