471,627 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

Graphics drawn in improper order...

(Due to absolutely no response in ms.pub.dotnet.general, I'm reposting
here...)

When I call the following function, the rectangle will overlap the
graphics that is drawn _afterwards_. Why is that? How can I make sure
my graphics is drawn in correct order?

(Note: If I comment the FillRectangle-line, the other graphics is drawn
correctly.)

private void PaintBox(Graphics g, Brush b, Pen p)
{
// The background rectangle...
g.FillRectangle(b, mBoxRectangle);

// The foreground graphics...
switch (mRegionInfo.Box)
{
case RegionInfo.BoxState.Empty:
break;
case RegionInfo.BoxState.Crossed:
g.DrawLine(p, ...);
g.DrawLine(p, ...);
break;
case RegionInfo.BoxState.Circled:
g.DrawEllipse(p, ...);
break;
}
}

Jan 16 '06 #1
2 1287
"matko" <ma*****@gmail.com> wrote in news:1137370918.847443.295990
@g49g2000cwa.googlegroups.com:
(Due to absolutely no response in ms.pub.dotnet.general, I'm reposting
here...)

When I call the following function, the rectangle will overlap the
graphics that is drawn _afterwards_. Why is that? How can I make sure
my graphics is drawn in correct order?


Well if you posted this message to the other newsgroup, I can understand
why you didn't get a response. There is nothing in your code that would
indicate WHY you are seeing the overlap, because you didn't include the
actual code. You just replace a bunch of stuff with "...". That makes it
very hard for us to help.

Please post a *SHORT*, *COMPLETE* program that demonstrates the effect you
are seeing so that we can compile it on OUR machines and see what you are
seeing.

-mdb
Jan 16 '06 #2
Oh, the replaced-with-"..."-bunch-of-stuff is just size and coordinate
information (which I knew would work). I actually never thought there
was a problem with the code itself (it's a simple piece of code), which
is why I didn't post more than that.

Well, I have solved the issue. Of course, the solution was very simple
(once I discovered the _actual_ problem) and the cause of the problem
was completely my crime... D'oh!
The error lied in the paint-event handler, not the PaintBox method.

Michael Bray wrote:
"matko" <ma*****@gmail.com> wrote in news:1137370918.847443.295990
@g49g2000cwa.googlegroups.com:
(Due to absolutely no response in ms.pub.dotnet.general, I'm reposting
here...)

When I call the following function, the rectangle will overlap the
graphics that is drawn _afterwards_. Why is that? How can I make sure
my graphics is drawn in correct order?


Well if you posted this message to the other newsgroup, I can understand
why you didn't get a response. There is nothing in your code that would
indicate WHY you are seeing the overlap, because you didn't include the
actual code. You just replace a bunch of stuff with "...". That makes it
very hard for us to help.

Please post a *SHORT*, *COMPLETE* program that demonstrates the effect you
are seeing so that we can compile it on OUR machines and see what you are
seeing.

-mdb


Jan 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Pudibund | last post: by
reply views Thread by matko | last post: by
reply views Thread by mrajanikrishna | last post: by
6 posts views Thread by Chris Dunaway | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.