Screen Digital Clock VB .NET Program



         We can create a on screen digital clock. On screen means the clock will stay on all windows and in the center of the computer screen
Imports System.Windows.Forms

Public Class Form1
    Public Const WM_NCHITTEST = &H84
    Dim rcCaption As Rectangle

    Public Enum HitTestResult

        HTBORDER = 18

        HTBOTTOM = 15

        HTBOTTOMLEFT = 16

        HTBOTTOMRIGHT = 17

        HTCAPTION = 2

        HTCLIENT = 1

        HTERROR = (-2)

        HTGROWBOX = 4

        HTHSCROLL = 6

        HTLEFT = 10

        HTMAXBUTTON = 9

        HTMENU = 5

        HTMINBUTTON = 8

        HTNOWHERE = 0

        HTRIGHT = 11

        HTSYSMENU = 3

        HTTOP = 12

        HTTOPLEFT = 13

        HTTOPRIGHT = 14

        HTVSCROLL = 7

        HTTRANSPARENT = (-1)

        HTOBJECT = 19

        HTCLOSE = 20

        HTHELP = 21

    End Enum
Public Sub FakeCaptionForCaptionlessWindow(ByVal fParent As Form, ByRef m As Message, ByVal CaptionRectangle As Rectangle)



        If m.Msg = WM_NCHITTEST Then
 
            Dim ptClickLocation As New Point(m.LParam.ToInt32)

            ptClickLocation = fParent.PointToClient(ptClickLocation)

            If CaptionRectangle.Contains(ptClickLocation) Then
 
                m.Result = New IntPtr(HitTestResult.HTCAPTION)

            Else
 
                m.Result = New IntPtr(HitTestResult.HTCLIENT)

            End If
 
        End If
 
    End Sub
 
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.TextBox1.Text = Now.ToLongTimeString
    End Sub
 
    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        e.Graphics.FillRectangle(New SolidBrush(Color.Blue), rcCaption)
    End Sub
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

        If m.Msg = WM_NCHITTEST Then
 
            Call FakeCaptionForCaptionlessWindow(Me, m, rcCaption)

        Else
 
            MyBase.WndProc(m)

        End If
 
    End Sub
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
 
OUTPUT

Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Total Pageviews

CONTACT US

Prof. Roshan P. Helonde
Mobile: +917276355704
WhatsApp: +917276355704
Email: roshanphelonde@rediffmail.com

Enter Project Title

Popular Projects

All Archive

Contact Form

Name

Email *

Message *