elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  No permitir resizear un form
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: No permitir resizear un form  (Leído 1,974 veces)
Legnak

Desconectado Desconectado

Mensajes: 61


("Programador");


Ver Perfil
No permitir resizear un form
« en: 26 Mayo 2014, 17:51 pm »

EDIT: Fixed


« Última modificación: 26 Mayo 2014, 18:07 pm por Legnak » En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.878



Ver Perfil
Re: No permitir resizear un form
« Respuesta #1 en: 28 Junio 2014, 06:22 am »

Debería eliminar el tema... pero prefiero dejar este código para quien busque una solución al mismo problema.

El código lo desarrollé para administrar/personalizar los bordes de un Form, pero, por otro lado, permite de una manera sencilla deshabilitar la redimensión de todos los bordes de la aplicación, con estas instrucciones:
Código
  1. Private FormBorders As New FormBorderManager(Me)
  2. FormBorders.SetAllEdgesToNonResizable()

Aquí tienen el resto:
Código
  1. ' ***********************************************************************
  2. ' Author   : Elektro
  3. ' Created  : 01-12-2014
  4. ' Modified : 01-12-2014
  5. ' ***********************************************************************
  6. ' <copyright file="FormBorderManager.vb" company="Elektro Studios">
  7. '     Copyright (c) Elektro Studios. All rights reserved.
  8. ' </copyright>
  9. ' ***********************************************************************
  10.  
  11. #Region " Usage Examples "
  12.  
  13. 'Public Class Form1
  14.  
  15. '    ' Disable resizing on all border edges.
  16. '    Private FormBorders As New FormBorderManager(Me) With
  17. '            {
  18. '                .Edges = New FormBorderManager.FormEdges With
  19. '                         {
  20. '                             .Top = FormBorderManager.WindowHitTestRegions.TitleBar,
  21. '                             .Left = FormBorderManager.WindowHitTestRegions.TitleBar,
  22. '                             .Right = FormBorderManager.WindowHitTestRegions.TitleBar,
  23. '                             .Bottom = FormBorderManager.WindowHitTestRegions.TitleBar,
  24. '                             .TopLeft = FormBorderManager.WindowHitTestRegions.TitleBar,
  25. '                             .TopRight = FormBorderManager.WindowHitTestRegions.TitleBar,
  26. '                             .BottomLeft = FormBorderManager.WindowHitTestRegions.TitleBar,
  27. '                             .BottomRight = FormBorderManager.WindowHitTestRegions.TitleBar
  28. '                         }
  29. '            }
  30.  
  31. '    Private Shadows Sub Load(sender As Object, e As EventArgs) Handles MyBase.Load
  32.  
  33. '        ' Disables the moving on all border edges.
  34. '        FormBorders.SetAllEdgesToNonMoveable()
  35.  
  36. '    End Sub
  37.  
  38. 'End Class
  39.  
  40. #End Region
  41.  
  42. #Region " Imports "
  43.  
  44. Imports System.ComponentModel
  45.  
  46. #End Region
  47.  
  48. #Region " FormBorderManager "
  49.  
  50. ''' <summary>
  51. ''' Class FormBorderManager.
  52. ''' Manages each Form border to indicate their Hit-Region.
  53. ''' </summary>
  54. <Description("Manages each Form border to indicate their Hit-Region")>
  55. Friend NotInheritable Class FormBorderManager : Inherits NativeWindow : Implements IDisposable
  56.  
  57. #Region " Members "
  58.  
  59. #Region " Miscellaneous "
  60.  
  61.    ''' <summary>
  62.    ''' The form to manage their borders.
  63.    ''' </summary>
  64.    Private WithEvents form As Form = Nothing
  65.  
  66. #End Region
  67.  
  68. #Region " Properties "
  69.  
  70.    ''' <summary>
  71.    ''' Gets or sets the Hit-Region of the edges.
  72.    ''' </summary>
  73.    ''' <value>The Form edges.</value>
  74.    Public Property Edges As New FormEdges
  75.  
  76.    ''' <summary>
  77.    ''' The Edges of the Form.
  78.    ''' </summary>
  79.    Partial Public NotInheritable Class FormEdges
  80.  
  81.        ''' <summary>
  82.        ''' Gets or sets the Hit-Region of the Top form border.
  83.        ''' </summary>
  84.        Public Property Top As WindowHitTestRegions = WindowHitTestRegions.TopSizeableBorder
  85.  
  86.        ''' <summary>
  87.        ''' Gets or sets the Hit-Region of the Left form border.
  88.        ''' </summary>
  89.        Public Property Left As WindowHitTestRegions = WindowHitTestRegions.LeftSizeableBorder
  90.  
  91.        ''' <summary>
  92.        ''' Gets or sets the Hit-Region of the Right form border.
  93.        ''' </summary>
  94.        Public Property Right As WindowHitTestRegions = WindowHitTestRegions.RightSizeableBorder
  95.  
  96.        ''' <summary>
  97.        ''' Gets or sets the Hit-Region of the Bottom form border.
  98.        ''' </summary>
  99.        Public Property Bottom As WindowHitTestRegions = WindowHitTestRegions.BottomSizeableBorder
  100.  
  101.        ''' <summary>
  102.        ''' Gets or sets the Hit-Region of the Top-Left form border.
  103.        ''' </summary>
  104.        Public Property TopLeft As WindowHitTestRegions = WindowHitTestRegions.TopLeftSizeableCorner
  105.  
  106.        ''' <summary>
  107.        ''' Gets or sets the Hit-Region of the Top-Right form border.
  108.        ''' </summary>
  109.        Public Property TopRight As WindowHitTestRegions = WindowHitTestRegions.TopRightSizeableCorner
  110.  
  111.        ''' <summary>
  112.        ''' Gets or sets the Hit-Region of the Bottom-Left form border.
  113.        ''' </summary>
  114.        Public Property BottomLeft As WindowHitTestRegions = WindowHitTestRegions.BottomLeftSizeableCorner
  115.  
  116.        ''' <summary>
  117.        ''' Gets or sets the Hit-Region of the Bottom-Right form border.
  118.        ''' </summary>
  119.        Public Property BottomRight As WindowHitTestRegions = WindowHitTestRegions.BottomRightSizeableCorner
  120.  
  121.    End Class
  122.  
  123. #End Region
  124.  
  125. #Region " Enumerations "
  126.  
  127.    ''' <summary>
  128.    ''' Known Windows Message Identifiers.
  129.    ''' </summary>
  130.    <Description("Messages to process in WndProc")>
  131.    Private Enum KnownMessages As Integer
  132.  
  133.        ''' <summary>
  134.        ''' Sent to a window in order to determine what part of the window corresponds to a particular screen coordinate.
  135.        ''' This can happen, for example, when the cursor moves, when a mouse button is pressed or released,
  136.        ''' or in response to a call to a function such as WindowFromPoint.
  137.        ''' If the mouse is not captured, the message is sent to the window beneath the cursor.
  138.        ''' Otherwise, the message is sent to the window that has captured the mouse.
  139.        ''' <paramref name="WParam" />
  140.        ''' This parameter is not used.
  141.        ''' <paramref name="LParam" />
  142.        ''' The low-order word specifies the x-coordinate of the cursor.
  143.        ''' The coordinate is relative to the upper-left corner of the screen.
  144.        ''' The high-order word specifies the y-coordinate of the cursor.
  145.        ''' The coordinate is relative to the upper-left corner of the screen.
  146.        ''' </summary>
  147.        WM_NCHITTEST = &H84
  148.  
  149.    End Enum
  150.  
  151.    ''' <summary>
  152.    ''' Indicates the position of the cursor hot spot.
  153.    ''' Options available when a form is tested for mose positions with 'WM_NCHITTEST' message.
  154.    ''' </summary>
  155.    <Description("Return value of the 'WM_NCHITTEST' message")>
  156.    Public Enum WindowHitTestRegions
  157.  
  158.        ''' <summary>
  159.        ''' HTERROR: On the screen background or on a dividing line between windows.
  160.        ''' (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error).
  161.        ''' </summary>
  162.        [Error] = -2
  163.  
  164.        ''' <summary>
  165.        ''' HTTRANSPARENT: In a window currently covered by another window in the same thread.
  166.        ''' (the message will be sent to underlying windows in the same thread
  167.        ''' until one of them returns a code that is not HTTRANSPARENT).
  168.        ''' </summary>
  169.        TransparentOrCovered = -1
  170.  
  171.        ''' <summary>
  172.        ''' HTNOWHERE: On the screen background or on a dividing line between windows.
  173.        ''' </summary>
  174.        NoWhere = 0
  175.  
  176.        ''' <summary>
  177.        ''' HTCLIENT: In a client area.
  178.        ''' </summary>
  179.        ClientArea = 1
  180.  
  181.        ''' <summary>
  182.        ''' HTCAPTION: In a title bar.
  183.        ''' </summary>
  184.        TitleBar = 2
  185.  
  186.        ''' <summary>
  187.        ''' HTSYSMENU: In a window menu or in a Close button in a child window.
  188.        ''' </summary>
  189.        SystemMenu = 3
  190.  
  191.        ''' <summary>
  192.        ''' HTGROWBOX: In a size box (same as HTSIZE).
  193.        ''' </summary>
  194.        GrowBox = 4
  195.  
  196.        ''' <summary>
  197.        ''' HTMENU: In a menu.
  198.        ''' </summary>
  199.        Menu = 5
  200.  
  201.        ''' <summary>
  202.        ''' HTHSCROLL: In a horizontal scroll bar.
  203.        ''' </summary>
  204.        HorizontalScrollBar = 6
  205.  
  206.        ''' <summary>
  207.        ''' HTVSCROLL: In the vertical scroll bar.
  208.        ''' </summary>
  209.        VerticalScrollBar = 7
  210.  
  211.        ''' <summary>
  212.        ''' HTMINBUTTON: In a Minimize button.
  213.        ''' </summary>
  214.        MinimizeButton = 8
  215.  
  216.        ''' <summary>
  217.        ''' HTMAXBUTTON: In a Maximize button.
  218.        ''' </summary>
  219.        MaximizeButton = 9
  220.  
  221.        ''' <summary>
  222.        ''' HTLEFT: In the left border of a resizable window.
  223.        ''' (the user can click the mouse to resize the window horizontally).
  224.        ''' </summary>
  225.        LeftSizeableBorder = 10
  226.  
  227.        ''' <summary>
  228.        ''' HTRIGHT: In the right border of a resizable window.
  229.        ''' (the user can click the mouse to resize the window horizontally).
  230.        ''' </summary>
  231.        RightSizeableBorder = 11
  232.  
  233.        ''' <summary>
  234.        ''' HTTOP: In the upper-horizontal border of a window.
  235.        ''' </summary>
  236.        TopSizeableBorder = 12
  237.  
  238.        ''' <summary>
  239.        ''' HTTOPLEFT: In the upper-left corner of a window border.
  240.        ''' </summary>
  241.        TopLeftSizeableCorner = 13
  242.  
  243.        ''' <summary>
  244.        ''' HTTOPRIGHT: In the upper-right corner of a window border.
  245.        ''' </summary>
  246.        TopRightSizeableCorner = 14
  247.  
  248.        ''' <summary>
  249.        ''' HTBOTTOM: In the lower-horizontal border of a resizable window.
  250.        ''' (the user can click the mouse to resize the window vertically).
  251.        ''' </summary>
  252.        BottomSizeableBorder = 15
  253.  
  254.        ''' <summary>
  255.        ''' HTBOTTOMLEFT: In the lower-left corner of a border of a resizable window.
  256.        ''' (the user can click the mouse to resize the window diagonally).
  257.        ''' </summary>
  258.        BottomLeftSizeableCorner = 16
  259.  
  260.        ''' <summary>
  261.        ''' HTBOTTOMRIGHT: In the lower-right corner of a border of a resizable window.
  262.        ''' (the user can click the mouse to resize the window diagonally).
  263.        ''' </summary>
  264.        BottomRightSizeableCorner = 17
  265.  
  266.        ''' <summary>
  267.        ''' HTBORDER: In the border of a window that does not have a sizing border.
  268.        ''' </summary>
  269.        NonSizableBorder = 18
  270.  
  271.        ' ''' <summary>
  272.        ' ''' HTOBJECT: Not implemented.
  273.        ' ''' </summary>
  274.        ' [Object] = 19
  275.  
  276.        ''' <summary>
  277.        ''' HTCLOSE: In a Close button.
  278.        ''' </summary>
  279.        CloseButton = 20
  280.  
  281.        ''' <summary>
  282.        ''' HTHELP: In a Help button.
  283.        ''' </summary>
  284.        HelpButton = 21
  285.  
  286.        ''' <summary>
  287.        ''' HTSIZE: In a size box (same as HTGROWBOX).
  288.        ''' (Same as GrowBox).
  289.        ''' </summary>
  290.        SizeBox = GrowBox
  291.  
  292.        ''' <summary>
  293.        ''' HTREDUCE: In a Minimize button.
  294.        ''' (Same as MinimizeButton).
  295.        ''' </summary>
  296.        ReduceButton = MinimizeButton
  297.  
  298.        ''' <summary>
  299.        ''' HTZOOM: In a Maximize button.
  300.        ''' (Same as MaximizeButton).
  301.        ''' </summary>
  302.        ZoomButton = MaximizeButton
  303.  
  304.    End Enum
  305.  
  306. #End Region
  307.  
  308. #End Region
  309.  
  310. #Region " Constructor "
  311.  
  312.    ''' <summary>
  313.    ''' Initializes a new instance of the <see cref="FormBorderManager"/> class.
  314.    ''' </summary>
  315.    ''' <param name="form">The form to assign.</param>
  316.    Public Sub New(ByVal form As Form)
  317.  
  318.        ' Assign the Formulary.
  319.        Me.form = form
  320.  
  321.    End Sub
  322.  
  323. #End Region
  324.  
  325. #Region " Event Handlers "
  326.  
  327.    ''' <summary>
  328.    ''' Assign the handle of the target Form to this NativeWindow,
  329.    ''' necessary to override target Form's WndProc.
  330.    ''' </summary>
  331.    Private Sub SetFormHandle() _
  332.    Handles form.HandleCreated, form.Load, form.Shown
  333.  
  334.        If Not MyBase.Handle.Equals(Me.form.Handle) Then
  335.            MyBase.AssignHandle(Me.form.Handle)
  336.        End If
  337.  
  338.    End Sub
  339.  
  340.    ''' <summary>
  341.    ''' Releases the Handle.
  342.    ''' </summary>
  343.    Private Sub OnHandleDestroyed() _
  344.    Handles Form.HandleDestroyed
  345.  
  346.        MyBase.ReleaseHandle()
  347.  
  348.    End Sub
  349.  
  350. #End Region
  351.  
  352. #Region " WndProc "
  353.  
  354.    ''' <summary>
  355.    ''' Invokes the default window procedure associated with this window to process messages for this Window.
  356.    ''' </summary>
  357.    ''' <param name="m">
  358.    ''' A <see cref="T:System.Windows.Forms.Message" /> that is associated with the current Windows message.
  359.    ''' </param>
  360.    Protected Overrides Sub WndProc(ByRef m As Message)
  361.  
  362.        MyBase.WndProc(m)
  363.  
  364.        Select Case m.Msg
  365.  
  366.            Case KnownMessages.WM_NCHITTEST
  367.  
  368.                Select Case CType(m.Result, WindowHitTestRegions)
  369.  
  370.                    Case WindowHitTestRegions.TopSizeableBorder ' The mouse hotspot is pointing to Top border.
  371.                        m.Result = New IntPtr(Edges.Top)
  372.  
  373.                    Case WindowHitTestRegions.LeftSizeableBorder ' The mouse hotspot is pointing to Left border.
  374.                        m.Result = New IntPtr(Edges.Left)
  375.  
  376.                    Case WindowHitTestRegions.RightSizeableBorder ' The mouse hotspot is pointing to Right border.
  377.                        m.Result = New IntPtr(Edges.Right)
  378.  
  379.                    Case WindowHitTestRegions.BottomSizeableBorder ' The mouse hotspot is pointing to Bottom border.
  380.                        m.Result = New IntPtr(Edges.Bottom)
  381.  
  382.                    Case WindowHitTestRegions.TopLeftSizeableCorner ' The mouse hotspot is pointing to Top-Left border.
  383.                        m.Result = New IntPtr(Edges.TopLeft)
  384.  
  385.                    Case WindowHitTestRegions.TopRightSizeableCorner ' The mouse hotspot is pointing to Top-Right border.
  386.                        m.Result = New IntPtr(Edges.TopRight)
  387.  
  388.                    Case WindowHitTestRegions.BottomLeftSizeableCorner ' The mouse hotspot is pointing to Bottom-Left border.
  389.                        m.Result = New IntPtr(Edges.BottomLeft)
  390.  
  391.                    Case WindowHitTestRegions.BottomRightSizeableCorner ' The mouse hotspot is pointing to Bottom-Right border.
  392.                        m.Result = New IntPtr(Edges.BottomRight)
  393.  
  394.                End Select
  395.  
  396.        End Select
  397.  
  398.    End Sub
  399.  
  400. #End Region
  401.  
  402. #Region " Public Methods "
  403.  
  404.    ''' <summary>
  405.    ''' Disables the resizing on all border edges.
  406.    ''' </summary>
  407.    Public Sub SetAllEdgesToNonResizable()
  408.  
  409.        DisposedCheck()
  410.  
  411.        Me.Edges.Top = WindowHitTestRegions.TitleBar
  412.        Me.Edges.Left = WindowHitTestRegions.TitleBar
  413.        Me.Edges.Right = WindowHitTestRegions.TitleBar
  414.        Me.Edges.Bottom = WindowHitTestRegions.TitleBar
  415.        Me.Edges.TopLeft = WindowHitTestRegions.TitleBar
  416.        Me.Edges.TopRight = WindowHitTestRegions.TitleBar
  417.        Me.Edges.BottomLeft = WindowHitTestRegions.TitleBar
  418.        Me.Edges.BottomRight = WindowHitTestRegions.TitleBar
  419.  
  420.    End Sub
  421.  
  422.    ''' <summary>
  423.    ''' Enables the resizing on all border edges.
  424.    ''' </summary>
  425.    Public Sub SetAllEdgesToResizable()
  426.  
  427.        DisposedCheck()
  428.  
  429.        Me.Edges.Top = WindowHitTestRegions.TopSizeableBorder
  430.        Me.Edges.Left = WindowHitTestRegions.LeftSizeableBorder
  431.        Me.Edges.Right = WindowHitTestRegions.RightSizeableBorder
  432.        Me.Edges.Bottom = WindowHitTestRegions.BottomSizeableBorder
  433.        Me.Edges.TopLeft = WindowHitTestRegions.TopLeftSizeableCorner
  434.        Me.Edges.TopRight = WindowHitTestRegions.TopRightSizeableCorner
  435.        Me.Edges.BottomLeft = WindowHitTestRegions.BottomLeftSizeableCorner
  436.        Me.Edges.BottomRight = WindowHitTestRegions.BottomRightSizeableCorner
  437.  
  438.    End Sub
  439.  
  440.    ''' <summary>
  441.    ''' Enabled the moving on all border edges.
  442.    ''' </summary>
  443.    Public Sub SetAllEdgesToMoveable()
  444.  
  445.        DisposedCheck()
  446.  
  447.        Me.Edges.Top = WindowHitTestRegions.TopSizeableBorder
  448.        Me.Edges.Left = WindowHitTestRegions.LeftSizeableBorder
  449.        Me.Edges.Right = WindowHitTestRegions.RightSizeableBorder
  450.        Me.Edges.Bottom = WindowHitTestRegions.BottomSizeableBorder
  451.        Me.Edges.TopLeft = WindowHitTestRegions.TopLeftSizeableCorner
  452.        Me.Edges.TopRight = WindowHitTestRegions.TopRightSizeableCorner
  453.        Me.Edges.BottomLeft = WindowHitTestRegions.BottomLeftSizeableCorner
  454.        Me.Edges.BottomRight = WindowHitTestRegions.BottomRightSizeableCorner
  455.  
  456.    End Sub
  457.  
  458.    ''' <summary>
  459.    ''' Disables the moving on all border edges.
  460.    ''' </summary>
  461.    Public Sub SetAllEdgesToNonMoveable()
  462.  
  463.        DisposedCheck()
  464.  
  465.        Me.Edges.Top = WindowHitTestRegions.NoWhere
  466.        Me.Edges.Left = WindowHitTestRegions.NoWhere
  467.        Me.Edges.Right = WindowHitTestRegions.NoWhere
  468.        Me.Edges.Bottom = WindowHitTestRegions.NoWhere
  469.        Me.Edges.TopLeft = WindowHitTestRegions.NoWhere
  470.        Me.Edges.TopRight = WindowHitTestRegions.NoWhere
  471.        Me.Edges.BottomLeft = WindowHitTestRegions.NoWhere
  472.        Me.Edges.BottomRight = WindowHitTestRegions.NoWhere
  473.  
  474.    End Sub
  475.  
  476. #End Region
  477.  
  478. #Region " Hidden methods "
  479.  
  480.    ' These methods and properties are purposely hidden from Intellisense just to look better without unneeded methods.
  481.    ' NOTE: The methods can be re-enabled at any-time if needed.
  482.  
  483.    ''' <summary>
  484.    ''' Assigns a handle to this window.
  485.    ''' </summary>
  486.    <EditorBrowsable(EditorBrowsableState.Never)>
  487.    Public Shadows Sub AssignHandle()
  488.    End Sub
  489.  
  490.    ''' <summary>
  491.    ''' Creates a window and its handle with the specified creation parameters.
  492.    ''' </summary>
  493.    <EditorBrowsable(EditorBrowsableState.Never)>
  494.    Public Shadows Sub CreateHandle()
  495.    End Sub
  496.  
  497.    ''' <summary>
  498.    ''' Creates an object that contains all the relevant information required
  499.    ''' to generate a proxy used to communicate with a remote object.
  500.    ''' </summary>
  501.    <EditorBrowsable(EditorBrowsableState.Never)>
  502.    Public Shadows Sub CreateObjRef()
  503.    End Sub
  504.  
  505.    ''' <summary>
  506.    ''' Invokes the default window procedure associated with this window.
  507.    ''' </summary>
  508.    <EditorBrowsable(EditorBrowsableState.Never)>
  509.    Public Shadows Sub DefWndProc()
  510.    End Sub
  511.  
  512.    ''' <summary>
  513.    ''' Destroys the window and its handle.
  514.    ''' </summary>
  515.    <EditorBrowsable(EditorBrowsableState.Never)>
  516.    Public Shadows Sub DestroyHandle()
  517.    End Sub
  518.  
  519.    ''' <summary>
  520.    ''' Determines whether the specified object is equal to the current object.
  521.    ''' </summary>
  522.    <EditorBrowsable(EditorBrowsableState.Never)>
  523.    Public Shadows Sub Equals()
  524.    End Sub
  525.  
  526.    ''' <summary>
  527.    ''' Serves as the default hash function.
  528.    ''' </summary>
  529.    <EditorBrowsable(EditorBrowsableState.Never)>
  530.    Public Shadows Sub GetHashCode()
  531.    End Sub
  532.  
  533.    ''' <summary>
  534.    ''' Retrieves the current lifetime service object that controls the lifetime policy for this instance.
  535.    ''' </summary>
  536.    <EditorBrowsable(EditorBrowsableState.Never)>
  537.    Public Shadows Sub GetLifetimeService()
  538.    End Sub
  539.  
  540.    ''' <summary>
  541.    ''' Obtains a lifetime service object to control the lifetime policy for this instance.
  542.    ''' </summary>
  543.    <EditorBrowsable(EditorBrowsableState.Never)>
  544.    Public Shadows Sub InitializeLifetimeService()
  545.    End Sub
  546.  
  547.    ''' <summary>
  548.    ''' Releases the handle associated with this window.
  549.    ''' </summary>
  550.    <EditorBrowsable(EditorBrowsableState.Never)>
  551.    Public Shadows Sub ReleaseHandle()
  552.    End Sub
  553.  
  554.    ''' <summary>
  555.    ''' Gets the handle for this window.
  556.    ''' </summary>
  557.    <EditorBrowsable(EditorBrowsableState.Never)>
  558.    Public Shadows Property Handle()
  559.  
  560. #End Region
  561.  
  562. #Region " IDisposable "
  563.  
  564.    ''' <summary>
  565.    ''' To detect redundant calls when disposing.
  566.    ''' </summary>
  567.    Private IsDisposed As Boolean = False
  568.  
  569.    ''' <summary>
  570.    ''' Prevent calls to methods after disposing.
  571.    ''' </summary>
  572.    ''' <exception cref="System.ObjectDisposedException"></exception>
  573.    Private Sub DisposedCheck()
  574.        If Me.IsDisposed Then
  575.            Throw New ObjectDisposedException(Me.GetType().FullName)
  576.        End If
  577.    End Sub
  578.  
  579.    ''' <summary>
  580.    ''' Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
  581.    ''' </summary>
  582.    Public Sub Dispose() Implements IDisposable.Dispose
  583.        Dispose(True)
  584.        GC.SuppressFinalize(Me)
  585.    End Sub
  586.  
  587.    ''' <summary>
  588.    ''' Releases unmanaged and - optionally - managed resources.
  589.    ''' </summary>
  590.    ''' <param name="IsDisposing">
  591.    ''' <c>true</c> to release both managed and unmanaged resources;
  592.    ''' <c>false</c> to release only unmanaged resources.
  593.    ''' </param>
  594.    Protected Sub Dispose(ByVal IsDisposing As Boolean)
  595.  
  596.        If Not Me.IsDisposed Then
  597.  
  598.            If IsDisposing Then
  599.                Me.form = Nothing
  600.                MyBase.ReleaseHandle()
  601.                MyBase.DestroyHandle()
  602.            End If
  603.  
  604.        End If
  605.  
  606.        Me.IsDisposed = True
  607.  
  608.    End Sub
  609.  
  610. #End Region
  611.  
  612. End Class
  613.  
  614. #End Region
  615.  


En línea



Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Disculpe, como puedo mostrar un form en un form?
Programación Visual Basic
Sai-To 8 4,274 Último mensaje 13 Enero 2008, 15:27 pm
por nhaalclkiemr
Abrir un form desde otro form con netbeans en java
Java
murdock_ 3 47,629 Último mensaje 1 Enero 2009, 03:44 am
por sapito169
Pasar valores de Form a Form JS
Desarrollo Web
Riki_89D 7 7,991 Último mensaje 7 Diciembre 2010, 00:12 am
por Riki_89D
[Vb6]Form pegado a la derecha de otro Form?
Programación Visual Basic
electrodev 2 3,922 Último mensaje 28 Julio 2012, 00:40 am
por electrodev
[SOLUCIONADO] No me deja emparentar el form (Form.parent =)
.NET (C#, VB.NET, ASP)
Eleкtro 1 2,142 Último mensaje 8 Enero 2013, 17:34 pm
por Eleкtro
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines