有這麼好用的語法喔



這是用vb 2008完全不用引用API
PHP 語法:
Me.Hide()
Dim dt As Double = My.Computer.Clock.TickCount
While My.Computer.Clock.TickCount - dt < 1000
My.Application.DoEvents()
End While
Dim g As Graphics
Dim bmp As Bitmap
bmp = New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
g = Graphics.FromImage(bmp)
g.CopyFromScreen(New Point(0, 0), New Point(0, 0), New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height))
g.Dispose()
'Dim i As Integer = 1
'While (My.Computer.FileSystem.FileExists(My.Computer.FileSystem.SpecialDirectories.Desktop & "\ToyAide" & i & ".jpg"))
' i += 1
' End While
' bmp.Save(My.Computer.FileSystem.SpecialDirectories.Desktop & "\ToyAide" & i & ".jpg")
'PictureBox1.Image = bmp
Me.Show()
PictureBox1.Image = bmp
當然這是從網路上找到的,另外.NET還有圖片翻轉功能
PHP 語法:
If PictureBox1.Image IsNot Nothing Then
Dim Img As Image = PictureBox1.Image
Img.RotateFlip(RotateFlipType.Rotate270FlipNone)
PictureBox1.Image = Img
Img = Nothing
ImageSize()
End If
再附加尺寸縮小語法
PHP 語法:
' If My.Computer.Clipboard.ContainsImage Then
' Get the scale factor.
Dim scale_factor As Single = 0.5 'Single.Parse(txtScale.Text)
' Get the source bitmap.
Dim bm_source As New Bitmap(PictureBox1.Image)
' Make a bitmap for the result.
Dim bm_dest As New Bitmap(CInt(bm_source.Width * scale_factor), CInt(bm_source.Height * scale_factor))
' Make a Graphics object for the result Bitmap.
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)
' Copy the source image into the destination bitmap.
gr_dest.DrawImage(bm_source, 0, 0, bm_dest.Width + 1, bm_dest.Height + 1)
' Display the result.
' My.Computer.Clipboard.SetImage(bm_dest)
' PictureBox1.Image = My.Computer.Clipboard.GetImage
'PictureBox1.Image = bm_dest
' End If
PictureBox1.Image = bm_dest
ImageSize()