> Whatever gets printed, I assume, stays printed unless erased...
> What would be a good way to _erase_ whatever number may
> already be written in a square at a particular location?
You should code your Canvas.Paint event to draw over the entirety of
its Graphics parameter every time. Filling the entire Graphics
rectangle with white (using FillRect) is a common way to start a Paint
event. Or you could do FillRect for each square, if you happen to know
that they perfectly fill the Canvas (which I would imagine they do in
Sudoku, though you will have to pay attention to rounding effects at
the right and bottom edges of the Canvas).
It sounds like you might be laboring under the common misconception
that Canvas renders its image to some kind of persistent object that
is remembered and re-used as needed. That is not the case; whenever
part of your canvas needs to be drawn (as a result of opening the
window, resizing it, uncovering it, etc.), your Paint event will get
called, and there is no valid assumption it can make about what was
previously on that part of the screen. Each invocation of your Paint
event must stand alone.
Now, you might say "But Lars, that will be inefficient if only part of
the Canvas needs to be drawn!" And you would be right. But machines
are fast nowadays; you'll probably never notice a delay -- and if you
do, we'll help you get rid of it.
(BTW, I'm not sure what you mean by "basic" Sudoku analysis, but from
what little I've read, you might find that the UI is the easy part
after all...not that that should stop you!)
lj
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|