Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
UltraToolbarsDockArea.OnMouseUp error
posted

Hi, I write this code:

 

 Public Class myForm

        Inherits System.Windows.Forms.Form

        Private _pictureBox As Infragistics.Win.UltraWinEditors.UltraPictureBox = Nothing

        Private _borderStyle As Windows.Forms.FormBorderStyle = Nothing

        Public Sub myDisattiva(ByVal obj As Infragistics.Win.UltraWinToolbars.UltraToolbarsManager)

            If IsNothing(_pictureBox) Then

                _pictureBox = New Infragistics.Win.UltraWinEditors.UltraPictureBox

                _pictureBox.Name = "pcbDisattiva"

                _pictureBox.BorderShadowColor = System.Drawing.Color.Empty

                _pictureBox.Location = New System.Drawing.Point(0, 0)

                _pictureBox.Size = New System.Drawing.Size(100, 50)

                _pictureBox.Dock = DockStyle.Fill

                Me.Controls.Add(_pictureBox)

            End If

            Dim bmpScreenshot As New Bitmap(Me.Width, Me.Height)

            Me.DrawToBitmap(bmpScreenshot, New Rectangle(0, 0, Me.Width, Me.Height))

            Dim gfxScreenshot As Graphics = Graphics.FromImage(bmpScreenshot)

            gfxScreenshot.FillRectangle(New TextureBrush(My.Resources.Deactivate, Drawing2D.WrapMode.Tile), New Rectangle(0, 0, bmpScreenshot.Width, bmpScreenshot.Height))

            gfxScreenshot.Dispose()

            _pictureBox.Image = bmpScreenshot

            _pictureBox.Visible = True

            _pictureBox.BringToFront()


            _borderStyle = Me.FormBorderStyle

            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None

            obj.DockWithinContainer = Nothing

        End Sub

        Public Sub myAttiva(ByVal obj As Infragistics.Win.UltraWinToolbars.UltraToolbarsManager)

            If Not IsNothing(_pictureBox) AndAlso _

               _pictureBox.Visible Then

                obj.DockWithinContainer = Me

                Me.FormBorderStyle = _borderStyle

                _pictureBox.Visible = False

            End If

        End Sub

    End Class

This class creates an UltraPictureBox docked to the form and it draws an image. The image is a screenshot of the form with a texturebrushes. The effect is similar to "modal windows" of JQuery.

When I click on a buttontool (in a tabgroup on UltraToolbarsManager) the application generate UltraToolbarsDockArea.OnMouseUp error.

I suppose that the trouble is "obj.DockWithinContainer = Nothing". I use it to dock an object in front of UltraToolbarsManager.

What can I do?

Parents
  • 215
    Offline posted

    Explain the trouble:

    I have this test form (inherits from the class myForm - previous post):

    UltraButton events:

     

     Me.myDisattiva(UltraToolbarsManager1)

    Dim x As New frmForm2

    x.ShowDialog()

    Me.myAttiva(UltraToolbarsManager1)

     

    And so I see this:

    The first form returns visible when I close the second form.

    Then, I click on buttontool1 (the same code of ultrabutton).  I close the second form and the ultratoolbardockarea generate an error:

     

    System.NullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto.

       in Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.OnMouseUp(MouseEventArgs e)

       in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

       in System.Windows.Forms.Control.WndProc(Message& m)

       in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

       in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

       in System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

     

     

    I attach my test forms

Reply Children
No Data