Results 1 to 10 of 10

Thread: [RESOLVED] Image Flickering.

Hybrid View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2008
    Posts
    204

    Re: Image Flickering.

    Thanks Mr.Boops Boops. Instead of creating Graphics object, I used e.Graphics and I think my flickering problem is solved. But now I am facing an another problem because of it.

    Earlier I was rotating the whole graphics i.e. the four rectangles using GraphicsPath RotateTransform.RotateAt method to specify the rotation point.

    But now with e.graphics I am not able to specify the point to rotate at. The code I used earlier is pasted below. Please go through it and let me know how to rotate e.graphics by specifying the rotateAt point
    Code:
    Dim RotationTransform As New Matrix(1, 0, 0, 1, 0, 0) ' rotation matrix
    Dim TranslationTransform As New Matrix(1, 0, 0, 1, 0, 0) ' translation matrix
    
    Dim RotationTransform As New Matrix(1, 0, 0, 1, 0, 0) ' rotation matrix
    Dim TranslationTransform As New Matrix(1, 0, 0, 1, 0, 0) ' translation matrix
    
    RotationTransform.RotateAt(NumericUpDown1.Value, New PointF(512, 512)) 'Convert Direction to degrees
    gp.Transform(RotationTransform)

  2. #2
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: Image Flickering.

    You can use Matrix.RotateAt to rotate the Graphics in the Paint event like this:

    Code:
    	Dim mtx As New Matrix
    	mtx.RotateAt(NumericUpDown1.Value, New Point(x, y))
    	e.Graphics.Transform = mtx 
    	'paint rotated stuff here
    That way you don't need RotateTransform or TranslateTransform to do the rotation (let alone twice). If you want to rotate the graphics dynamically, don't forget to Invalidate the PictureBox in the NumericUpDown.ValueChanged event. By the way, you don't need to specify (1, 0, 0, 1, 0, 0) in the New Matrix code because those are the default values anyway.

    BB

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2008
    Posts
    204

    Resolved Re: Image Flickering.

    Thanks Mr.Boops Boops. That worked exactly the way I wanted. I think the problem is now solved. Thanks for the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width