You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
Pages: 1
Topic closed
Hello Jing,
When i resize form and change the size of the grid in sizechanged event of the form it works fine if you are not at bottom of the grid. what happens is there lot of blank space on the bottom of the last cell to end of the grid. If you select one of the cell and move up the grid refreshes and look fine. I tried to do sheet.posfocus, it works but does not go to the top of the grid keeps the same way. I have tried to invalidate both the grid and sheet and does not change it.
Shane
Private Sub frmBvsC_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged
If Application.OpenForms.OfType(Of Form).Contains(Me) Then
'Sets the control height size
If Me.WindowState = FormWindowState.Maximized Then
'768 Pixels height = 581
rgDataGatheringGrid.Height = 581
rgResultsGrid.Height = 581
Else
'600 pixels height = 441
rgDataGatheringGrid.Height = 441
rgResultsGrid.Height = 441
End If
rgDataGatheringSheet.RequestInvalidate()
rgResultsSheet.RequestInvalidate()
rgDataGatheringSheet.FocusPos = New CellPosition(validRange.StartPos.ToAddress)
rgResultsSheet.FocusPos = New CellPosition(validRange2.StartPos.ToAddress)
End If
End Sub
This code in the grids
'Sets the control height size
If Me.WindowState = FormWindowState.Maximized Then
'768 Pixels
.Height = 581
Else
'600 pixels
.Height = 441
End If
Last edited by asparatu (2016-03-18 14:20:09)
Offline
If you want keep worksheet aligned to bottom when your form is resized. You can manually scroll the worksheet to the end. Code like this:
C#:
class MyForm : Form
{
private System.Drawing.Size lastSize;
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
var diff = this.Size - lastSize;
if (diff != this.Size)
{
grid.ScrollCurrentWorksheet(-diff.Width, -diff.Height);
}
this.lastSize = this.Size;
}
}
VB.NET:
Public Class Form4
Private lastSize As Size
Protected Overrides Sub OnLoad(e As EventArgs)
MyBase.OnLoad(e)
grid.ShowScrollEndSpacing = False
End Sub
Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
Dim diff = Me.Size - Me.lastSize
If (diff <> Me.Size) Then
grid.ScrollCurrentWorksheet(-diff.Width, -diff.Height)
End If
Me.lastSize = Me.Size
End Sub
End Class
Last edited by Jingwood (2016-03-19 00:45:38)
Offline
Hello Jing,
Thank you, I will add that to the code.. I see i need to start using the overrides of the events and not use the events handlers to the controls.
Shane
Last edited by asparatu (2016-03-19 03:10:59)
Offline
Hello Jing,
This worked good thank you.. I just adjust the code a little so it would not show halfway in between the cell but other then that it worked good.
Shane
Offline
Pages: 1
Topic closed