Paint Event - Wrong X and Y...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ofiras

    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

  • Michael C

    #2
    Re: Paint Event - Wrong X and Y...

    "ofiras" <ofiasu@gmail.c omwrote in message
    news:1179317879 .042304.292020@ e65g2000hsc.goo glegroups.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.Rese tTransform. 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


    Comment

    • Peter Duniho

      #3
      Re: Paint Event - Wrong X and Y...

      On Wed, 16 May 2007 05:17:59 -0700, ofiras <ofiasu@gmail.c omwrote:
      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

      Comment

      Working...