Skip to main content

Simple (but short cut) to Borderless Forms

 

Pros:

  • Simple, easy to Program
  • Easy to understand for the beginner

Cons

  • May flicker as controls are drawn and redrawn
  • Windows seems not to like this method much :)

Insert this code snippet in your form that you want to be movable :

 

#Region "Declarations"

Dim m As Integer = 0

Dim n As Integer = 0

Dim isMouseDown As Boolean = False

Dim isMouseDownAgain As Boolean = False

#End Region

#Region "Form Events"

Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown

If isMouseDownAgain = True Then

    isMouseDown = False

    isMouseDownAgain = False

         End If

         m = MousePosition.X - Me.Location.X

         n = MousePosition.Y - Me.Location.Y

         Me.Location = New Point(MousePosition.X - m, MousePosition.Y - n)

         If isMouseDown = True Then

    isMouseDownAgain = True

        Else

    isMouseDownAgain = False

End If

isMouseDown = True

End Sub

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove

If isMouseDown = True And isMouseDownAgain <> True Then

        Me.Location = New Point(MousePosition.X - m, MousePosition.Y - n)

Else

      Exit Sub

End If

End Sub

Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp

isMouseDown = False

Me.Location = New Point(MousePosition.X - m, MousePosition.Y - n)

End Sub

#End Region

Popular posts from this blog

Burhan Wani – The man and his mission

Burhan Wani – The man and his mission The death of a young ‘hero’? On the 8th of July, Burhan Muzaffar Wani died in the Valley of Kashmir. Thousands poured out on the streets to commemorate his services to the movement that he had come to symbolize of late. The relative calm of the region was shattered with curfews, killings and allegations of human rights abuses. His father was proud for the services his son had offered in the name of their faith, convinced that he would go to Heaven. Amidst all this, the romantic ideals of a young boy, just off his teens began to shake up the youth of the entire country, both in and beyond India. There is a lot of unrest in the Kashmir Valley recently, especially in the aftermath of the death, nay execution of Burhan. All of this is not unexpected in any way. In fact, this was foreseen. Even his glorification, his elevation to the status of a martyr in the service of Islam does not come as a surprise to me.
There is a section of the media and a sig…

Letters, open and counters

In this Information age, the opinions of people are shaped by the discourse that happens in the media – the newspapers, the internet forums, the videos that are shot, the letters, open letters and counter letters. A vast majority of them are full of half-truths and that is not surprising as every side has skeletons to hide. The problem arises when a gullible population (read Indians) digest these printed words both offline and on as the ultimate Truth without question. Secondary sources and even imaginary accounts becomes Gospels to be used to shut anyone who dares to oppose the mainstream discourse.
The Quint has recently published an open letter by a veteran soldier of the Indian Army named Major Gaurav. They apparently waited for a counter to that which was furnished by a Wasim Khan, a ‘Kashmiri’ who now is settled in Mumbai and runs a successful media agency (not surprising). So before we go into braindead blaming attempts, let’s analyze the two pieces one by one and check the m…

The Man and the Qu'ran in Bangalore

I stayed for 3 years in Bangalore. There were places I loved in the city, places that I liked and a few places that I hated. There were also places about which I cannot make up any opinion at all.

Among them was the Jumma Masjid on the Dispensary road. This is not to be confused with the more famous Trust by the same name that is close by.

The area around is always busy and the commercial street is also close. The markets were always full of customers, shopkeepers sold exotic items. Just a few hundred meters and you could also visit the markets selling lots of stolen goods, though the shopkeepers often deny that and then wink to show that they were bluffing. It is a fun place for a man to be in, a bit scary for many women, except in a crowd.

Anyway, I always found the place inviting in a peculiar way, the nearby Salafi mosque preaching the evils of other religions, the stench of the urinals, the cheap stolen goods in the market, the prostitutes on the road, the hustle and bustle of t…