private void Form1_Load(object sender, EventArgs e)
{
Random r = new Random();
for (int i = 0; i < 10; i++)
{
fpSpread1.ActiveSheet.SetValue(i, 0, r.Next(1, 99));
}
}
private void fpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
{
// 列ヘッダ(1列目)がクリックされた場合
if (e.ColumnHeader && e.Column == 0)
{
// 既定の動作(列の選択)をキャンセルします。
e.Cancel = true;
// 該当列をソートします。
FarPoint.Win.Spread.SheetView sheet = e.View.Sheets[e.View.ActiveSheetIndex];
if (sheet.GetColumnSortIndicator(e.Column) == FarPoint.Win.Spread.Model.SortIndicator.Ascending)
sheet.SortRows(e.Column, false, true);
else
sheet.SortRows(e.Column, true, true);
}
}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim r As New Random()
For i As Integer = 0 To 9
FpSpread1.ActiveSheet.SetValue(i, 0, r.Next(1, 99))
Next
End Sub
Private Sub FpSpread1_CellClick(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick
' 列ヘッダ(1列目)がクリックされた場合
If e.ColumnHeader And e.Column = 0 Then
' 既定の動作(列の選択)をキャンセルします。
e.Cancel = True
' 該当列をソートします。
Dim sheet As FarPoint.Win.Spread.SheetView = e.View.Sheets(e.View.ActiveSheetIndex)
If sheet.GetColumnSortIndicator(e.Column) = FarPoint.Win.Spread.Model.SortIndicator.Ascending Then
sheet.SortRows(e.Column, False, True)
Else
sheet.SortRows(e.Column, True, True)
End If
End If
End Sub