[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Class Library (pnetlib)
From: |
Heiko Weiss |
Subject: |
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Class Library (pnetlib) branch, master, updated. 75d055aceb87120740df2394e3f045a650e0049b |
Date: |
Mon, 22 Feb 2010 09:32:55 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET Class Library (pnetlib)".
The branch, master has been updated
via 75d055aceb87120740df2394e3f045a650e0049b (commit)
from 067960a37cdd592213f9fa40d1b1e50e96b4e66d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/pnetlib.git/commit/?id=75d055aceb87120740df2394e3f045a650e0049b
commit 75d055aceb87120740df2394e3f045a650e0049b
Author: Heiko Weiss <address@hidden>
Date: Mon Feb 22 10:31:56 2010 +0100
workaround for exception in scrollable control
diff --git a/ChangeLog b/ChangeLog
index e808d46..b43618a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-22 Heiko Weiss <address@hidden>
+
+ * System.Windows.Forms/ScrollableControl.cs: workaround for exception
+ while removing controls.
+
2010-02-01 Heiko Weiss <address@hidden>
* runtime/System/Text/Encoding.cs (InvokeI18N): avoid cctor to fail.
diff --git a/System.Windows.Forms/ScrollableControl.cs
b/System.Windows.Forms/ScrollableControl.cs
index b96a730..9171653 100644
--- a/System.Windows.Forms/ScrollableControl.cs
+++ b/System.Windows.Forms/ScrollableControl.cs
@@ -258,46 +258,57 @@ public class ScrollableControl : Control
private void UpdateScrollBars()
{
- this.CheckAutoscrollPosition();
- Rectangle rect = DisplayRectangle;
-
- if( null != vScrollBar ) {
- vScrollBar.SetBounds(rect.Right, 0,
vScrollBar.Width, rect.Height);
- if(DisplayRectangle.Height >=
ScrollArea.Height)
- {
- vScrollBar.Visible = false;
- }
- else
- {
-// vScrollBar.CreateControl();
-
- // set Maximum before setting
the value, or we get an exception
- vScrollBar.Maximum =
ScrollArea.Height - 1;
- vScrollBar.Value =
-(autoScrollPosition.Y);
- // set Large/SmallChange after
setting maximum, or display failure
- vScrollBar.LargeChange =
DisplayRectangle.Height;
- vScrollBar.SmallChange =
(DisplayRectangle.Height + 9 )/ 10;
- vScrollBar.Visible = vscroll;
- }
- }
-
- if( null != hScrollBar ) {
- hScrollBar.SetBounds(0, rect.Bottom,
rect.Width, hScrollBar.Height);
- if(DisplayRectangle.Width >=
ScrollArea.Width)
- {
- hScrollBar.Visible = false;
+ try
+ {
+ this.CheckAutoscrollPosition();
+ Rectangle rect = DisplayRectangle;
+
+ if( null != vScrollBar ) {
+
vScrollBar.SetBounds(rect.Right, 0, vScrollBar.Width, rect.Height);
+ if(DisplayRectangle.Height >=
ScrollArea.Height)
+ {
+ vScrollBar.Visible =
false;
+ }
+ else
+ {
+ //
vScrollBar.CreateControl();
+
+ // set Maximum before
setting the value, or we get an exception
+ vScrollBar.Maximum =
ScrollArea.Height - 1;
+ vScrollBar.Value =
-(autoScrollPosition.Y);
+ // set
Large/SmallChange after setting maximum, or display failure
+ vScrollBar.LargeChange
= DisplayRectangle.Height;
+ vScrollBar.SmallChange
= (DisplayRectangle.Height + 9 )/ 10;
+ vScrollBar.Visible =
vscroll;
+ }
}
- else
- {
- // set Maximum before setting
the value, or we get an exception
- hScrollBar.Maximum =
ScrollArea.Width - 1;
- hScrollBar.Value =
-(autoScrollPosition.X);
- // set Large/SmallChange after
setting maximum, or display failure
- hScrollBar.LargeChange =
DisplayRectangle.Width;
- hScrollBar.SmallChange =
(DisplayRectangle.Width + 9) / 10;
- hScrollBar.Visible = hscroll;
+
+ if( null != hScrollBar ) {
+ hScrollBar.SetBounds(0,
rect.Bottom, rect.Width, hScrollBar.Height);
+ if(DisplayRectangle.Width >=
ScrollArea.Width)
+ {
+ hScrollBar.Visible =
false;
+ }
+ else
+ {
+ // set Maximum before
setting the value, or we get an exception
+ hScrollBar.Maximum =
ScrollArea.Width - 1;
+ hScrollBar.Value =
-(autoScrollPosition.X);
+ // set
Large/SmallChange after setting maximum, or display failure
+ hScrollBar.LargeChange
= DisplayRectangle.Width;
+ hScrollBar.SmallChange
= (DisplayRectangle.Width + 9) / 10;
+ hScrollBar.Visible =
hscroll;
+ }
}
}
+ catch
+ {
+ // ignore exception while updating
scrollbars.
+ // exceptions might happen while
clearing controls while disposing
+ // scrollbar tries to create graphics,
but widget might be destroyed
+ // Xsharp.XInvalidOperationException
+ // this is not a fix, but a workaround
+ }
}
protected override void SetBoundsCore(int x, int y, int width, int
height, BoundsSpecified specified)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 ++
System.Windows.Forms/ScrollableControl.cs | 85 ++++++++++++++++-------------
2 files changed, 53 insertions(+), 37 deletions(-)
hooks/post-receive
--
DotGNU Portable.NET Class Library (pnetlib)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Class Library (pnetlib) branch, master, updated. 75d055aceb87120740df2394e3f045a650e0049b,
Heiko Weiss <=
- Prev by Date:
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. 86899efd7040d519f7770461e1d2cc6c829ab1e5
- Next by Date:
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET branch, master, updated. cab3156681a2baa00feb95e34d0755927da83eaf
- Previous by thread:
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. 86899efd7040d519f7770461e1d2cc6c829ab1e5
- Next by thread:
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET branch, master, updated. cab3156681a2baa00feb95e34d0755927da83eaf
- Index(es):