Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim imageFile As Image = Image.FromFile("MyImage.jpg")
- ' Create graphics object for alteration.
- Dim newGraphics As Graphics = Graphics.FromImage(imageFile)
- ' Alter image.
- newGraphics.FillRectangle(New SolidBrush(Color.Black), _
- 100, 50, 100, 100)
- ' Draw image to screen.
- newGraphics.Graphics.DrawImage(imageFile, New PointF(0.0F, 0.0F))
- Imports System.Runtime.InteropServices
- Class Form1
- Private InitialStyle As Integer
- Dim PercentVisible As Decimal
- Private Sub Form1_Load(sender As Object, e As RoutedEventArgs) Handles Form1.Load
- InitialStyle = GetWindowLong(Me.Handle, -20)
- PercentVisible = 0.8
- SetWindowLong(Me.Handle, -20, InitialStyle Or &H80000 Or &H20)
- SetLayeredWindowAttributes(Me.Handle, 0, 255 * PercentVisible, &H2)
- Me.Topmost = True
- End Sub
- <DllImport("user32.dll", EntryPoint:="GetWindowLong")> Public Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
- End Function
- <DllImport("user32.dll", EntryPoint:="SetWindowLong")> Public Shared Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
- End Function
- <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
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement