Odd ThemedSplitContainer Behavior


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
If I minimize a form that has this control on it (orientation: horizontal), then restore the form, I get the following error:


System.ArgumentException was unhandled by user code
  Message="Rectangle '{X=0,Y=70,Width=0,Height=4}' cannot have a width or height equal to 0."
  Source="System.Drawing"
  StackTrace:
       at System.Drawing.Drawing2D.LinearGradientBrush..ctor(Rectangle rect, Color color1, Color color2, LinearGradientMode linearGradientMode)    at MicroFour.StrataFrame.UI.Windows.Forms.ThemedSplitContainer.RenderHorizontalBar(Graphics DrawObj)    at MicroFour.StrataFrame.UI.Windows.Forms.ThemedSplitContainer.OnPaint(PaintEventArgs e)    at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)    at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle)    at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)    at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)    at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)    at System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)    at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)    at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)    at System.Windows.Forms.Control.WndProc(Message& m)    at System.Windows.Forms.ScrollableControl.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException:

How would I correct this problem?

Thanks,
Bill

Replies
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
here's the sample
Attachments
ThemedSplitContainerSample.zip (123 views, 673.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
How do you reproduce the error with your sample?  It is not failing, so I am guessing that your assemblies are not up to date.  If I need to do something to force the error, then please let me know.  Thanks.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Run the app, minimize the form, then restore the form.  The app fails on two different systems in our office, so I am not suspecting a local environment problem.  I'd rather not update to the beta unless I have to.  Are you unable to reproduce the behavior, still?
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hey Bill.

I tested over here and got the error. It looks like a problem with a the TabControl, when you Dock the SplitContainer to it. Without a TabControl, it works fine docked. With a TabControl, it works fine undocked. So, if it is urgent, you could try one of these scenarios.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Thanks, Ivan.  Not urgent, but the window is already well into the testing phase, so to restructure it would be a big task.  For now, the users have been instructed that the workaround is to simply not minimize that window.  Not the best workaround from a user standpoint, but knowing the Strataframe gurus, it will not be long before they have a fix prepared.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I'm sorry, but I cannot reproduce this which means that it has already been addressed.  I am not sure if the most recently posted beta has this in it or not at this point, I will have to research when this was fixed, whic to be honest, I think was a while back.  But in any case, it would require an update of your assemblies.  Here would be my suggestion for your immediate resolution, just open the SF source, and in teh OnPaint, place a Try/Catch around the entire OnPaint.  We actually fixed this differently, but this will resolve your problem and get you going down your current path.

The next SF beta will be a bigger update because all of the BO partial classes will have to be rebuilt as the property type descriptors are different (for the better) now.  So in any case, you will probably just wnt to fix what you have since you are in the middle of testing (from what I gather).

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
What version are you using when you run the project?
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I added the Try-Catch block as Trent suggested.  The form is behaving better.  Since the try-catch block basically is doing nothing but bypassing the bad code, may I ask what is the code supposed to be doing?  Just trying to understand why things work the way they do.


Private Sub RenderHorizontalBar(ByVal DrawObj As Graphics)
    '-- Establish Locals
    Try
       
Dim loRect As New Rectangle(0, Me.SplitterDistance, Me.Width, Me.SplitterWidth)  <---this is the line that bombs, Me.Width = 0
       
Dim loBar As New LinearGradientBrush(loRect, _DrawGradientBegin, _DrawGradientEnd, _DrawHorizontalGradientDirection)
    [ CODE SNIPPED ]
    Catch ex As Exception

    End Try
End Sub

Thanks!
Bill

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Just add a test that if the WIdth is <= 0 then bail...there is nothing to render.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Will do.  Thanks.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Bill Cunnien - 17 Years Ago
Dustin Taylor - 17 Years Ago
Bill Cunnien - 17 Years Ago
Trent L. Taylor - 17 Years Ago
                     here's the sample
Bill Cunnien - 17 Years Ago
                         How do you reproduce the error with your sample? It is not failing, so...
Trent L. Taylor - 17 Years Ago
                             Run the app, minimize the form, then restore the form. The app fails...
Bill Cunnien - 17 Years Ago
                         Hey Bill. I tested over here and got the error. It looks like a...
Ivan George Borges - 17 Years Ago
                             Thanks, Ivan. Not urgent, but the window is already well into the...
Bill Cunnien - 17 Years Ago
                                 I'm sorry, but I cannot reproduce this which means that it has already...
Trent L. Taylor - 17 Years Ago
                                     What version are you using when you run the project?
Bill Cunnien - 17 Years Ago
                                         I added the Try-Catch block asTrent suggested. The form is behaving...
Bill Cunnien - 17 Years Ago
                                             Just add a test that if the WIdth is <= 0 then bail...there is...
Trent L. Taylor - 17 Years Ago
                                                 Will do. Thanks.
Bill Cunnien - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search