Caso 2 No dejar cerrar el form. Ni Moverlos
Propiedades Border estilo, Minimizar, maximizar y Cerrar No Importa Como esten Configurados.
Public Class frmConfStock
Inherits System.Windows.Forms.Form
Dim rcCaption As Rectangle 'Necesaria
..............
..............
Private Sub CmdSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSalir1.ClickButton
If EstadoProceso Then
Me.Close()
Else
MessageBox.Show("El Proceso Actualizaciión No ha Terminado.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_NCHITTEST Then
Call MyForCaptionWindow(Me, m, rcCaption)
Else
MyBase.WndProc(m)
End If
End Sub
.............
End Clase
Ademas Agregamos un Modulo
Imports System.Windows.Forms
Module ApiHitTestHandling
Public Const WM_NCHITTEST = &H84
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 MyForCaptionWindow(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
End Module
Eso es todo espero que les sirva y ASUNTO SELLADO.
Saludossssssssss.