Spread Windows Forms 9.0 Product Documentation
Restrict Property
Example 


Gets or sets whether to allow the sheet to be moved to the ToSheetIndex location.
Syntax
'Declaration
 
Public Property Restrict As Boolean
'Usage
 
Dim instance As SheetDragMovingEventArgs
Dim value As Boolean
 
instance.Restrict = value
 
value = instance.Restrict
public bool Restrict {get; set;}
Example
This example prevents dragging the sheet to sheet 2.
fpSpread1.AllowSheetMove = true;
fpSpread1.Sheets.Count = 3;
fpSpread1.Sheets[0].RowCount = 10;
fpSpread1.Sheets[0].ColumnCount = 10;
fpSpread1.Sheets[1].RowCount = 10;
fpSpread1.Sheets[1].ColumnCount = 10;
fpSpread1.Sheets[2].RowCount = 10;
fpSpread1.Sheets[2].ColumnCount = 10;
fpSpread1.Sheets[0].SetClip(0, 0, 3, 3, "Sunday\tMonday\tTuesday\r\nWednesday\tThursday\tFriday\r\nSaturday\tSunday\tMonday");
fpSpread1.Sheets[1].SetClip(0, 0, 3, 3, "January\tFebruary\tMarch\r\nApril\tMay\tJune\r\nJuly\tAugust\tSeptember");
fpSpread1.Sheets[2].SetClip(0, 0, 3, 3, "2012\t2013\t2014\r\n2015\t2016\t2017\r\n2018\t2019\t2020");

private void fpSpread1_SheetDragMoving(object sender, FarPoint.Win.Spread.SheetDragMovingEventArgs e)
{
    if (e.ToSheetIndex == 2)
        {
        e.Restrict = true;
        }
FpSpread1.AllowSheetMove = True
FpSpread1.Sheets.Count = 3
FpSpread1.Sheets(0).RowCount = 10
FpSpread1.Sheets(0).ColumnCount = 10
FpSpread1.Sheets(1).RowCount = 10
FpSpread1.Sheets(1).ColumnCount = 10
FpSpread1.Sheets(2).RowCount = 10
FpSpread1.Sheets(2).ColumnCount = 10
FpSpread1.Sheets(0).SetClip(0, 0, 3, 3, "Sunday" + Chr(9) + "Monday" + Chr(9) + "Tuesday" + vbCrLf + "Wednesday" + Chr(9) + "Thursday" + Chr(9) + "Friday" + vbCrLf + "Saturday" + Chr(9) + "Sunday" + Chr(9) + "Monday")
FpSpread1.Sheets(1).SetClip(0, 0, 3, 3, "January" + Chr(9) + "February" + Chr(9) + "March" + vbCrLf + "April" + Chr(9) + "May" + Chr(9) + "June" + vbCrLf + "July" + Chr(9) + "August" + Chr(9) + "September")
FpSpread1.Sheets(2).SetClip(0, 0, 3, 3, "2012" + Chr(9) + "2013" + Chr(9) + "2014" + vbCrLf + "2015" + Chr(9) + "2016" + Chr(9) + "2017" + vbCrLf + "2018" + Chr(9) + "2019" + Chr(9) + "2020")

Private Sub FpSpread1_SheetDragMoving(sender As Object, e As FarPoint.Win.Spread.SheetDragMovingEventArgs) Handles FpSpread1.SheetDragMoving
  If e.ToSheetIndex = 2 Then
      e.Restrict = True
  End If
End Sub
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

SheetDragMovingEventArgs Class
SheetDragMovingEventArgs Members

 

 


Copyright © GrapeCity, inc. All rights reserved.