Public class centerpictureclass centerpicture
Inherits system. Windows. Forms. usercontrol
Code generated by Windows Form Designer # region "code generated by Windows Form Designer"
Public sub new ()
Mybase. New ()
'The call is required by the Windows Form Designer.
Initializecomponent ()
'Add any initialization after initializecomponent () is called.
End sub
'Usercontrol override dispose to clear the component list.
Protected overloads overrides sub dispose () sub dispose (byval disposing as Boolean)
If disposing then
If not (components is nothing) then
Components. Dispose ()
End if
End if
Mybase. Dispose (disposing)
End sub
'Windows forms designer required
Private components as system. componentmodel. icontainer
'Note: The following procedure is required by the Windows Forms designer
'You can use the Windows Form Designer to modify this process.
'Do not use the code editor to modify it.
<System. Diagnostics. debuggerstepthrough ()> private sub initializecomponent ()
'
'Centerpicture
'
Me. Name = "centerpicture"
Me. size = new system. Drawing. Size (272,192)
End sub
# End Region
Private m_mapimage as image
Public property image () Property image () as image
Get
Return m_mapimage
End get
Set (byval value as image)
M_mapimage = Value
Me. invalidate ()
End set
End Property
Dim m_basepoint as pointf
Dim m_size as sizef
Dim m_scale as double
Private sub usercontrol+paint () sub usercontrol+paint (byval sender as object, byval e as system. Windows. Forms. painteventargs) handles mybase. Paint
If not (m_mapimage is nothing) then
Dim mapscale as double = m_mapimage.size.height/m_mapimage.size.width
Dim myscale as double = me. Size. Height/ME. Size. Width
If mapscale> myscale then
M_basepoint = new pointf (csng (Me. Size. Width-Me. Size. Height/mapscale)/2), 0)
M_size = new sizef (csng (Me. Size. Height/mapscale), csng (Me. Size. Height ))
M_scale = csng (Me. Size. Height/m_mapimage.size.height)
Else
M_basepoint = new pointf (0, csng (Me. Size. Height-Me. Size. Width * mapscale)/2 ))
M_size = new sizef (csng (Me. width), csng (Me. Size. Width * mapscale ))
M_scale = csng (Me. Size. width/m_mapimage.size.width)
End if
E. Graphics. drawimage (m_mapimage, new rectanglef (m_basepoint, m_size ))
End if
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service