473,411 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 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 1331
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pudibund | last post by:
Ok, I've spent nearly a week trying to sort what should be an easy task to accomplish but I'm totally flumoxed! I want to do something pretty simple... 1. display image1 2. wait until...
3
by: pacemkr | last post by:
Is it possible to force a control to paint to a Graphics object (or Device Context, or a bitmap, anywhere aside from the form) that I provide. I am writing a windows form class that supports...
0
by: matko | last post by:
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...
6
by: Paul_Madden | last post by:
I have a System.Windows.Forms.Form onto which I add a Panel (MyPanel) directly derived from System.Windows.Forms.Panel. Here are the important code fragments ... public class MyPanel : Panel...
0
by: mrajanikrishna | last post by:
Hello, I have generated an image(T-Shirt). It was drawn using lines, curves. After that I filled with color(gr.fillpath(greenBrush,graphicsPath)). I used blackPen to draw lines and curves with...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
4
debasisdas
by: debasisdas | last post by:
This article contains the basic syntax to draw graphics of various shapes and sizes in Visual Basic 6.0. Different types of geometrical shapes (rectangle, square, circle, arc, ellipse etc.) can be...
9
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has...
8
by: Abhiraj Chauhan | last post by:
I need someone to make an example of how to create a graphics window in VB.net 2008. I understand the basics of how to draw a rectangle and lines etc. What I need is an example of how to make a...
10
by: eddie tan | last post by:
Hi, I have a picturebox with graphics drawn from different objects. In one object I used Pen P1; P1 = new Pen(Color.Blue, 3); Graphics g = null; g = Graphics.FromImage(image.Image);...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.