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?
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 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?
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
Perhaps I could handle the paint event of the ultratoolbarmanager.
How can I do? What event can I use?
Thanks
If someone could respond, I'd really appreciate it.