none
paint/graphics on windows forms RRS feed

  • Frage

  • Dear programmers,

    I made an application that displays a background bitmap on a windows form. When I click on any position of the bitmap a circle appears.

    This is the main code:

    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    Dim bild As New Bitmap("w:\test.bmp")
    Dim feld As New Rectangle(0, 0, 800, 600)
    e.Graphics.DrawImage(bild, feld, feld, GraphicsUnit.Pixel)

    e.Graphics.DrawEllipse(Pens.Aqua, New Rectangle(x, y, 20, 20))

    invalidate() is used to update the graphics on the form

    However, I find it annoying that the bitmap flashes whenever the position of the circle is updated.
    Obviously the bitmap is loaded every time I click the mouse.
    Is there a way to avoid this flashing?

    Thanks for your answers!

    Yours,
    Wolfgang Weirich
    • Verschoben Mathias Schiffer Montag, 30. März 2009 21:51 Die englischsprachigen Foren sind zu erreichen unter http://social.msdn.microsoft.com/Forums/en-us/categories
    Montag, 30. März 2009 21:22

Antworten

Alle Antworten