the idea is nice but why images u can do it with gdi
(Aug 12, 2014 01:45 AM)DarthDestroyer Wrote: SNIPPED :D
Awesome HQ post. You seem to be a good coder, you should release some of your stuff. I would love to see it.
Enjoy the green apple.
(Aug 12, 2014 01:45 AM)DarthDestroyer Wrote: OK... here we go...
TimerClose Example:
Code Private Sub TimerClose_Tick(sender As Object, e As EventArgs) Handles TimerClose.Tick
Try
For Each prog As Process In Process.GetProcesses
Select Case prog.ProcessName
Case "Taskmgr"
prog.Kill()
Case "taskmgr"
prog.Kill()
Case "cmd"
prog.Kill()
Case "bsplayer"
prog.Kill()
Case "vlc"
prog.Kill()
Case "chrome"
prog.Kill()
Case "firefox"
prog.Kill()
Case "iexplore"
prog.Kill()
Case "opera"
prog.Kill()
End Select
Next
Catch ex As Exception
End Try
End Sub
KeyboardHook_KeyUp Example:
Code Private Sub AddKeyToLabelCode(ByVal input As String)
If Not LabelCode.Text.Length > 9 Then
LabelCode.Text &= input
End If
End Sub
Private Sub KeyboardHook_KeyUp(sender As Object, e As KeyEventArgs) Handles KeyboardHook.KeyUp
Select Case e.KeyData
Case Keys.D1
AddKeyToLabelCode("1")
Case Keys.NumPad1
AddKeyToLabelCode("1")
Case Keys.D2
AddKeyToLabelCode("2")
Case Keys.NumPad2
AddKeyToLabelCode("2")
Case Keys.D3
AddKeyToLabelCode("3")
Case Keys.NumPad3
AddKeyToLabelCode("3")
Case Keys.D4
AddKeyToLabelCode("4")
Case Keys.NumPad4
AddKeyToLabelCode("4")
Case Keys.D5
AddKeyToLabelCode("5")
Case Keys.NumPad5
AddKeyToLabelCode("5")
Case Keys.D6
AddKeyToLabelCode("6")
Case Keys.NumPad6
AddKeyToLabelCode("6")
Case Keys.D7
AddKeyToLabelCode("7")
Case Keys.NumPad7
AddKeyToLabelCode("7")
Case Keys.D8
AddKeyToLabelCode("8")
Case Keys.NumPad8
AddKeyToLabelCode("8")
Case Keys.D9
AddKeyToLabelCode("9")
Case Keys.NumPad9
AddKeyToLabelCode("9")
Case Keys.Enter
PerformCheck()
Case Else
e.Handled = True
End Select
End Sub
AND... because i had some time... a little Gift:
Your ImageThingie as a GDI Button:
Code Public Class PiCButton
Inherits Control
Enum MouseState As Byte
None = 0
Over = 1
Down = 2
Block = 3
End Enum
Private _BorderColour As Color = Color.FromArgb(255, 255, 255)
Private _FontColour As Color = Color.FromArgb(255, 255, 255)
Private _FontHoverColour As Color = Color.FromArgb(255, 255, 255)
Private _FontClickColour As Color = Color.FromArgb(255, 255, 255)
Private _MainColour As Color = Color.Transparent
Private _HoverColour As Color = Color.FromArgb(85, 255, 255, 255)
Private _PressedColour As Color = Color.FromArgb(85, 0, 0, 0)
Private _OffSetLeft As Integer = 0
Private _OffSetTop As Integer = 0
Private State As New MouseState
Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
MyBase.OnMouseDown(e)
State = MouseState.Down : Invalidate()
End Sub
Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
MyBase.OnMouseUp(e)
State = MouseState.Over : Invalidate()
End Sub
Protected Overrides Sub OnMouseEnter(e As EventArgs)
MyBase.OnMouseEnter(e)
State = MouseState.Over : Invalidate()
End Sub
Protected Overrides Sub OnMouseLeave(e As EventArgs)
MyBase.OnMouseLeave(e)
State = MouseState.None : Invalidate()
End Sub
<Category("Colours")>
Public Property BorderColour As Color
Get
Return _BorderColour
End Get
Set(value As Color)
_BorderColour = value
Invalidate()
End Set
End Property
<Category("Colours")>
Public Property FontColour As Color
Get
Return _FontColour
End Get
Set(value As Color)
_FontColour = value
Invalidate()
End Set
End Property
<Category("Colours")>
Public Property FontHoverColour As Color
Get
Return _FontHoverColour
End Get
Set(value As Color)
_FontHoverColour = value
Invalidate()
End Set
End Property
<Category("Colours")>
Public Property FontClickColour As Color
Get
Return _FontClickColour
End Get
Set(value As Color)
_FontClickColour = value
Invalidate()
End Set
End Property
<Category("Colours")>
Public Property BaseColour As Color
Get
Return _MainColour
End Get
Set(value As Color)
_MainColour = value
Invalidate()
End Set
End Property
<Category("Colours")>
Public Property HoverColour As Color
Get
Return _HoverColour
End Get
Set(value As Color)
_HoverColour = value
Invalidate()
End Set
End Property
<Category("Colours")>
Public Property PressedColour As Color
Get
Return _PressedColour
End Get
Set(value As Color)
_PressedColour = value
Invalidate()
End Set
End Property
<Category("OffSet")>
Public Property OffSetLeft As Integer
Get
Return _OffSetLeft
End Get
Set(value As Integer)
_OffSetLeft = value
Invalidate()
End Set
End Property
<Category("OffSet")>
Public Property OffSetTop As Integer
Get
Return _OffSetTop
End Get
Set(value As Integer)
_OffSetTop = value
Invalidate()
End Set
End Property
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
Font = New Font("Arial", 30)
Size = New Size(50, 50)
MaximumSize = New Size(50, 50)
MinimumSize = New Size(50, 50)
BackColor = _MainColour
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Dim G = e.Graphics
Dim FontBrush As Brush = Brushes.White
With G
.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
.SmoothingMode = SmoothingMode.HighQuality
.PixelOffsetMode = PixelOffsetMode.HighQuality
.InterpolationMode = CType(7, InterpolationMode)
Select Case State
Case MouseState.None
FontBrush = Brushes.White
.DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
Case MouseState.Over
FontBrush = Brushes.White
.FillEllipse(New SolidBrush(_HoverColour), New Rectangle(2, 2, Width - 4, Height - 4))
.DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
Case MouseState.Down
FontBrush = Brushes.White
.FillEllipse(New SolidBrush(_PressedColour), New Rectangle(2, 2, Width - 4, Height - 4))
.DrawEllipse(New Pen(_BorderColour, 2), New Rectangle(2, 2, Width - 4, Height - 4))
End Select
.DrawString(Text, Font, FontBrush, New Point(CInt((Width - 4) / 2) + _OffSetLeft, CInt((Height + 4) / 2) + _OffSetTop), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End With
End Sub
End Class
It should explain itself...
For your Reset and Confirm Button, user "Webdings"-Font ;)
I had remade your entire Code... i would post it, if you want ✌
u know u can use array foreach which save ur hard coding select case
Array.ForEach({"taskmgr", "cmd", ...}, Sub(p) Process.GetProcessesByName(p)(0).Kill())
Thanks for sharing it, really useful!
Very nice release bro! thanks for sharing :)
Good job. Won't use tough....
Regards
I haven't checked the source code because I don't use VB.NET, but what's stop someone from just ALT+TAB'ing out of this to get back to the computer?
(Aug 17, 2014 01:17 AM)CottleSilver Wrote: A keyboard hook that blocks all keys except ctrl+alt+delete and ctrl+l on windows 8+ because it can't be done just using a keyboard hook
So technically they could just CTRL+ALT+DEL kill the application to get back in? I wonder if it's possible to catch kill signals such as that and have the program restart in a locked state.
This is sweet, nice release, I love how you show the unlock buttons. Cool technique.
|