473,385 Members | 1,901 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,385 software developers and data experts.

Paint Event - Wrong X and Y...

Hello,
I have a problem in C# programming.
I'm using paint event to draw something with graphics, but sometimes,
it draws it in a wrong place - like he think that the form starts in
minus, he draws it a little to the left, and up.
Dose someone knows why this happens? It always does after some paint
events.
If someone knows how to fix it, please write down, but why it happens
will be just fine if not.
Please help,
Ofir

May 16 '07 #1
2 1354
"ofiras" <of****@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
Hello,
I have a problem in C# programming.
I'm using paint event to draw something with graphics, but sometimes,
it draws it in a wrong place - like he think that the form starts in
minus, he draws it a little to the left, and up.
Dose someone knows why this happens? It always does after some paint
events.
If someone knows how to fix it, please write down, but why it happens
will be just fine if not.
Possibly the paint event has set some property on the graphics object. Try
e.graphics.ResetTransform. I think there is a draw origin property or
something also (on brushes??). Just search around for a changed property on
the graphics object.

Michael
May 16 '07 #2
On Wed, 16 May 2007 05:17:59 -0700, ofiras <of****@gmail.comwrote:
I'm using paint event to draw something with graphics, but sometimes,
it draws it in a wrong place - like he think that the form starts in
minus, he draws it a little to the left, and up.
Dose someone knows why this happens? It always does after some paint
events.
Without a concise (that is, short, brief, etc) example of code that
reliably reproduces the problem you're having, it would be impossible to
say why what you're seeing is happening.

Suffice to say, you're correct to assume it shouldn't happen. You've got
a bug somewhere in your code, or possibly in some third-party code that
you're using (if any). But without seeing the code, it's hard to say what
it might be.

Note that often in the process of putting together a suitable sample, you
will discover the bug that is causing the problem. That is, to create a
concise sample you have to remove a bunch of stuff from your actual code,
trimming to the bare essentials to get the bug to happen. When you do
this, often you'll find the problem goes away, and you have to start
adding things back in a little at a time to get it to come back.

Once you get to the point where you've just added a little more and the
bug came back, that's usually a pretty good pointer in the direction of
what is causing your bug. You may be able to fix it yourself, simply
through the exercise of preparing a sample for us to look at. :)

Pete
May 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tamir Khason | last post by:
How I can paint something onClick event? I need PaintEventArgs event in order to paint and raise Graphics, but onClick I have only EventArgs Event... Thanx
4
by: Tamir Khason | last post by:
Why when I lost focus (go to back) on form all GDI+ paints disappears..... BUG or I do something wrong???? TNX
2
by: Rene | last post by:
Currently, the paint even will only acknowledge painting going on inside of the ClipRectangle, any of the drawing that is outside of the ClipRectangle is ignored. How can I get the paint...
8
by: WStoreyII | last post by:
i am using this code to try to paint a line on my form and it wont work i get an object not set to a reference error Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red) Dim...
6
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it...
7
by: hamil | last post by:
The following code will display a tif file on a form. When another form is moved over the tif image, the tif image is erased where the form was moved. A paint event occurs when this happens. My...
4
by: Kürşat | last post by:
Hi all, I do some drawing in a form's paint event handler and I have a button on that form. Whenever the mouse enters or leaves the button Form's paint event occurs. Isn't that a strange...
7
by: Rotsey | last post by:
Hi, I have a interface that I use for a form so I can pass the form to another object. How do I add the Paint event to the interface and subsequently handle the paint event in my other...
5
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, On a usercontrol I've put a set of radiobuttons within a groupbox. These radiobuttons have visual style enables, i.e. they turn orange when hovering over them and green when pushed. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.