I'm creating a function that allow a user to save a WindowsForm as a bitmap picture, But it seems like the saved picture haven't the same size as my initial form depending on the resolution of the screen.
Here is the 2 pictures :
The real windows form :
The picture saved as a bitmap :
I'm using this command to create the bitmap file :
Dim f As New tmp()
Dim createControl = f.GetType().GetMethod("CreateControl", _
BindingFlags.Instance Or BindingFlags.NonPublic)
createControl.Invoke(f, New Object() {True})
Dim bm As New Bitmap(f.Width, f.Height)
f.DrawToBitmap(bm, New Rectangle(0, 0, bm.Width, bm.Height))
bm.Save(Directory.GetCurrentDirectory + "\temp.bmp")
Note that, I want to preserve the quality of the initial windowsform, that's why, i'm trying to have the biggest form as possible.