Imports Spread.Common.DataStore
Imports FarPoint.Win.Spread
Imports Spread.Common.Features.Spread.Common.Features.Sample


Namespace Features
	Public Partial Class RowColMoving
        Inherits BaseSampleControl
        Private _dataSource As AccessDataSource

		Public Sub New()
			InitializeComponent()
			Name = "Column and Row Moving"

			_dataSource = New DataService().AccessDataSource

			InitSpreadSheet(fpSpread.ActiveSheet)

			AddHandler chkAllowRowMove.CheckedChanged, AddressOf ChkAllowRowMove_CheckedChanged
			AddHandler chkAllowMultiRowMove.CheckedChanged, AddressOf ChkAllowMultiRowMove_CheckedChanged
			AddHandler chkAllowColMove.CheckedChanged, AddressOf ChkAllowColMove_CheckedChanged
			AddHandler chkAllowMultiColumnMove.CheckedChanged, AddressOf ChkAllowMultiColumnMove_CheckedChanged
			AddHandler chkShowMovingDragBand.CheckedChanged, AddressOf ChkShowMovingDragBand_CheckedChanged
		End Sub

		Private Sub InitSpreadSheet(sheet As SheetView)
			sheet.DataSource = _dataSource.GetDataFromTable("fpWine.mdb", "Customers")

			sheet.SetMultipleRowHeights(0, sheet.RowCount, 20)
		End Sub

		#Region "CheckBox Events"
		Private Sub ChkAllowRowMove_CheckedChanged(sender As Object, e As EventArgs)
			fpSpread.AllowRowMove = chkAllowRowMove.Checked
		End Sub

		Private Sub ChkAllowMultiRowMove_CheckedChanged(sender As Object, e As EventArgs)
			fpSpread.AllowRowMoveMultiple = chkAllowMultiRowMove.Checked
		End Sub

		Private Sub ChkAllowColMove_CheckedChanged(sender As Object, e As EventArgs)
			fpSpread.AllowColumnMove = chkAllowColMove.Checked
		End Sub

		Private Sub ChkAllowMultiColumnMove_CheckedChanged(sender As Object, e As EventArgs)
			fpSpread.AllowColumnMoveMultiple = chkAllowMultiColumnMove.Checked
		End Sub

		Private Sub ChkShowMovingDragBand_CheckedChanged(sender As Object, e As EventArgs)
			fpSpread.ShowDragBandOnMoving = chkShowMovingDragBand.Checked
		End Sub
		#End Region
	End Class
End Namespace

'
'RowColMoving.Designer.vb
'

Namespace Features
	Partial Class RowColMoving
		''' <summary> 
		''' Required designer variable.
		''' </summary>
		Private components As System.ComponentModel.IContainer = Nothing

        ''' <summary> 
        ''' Clean up any resources being used.
        ''' </summary>
        ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        Protected Overloads Sub Dispose(disposing As Boolean)
            If disposing AndAlso (components IsNot Nothing) Then
                components.Dispose()
            End If
            MyBase.Dispose(disposing)
        End Sub

#Region "Component Designer generated code"

        ''' <summary> 
        ''' Required method for Designer support - do not modify 
        ''' the contents of this method with the code editor.
        ''' </summary>
        Private Sub InitializeComponent()
			Me.fpSpread = New FarPoint.Win.Spread.FpSpread()
			Me.fpSpread_Sheet1 = New FarPoint.Win.Spread.SheetView()
			Me.GroupBox1 = New System.Windows.Forms.GroupBox()
			Me.chkAllowMultiRowMove = New System.Windows.Forms.CheckBox()
			Me.chkAllowMultiColumnMove = New System.Windows.Forms.CheckBox()
			Me.chkAllowRowMove = New System.Windows.Forms.CheckBox()
			Me.chkAllowColMove = New System.Windows.Forms.CheckBox()
			Me.chkShowMovingDragBand = New System.Windows.Forms.CheckBox()
			Me.pnlMain.SuspendLayout()
			Me.pnlControls.SuspendLayout()
			DirectCast(Me.fpSpread, System.ComponentModel.ISupportInitialize).BeginInit()
			DirectCast(Me.fpSpread_Sheet1, System.ComponentModel.ISupportInitialize).BeginInit()
			Me.GroupBox1.SuspendLayout()
			Me.SuspendLayout()
			' 
			' pnlMain
			' 
			Me.pnlMain.Controls.Add(Me.fpSpread)
			Me.pnlMain.Size = New System.Drawing.Size(490, 487)
			' 
			' pnlControls
			' 
			Me.pnlControls.Controls.Add(Me.chkShowMovingDragBand)
			Me.pnlControls.Controls.Add(Me.GroupBox1)
			Me.pnlControls.Size = New System.Drawing.Size(162, 487)
			' 
			' fpSpread
			' 
			Me.fpSpread.Dock = System.Windows.Forms.DockStyle.Fill
			Me.fpSpread.Location = New System.Drawing.Point(0, 0)
			Me.fpSpread.Name = "fpSpread"
			Me.fpSpread.Sheets.AddRange(New FarPoint.Win.Spread.SheetView() {Me.fpSpread_Sheet1})
			Me.fpSpread.Size = New System.Drawing.Size(490, 487)
			Me.fpSpread.Skin = FarPoint.Win.Spread.DefaultSpreadSkins.Office2016White
			Me.fpSpread.StatusBarVisible = True
			Me.fpSpread.TabIndex = 0
			' 
			' fpSpread_Sheet1
			' 
			Me.fpSpread_Sheet1.Reset()
			Me.fpSpread_Sheet1.SheetName = "Sheet1"
			' Formulas and custom names must be loaded with R1C1 reference style
			Me.fpSpread_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1
			Me.fpSpread_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1
			' 
			' GroupBox1
			' 
			Me.GroupBox1.Controls.Add(Me.chkAllowMultiRowMove)
			Me.GroupBox1.Controls.Add(Me.chkAllowMultiColumnMove)
			Me.GroupBox1.Controls.Add(Me.chkAllowRowMove)
			Me.GroupBox1.Controls.Add(Me.chkAllowColMove)
			Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Top
			Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
			Me.GroupBox1.Margin = New System.Windows.Forms.Padding(2)
			Me.GroupBox1.Name = "GroupBox1"
			Me.GroupBox1.Padding = New System.Windows.Forms.Padding(2)
			Me.GroupBox1.Size = New System.Drawing.Size(162, 145)
			Me.GroupBox1.TabIndex = 26
			Me.GroupBox1.TabStop = False
			Me.GroupBox1.Text = "Move Rows/Columns"
			' 
			' chkAllowMultiRowMove
			' 
			Me.chkAllowMultiRowMove.Location = New System.Drawing.Point(8, 49)
			Me.chkAllowMultiRowMove.Margin = New System.Windows.Forms.Padding(2)
			Me.chkAllowMultiRowMove.Name = "chkAllowMultiRowMove"
			Me.chkAllowMultiRowMove.Size = New System.Drawing.Size(155, 23)
			Me.chkAllowMultiRowMove.TabIndex = 19
			Me.chkAllowMultiRowMove.Text = "Allow Multiple Row Move"
			' 
			' chkAllowMultiColumnMove
			' 
			Me.chkAllowMultiColumnMove.Location = New System.Drawing.Point(8, 103)
			Me.chkAllowMultiColumnMove.Margin = New System.Windows.Forms.Padding(2)
			Me.chkAllowMultiColumnMove.Name = "chkAllowMultiColumnMove"
			Me.chkAllowMultiColumnMove.Size = New System.Drawing.Size(168, 23)
			Me.chkAllowMultiColumnMove.TabIndex = 18
			Me.chkAllowMultiColumnMove.Text = "Allow Mulitple Column Move"
			' 
			' chkAllowRowMove
			' 
			Me.chkAllowRowMove.Location = New System.Drawing.Point(8, 23)
			Me.chkAllowRowMove.Margin = New System.Windows.Forms.Padding(2)
			Me.chkAllowRowMove.Name = "chkAllowRowMove"
			Me.chkAllowRowMove.Size = New System.Drawing.Size(108, 22)
			Me.chkAllowRowMove.TabIndex = 16
			Me.chkAllowRowMove.Text = "Allow Row Move"
			' 
			' chkAllowColMove
			' 
			Me.chkAllowColMove.Location = New System.Drawing.Point(8, 76)
			Me.chkAllowColMove.Margin = New System.Windows.Forms.Padding(2)
			Me.chkAllowColMove.Name = "chkAllowColMove"
			Me.chkAllowColMove.Size = New System.Drawing.Size(130, 23)
			Me.chkAllowColMove.TabIndex = 17
			Me.chkAllowColMove.Text = "Allow Column Move"
			' 
			' chkShowMovingDragBand
			' 
			Me.chkShowMovingDragBand.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
			Me.chkShowMovingDragBand.Checked = True
			Me.chkShowMovingDragBand.CheckState = System.Windows.Forms.CheckState.Checked
			Me.chkShowMovingDragBand.Location = New System.Drawing.Point(8, 159)
			Me.chkShowMovingDragBand.Margin = New System.Windows.Forms.Padding(2)
			Me.chkShowMovingDragBand.Name = "chkShowMovingDragBand"
			Me.chkShowMovingDragBand.Size = New System.Drawing.Size(154, 36)
			Me.chkShowMovingDragBand.TabIndex = 27
			Me.chkShowMovingDragBand.Text = "Show Drag Band On Moving"
			' 
			' RowColMoving
			' 
			Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
			Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
			Me.Name = "RowColMoving"
			Me.Size = New System.Drawing.Size(653, 487)
			Me.pnlMain.ResumeLayout(False)
			Me.pnlControls.ResumeLayout(False)
			DirectCast(Me.fpSpread, System.ComponentModel.ISupportInitialize).EndInit()
			DirectCast(Me.fpSpread_Sheet1, System.ComponentModel.ISupportInitialize).EndInit()
			Me.GroupBox1.ResumeLayout(False)
			Me.ResumeLayout(False)

		End Sub

		#End Region

		Private fpSpread As FarPoint.Win.Spread.FpSpread
		Private fpSpread_Sheet1 As FarPoint.Win.Spread.SheetView
		Friend GroupBox1 As System.Windows.Forms.GroupBox
		Friend chkAllowMultiRowMove As System.Windows.Forms.CheckBox
		Friend chkAllowMultiColumnMove As System.Windows.Forms.CheckBox
		Friend chkAllowRowMove As System.Windows.Forms.CheckBox
		Friend chkAllowColMove As System.Windows.Forms.CheckBox
		Friend chkShowMovingDragBand As System.Windows.Forms.CheckBox
	End Class
End Namespace
