Dear friends developers.
The property ScrollBars.Vertical or ScrollBars.Horizontal in the DataGridView
control is not working properly.
The horizontal and vertical bar is always visible.
Attached the following changes to correct operation.
Marcelo Marques Inácio
[email protected]
Telefones:
(62) 9969-3839 Celular
CC: [email protected]
From: [email protected]
To: [email protected]
Subject: Re: Bug in DataGridView.ScrollBars
Date: Thu, 19 Feb 2009 08:41:58 -0500
Hello Marcelo,
Would you mind sending this as a patch?
It would be even better if you post this to the
[email protected] for the patch to be reviewed and discussed.
Miguel.
On Feb 18, 2009, at 7:26 PM, Marcelo Marques Inácio wrote:
Dear Miguel;
Sorry, but the correct code for the attribute "scrollbars" is that it was
attached.
thanks
Marcelo Marques Inácio
[email protected]
Telefones:
(62) 9969-3839 Celular
<DataGridView.cs>
_________________________________________________________________
Receba GRÁTIS as mensagens do Messenger no seu celular quando você estiver
offline. Conheça o MSN Mobile!
http://mobile.live.com/signup/signup2.aspx?lc=pt-br//#################################################################
// Atribute ScrollBars
//#################################################################
[DefaultValue (ScrollBars.Both)]
[Localizable (true)]
public ScrollBars ScrollBars
{
get { return scrollBars; }
set
{
if (!Enum.IsDefined(typeof(ScrollBars), value))
{
throw new InvalidEnumArgumentException("Invalid ScrollBars
value.");
}
////////////////////////////////////////////////////////////
/// *** InvalidOperationException ***
/// The System.Windows.Forms.DataGridView is unable to
/// scroll due to a cell change that cannot be committed
/// or canceled.
///////////////////////////////////////////////////////////
scrollBars = value;
if (value == ScrollBars.Vertical | value == ScrollBars.Both)
{
verticalScrollBar.Visible = true;
}
else
{
verticalScrollBar.Visible = false;
}
if (value == ScrollBars.Horizontal | value == ScrollBars.Both)
{
horizontalScrollBar.Visible = true;
}
else
{
horizontalScrollBar.Visible = false;
}
}
}
//#################################################################
// Atribute ScrollBars
//#################################################################
//#################################################################
// Function OnPaint
//#################################################################
...
if (AutoSize) {
if (gridWidth > Size.Width || gridHeight >
Size.Height) {
Size = new Size(gridWidth, gridHeight);
}
}
else {
if (horizontalScrollBar.Visible && gridWidth > Size.Width)
{
horizontalVisible = true;
}
if (verticalScrollBar.Visible && gridHeight > Size.Height)
{
verticalVisible = true;
}
if (verticalScrollBar.Visible && horizontalScrollBar.Visible &&
(gridHeight + horizontalScrollBar.Height) > Size.Height)
{
verticalVisible = true;
}
if (horizontalScrollBar.Visible && verticalScrollBar.Visible &&
(gridWidth + verticalScrollBar.Width) > Size.Width)
{
horizontalVisible = true;
}
if (horizontalVisible) {
horizontalScrollBar.Minimum = 0;
horizontalScrollBar.Maximum = gridWidth;
horizontalScrollBar.SmallChange =
Columns[first_col_index].Width;
int largeChange = ClientSize.Width -
rowHeadersWidth;
if (largeChange <= 0)
largeChange = ClientSize.Width;
horizontalScrollBar.LargeChange =
largeChange;
}
if (verticalVisible) {
verticalScrollBar.Minimum = 0;
verticalScrollBar.Maximum = gridHeight;
verticalScrollBar.SmallChange =
first_row_height + 1;
int largeChange = ClientSize.Height -
columnHeadersHeight;
if (largeChange <= 0)
largeChange = ClientSize.Height;
verticalScrollBar.LargeChange =
largeChange;
}
}
...
//#################################################################
// Function OnPaint
//#################################################################
_______________________________________________
Mono-devel-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-devel-list