Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. Dim imageFile As Image = Image.FromFile("MyImage.jpg")
  2.  
  3. ' Create graphics object for alteration.
  4. Dim newGraphics As Graphics = Graphics.FromImage(imageFile)
  5.  
  6. ' Alter image.
  7. newGraphics.FillRectangle(New SolidBrush(Color.Black), _
  8. 100, 50, 100, 100)
  9.  
  10. ' Draw image to screen.
  11. newGraphics.Graphics.DrawImage(imageFile, New PointF(0.0F, 0.0F))
  12.  
  13. Imports System.Runtime.InteropServices
  14. Class Form1
  15.  
  16. Private InitialStyle As Integer
  17. Dim PercentVisible As Decimal
  18. Private Sub Form1_Load(sender As Object, e As RoutedEventArgs) Handles Form1.Load
  19. InitialStyle = GetWindowLong(Me.Handle, -20)
  20. PercentVisible = 0.8
  21.  
  22. SetWindowLong(Me.Handle, -20, InitialStyle Or &H80000 Or &H20)
  23.  
  24. SetLayeredWindowAttributes(Me.Handle, 0, 255 * PercentVisible, &H2)
  25.  
  26. Me.Topmost = True
  27. End Sub
  28.  
  29. <DllImport("user32.dll", EntryPoint:="GetWindowLong")> Public Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
  30. End Function
  31.  
  32. <DllImport("user32.dll", EntryPoint:="SetWindowLong")> Public Shared Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
  33. End Function
  34.  
  35. <DllImport("user32.dll", EntryPoint:="SetLayeredWindowAttributes")> Public Shared Function SetLayeredWindowAttributes(ByVal hWnd As IntPtr, ByVal crKey As Integer, ByVal alpha As Byte, ByVal dwFlags As Integer) As Boolean
  36. End Function
  37. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement