[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Windows.Forms/Scroll...
From: |
Heiko Weiss |
Subject: |
[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Windows.Forms/Scroll... |
Date: |
Thu, 18 May 2006 11:03:10 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnetlib
Branch:
Changes by: Heiko Weiss <address@hidden> 06/05/18 11:03:09
Modified files:
. : ChangeLog
System.Windows.Forms: ScrollableControl.cs
Log message:
fixed autoscrolling and null exceptions.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/ChangeLog.diff?tr1=1.2405&tr2=1.2406&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Windows.Forms/ScrollableControl.cs.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
Patches:
Index: pnetlib/ChangeLog
diff -u pnetlib/ChangeLog:1.2405 pnetlib/ChangeLog:1.2406
--- pnetlib/ChangeLog:1.2405 Tue May 16 05:34:43 2006
+++ pnetlib/ChangeLog Thu May 18 11:03:09 2006
@@ -1,3 +1,7 @@
+2006-05-18 Heiko Weiss <address@hidden>
+
+ * System.Windows.Forms/ScrollableControl.cs: fixed autoscrolling and
null exceptions.
+
2006-05-16 Heiko Weiss <address@hidden>
* runtime/System/Private/NumberFormat/Formatter.cs: fixed rounding
problem in FormatFloat.
Index: pnetlib/System.Windows.Forms/ScrollableControl.cs
diff -u pnetlib/System.Windows.Forms/ScrollableControl.cs:1.14
pnetlib/System.Windows.Forms/ScrollableControl.cs:1.15
--- pnetlib/System.Windows.Forms/ScrollableControl.cs:1.14 Thu Apr 6
10:06:16 2006
+++ pnetlib/System.Windows.Forms/ScrollableControl.cs Thu May 18 11:03:09 2006
@@ -128,7 +128,14 @@
}
set
{
- autoScrollPosition = value;
+ if( value != autoScrollPosition ) {
+ Size offset = new
Size(autoScrollPosition.X,autoScrollPosition.Y);
+ offset.Width -= value.X;
+ offset.Height -= value.Y;
+ this.ScrollByOffset( offset );
+
+ this.UpdateScrollBars();
+ }
}
}
protected override CreateParams CreateParams
@@ -144,6 +151,7 @@
{
// subtract the scroll bars from the
DisplayRectangle
Rectangle displayRect =
base.DisplayRectangle;
+
Rectangle scrollArea = ScrollArea;
bool vert, horiz;
@@ -165,12 +173,16 @@
if(horiz)
{
- vert = vert &&
(displayRect.Width < (scrollArea.Width+vScrollBar.Width));
+ if( null != vScrollBar ) {
+ vert = vert &&
(displayRect.Width < (scrollArea.Width+vScrollBar.Width));
+ }
}
if(vert)
{
- horiz = horiz &&
(displayRect.Height < (scrollArea.Height+hScrollBar.Height));
+ if( null != hScrollBar ) {
+ horiz = horiz &&
(displayRect.Height < (scrollArea.Height+hScrollBar.Height));
+ }
}
// I could keep doing this on and on
.... but two
@@ -179,9 +191,14 @@
// to calculate this to perfection.
Size scrollbarsize=new Size(
- vert ?
vScrollBar.Width : 0,
- horiz ?
hScrollBar.Height : 0);
+ ( vert && null !=
vScrollBar ) ? vScrollBar.Width : 0,
+ ( horiz && null !=
hScrollBar ) ? hScrollBar.Height : 0);
displayRect.Size-=scrollbarsize;
+
+ // limit rect to positive size
+ if( displayRect.Width < 0 )
displayRect.Width = 0;
+ if( displayRect.Height < 0 )
displayRect.Height = 0;
+
return displayRect;
}
}
@@ -240,36 +257,40 @@
private void UpdateScrollBars()
{
Rectangle rect = DisplayRectangle;
- vScrollBar.SetBounds(rect.Right, 0,
vScrollBar.Width, rect.Height);
- hScrollBar.SetBounds(0, rect.Bottom,
rect.Width, hScrollBar.Height);
- if(DisplayRectangle.Height >= ScrollArea.Height)
- {
- vScrollBar.Visible = false;
+ if( null != vScrollBar ) {
+ vScrollBar.SetBounds(rect.Right, 0,
vScrollBar.Width, rect.Height);
+ if(DisplayRectangle.Height >=
ScrollArea.Height)
+ {
+ vScrollBar.Visible = false;
+ }
+ else
+ {
+ vScrollBar.LargeChange =
DisplayRectangle.Height;
+ vScrollBar.SmallChange =
(DisplayRectangle.Height + 9 )/ 10;
+ vScrollBar.Value =
-(autoScrollPosition.Y);
+ /* note: I don't exactly remember how I
got this , but
+ * it seemed to work sometime near 8 Pm
... so I left it
+ * in */
+ vScrollBar.Maximum =
ScrollArea.Height - 1;
+ vScrollBar.Visible = vscroll;
+ }
}
- else
- {
- vScrollBar.LargeChange =
DisplayRectangle.Height;
- vScrollBar.SmallChange =
(DisplayRectangle.Height + 9 )/ 10;
- vScrollBar.Value =
-(autoScrollPosition.Y);
- /* note: I don't exactly remember how I got
this , but
- * it seemed to work sometime near 8 Pm ... so
I left it
- * in */
- vScrollBar.Maximum = ScrollArea.Height
- 1;
- vScrollBar.Visible = vscroll;
- }
- if(DisplayRectangle.Width >= ScrollArea.Width)
- {
- hScrollBar.Visible = false;
- }
- else
- {
- hScrollBar.LargeChange =
DisplayRectangle.Width;
- hScrollBar.SmallChange =
(DisplayRectangle.Width + 9) / 10;
- hScrollBar.Value =
-(autoScrollPosition.X);
- hScrollBar.Maximum = ScrollArea.Width -
1;
- hScrollBar.Visible = hscroll;
+ if( null != hScrollBar ) {
+ hScrollBar.SetBounds(0, rect.Bottom,
rect.Width, hScrollBar.Height);
+ if(DisplayRectangle.Width >=
ScrollArea.Width)
+ {
+ hScrollBar.Visible = false;
+ }
+ else
+ {
+ hScrollBar.LargeChange =
DisplayRectangle.Width;
+ hScrollBar.SmallChange =
(DisplayRectangle.Width + 9) / 10;
+ hScrollBar.Value =
-(autoScrollPosition.X);
+ hScrollBar.Maximum =
ScrollArea.Width - 1;
+ hScrollBar.Visible = hscroll;
+ }
}
}
@@ -408,7 +429,6 @@
private void ScrollByOffset(Size offset)
{
- //Console.WriteLine("Scroll by " + offset);
if(offset.IsEmpty)
{
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnetlib ./ChangeLog System.Windows.Forms/Scroll...,
Heiko Weiss <=