Hi there. I just upgraded our application to Infragistics version 8.2 for .Net 2.0 and I've run into a problem with the UltraPictureBox control. After setting a picture to show in the UltraPictureBox, if your mouse enters the control, the application throws an error. The stack trace shows this:
" at System.Drawing.Image.get_Width() at System.Drawing.Image.get_Size() at Infragistics.Win.EmbeddableImageRendererUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive) at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered) at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify) at Infragistics.Win.ControlUIElementBase.ProcessMouseMoveHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseMove(Object sender, MouseEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnMouseMove(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseMove(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at SlimeAdminTest2.Offender.Main() in C:\Documents and Settings\dricciardi\My Documents\Visual Studio 2005\Projects\SlimeAdminTest2\Offender.vb:line 11 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[ args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[ args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()"
I am not using any events at all of the ultrapicturebox, so why it is trying to do something on mouse enter is beyond me. The error does not occur if the control is disabled, however this grays out any picture inside it. I would be fine with leaving the control disabled if I could figure out how to keep the picture from being grayed out. Thanks for your help.
I tried this out and I can't reproduce this error. Looking at the stack trace, it seems to be an issue with the .NET Image class trying to get the width; what's the specified exception, and is it a GDI exception? The base of the call stack implies that this is on another thread, which will certainly cause issues as you should not be doing anything that could impact the UI on another thread.
-Matt
Sorry, the actual exception is "Parameter is not valid." with a source: "System.Drawing".
It's not doing anything explicitly with a different thread that I see. In fact, it shouldn't be doing anything at all when I mouse over it.
Here is the code that actually sets the image for the UltraPictureBox in case it helps:
Private Sub btnFindImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindImage.Click Dim bmpTest As Bitmap ofdImage.Title = "Select Image you'd like to import" ofdImage.ShowDialog() TextBox1.Text = ofdImage.FileName If TextBox1.Text <> "" Then tbImageSource.Text = ofdImage.FileName bmpTest = New Bitmap(TextBox1.Text) upbPreveiw.Image = bmpTest tbImageName.Text = ofdImage.FileName.Substring(ofdImage.FileName.LastIndexOf("\") + 1) upbPreveiw.Refresh() Button1.Enabled = True If ugPhoto.Rows.Count > 0 Then btnReplace.Enabled = True End If btnPublish.Enabled = True bmpTest.Dispose() End If End Sub