CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    4

    Exclamation Rotate an image: where is the bug in my code?

    Yes, I know, the code is F#, but it's pretty similar to C#, so I hope you can find where is the problem!! I'm trying to rotate an image, but nothing happens. Can anyone tell me why?

    openMenuItem.Click.Add(fun _ ->
    let dialog = new OpenFileDialog()
    if dialog.ShowDialog()= DialogResult.OK then

    //Turn image
    let mutable myBitmap = new Bitmap(dialog.FileName)
    let mutable emptyBitmap = new Bitmap(myBitmap.Width, myBitmap.Height)
    let mutable myBitmap1 = Graphics.FromImage(emptyBitmap)

    myBitmap1.TranslateTransform((float32)(myBitmap.Width / 2), (float32)(myBitmap.Height / 2))
    myBitmap1.RotateTransform((float32)30)
    myBitmap1.TranslateTransform(-(float32)(myBitmap.Width / 2), -(float32)(myBitmap.Height / 2))

    myBitmap1.DrawImage(myBitmap, 500,500)
    Last edited by ceres83; August 6th, 2011 at 10:27 AM.

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Rotate an image: where is the bug in my code?

    the code is F#, but it's pretty similar to C#
    CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming
    Welcome to the C++ section. C# is this way.

Tags for this Thread

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

Featured