Imports System.Drawing
Imports System.Windows.Forms
Imports FarPoint.Win.Spread.DrawingSpace
Imports FarPoint.Win
Imports FarPoint.Win.Spread
Imports Spread.Common.Features.Spread.Common.Features.Sample
Imports Spread.FloatingObjects.Spread.FloatingObjects

Namespace Features
    Partial Public Class ImagesAndShapes
        Inherits BaseSampleControl
        Private Const WIDTH As Integer = 100
        Private Const HEIGHT As Integer = 60

        Public Sub New()
            InitializeComponent()
            Name = "Images and Shapes"

            InitControls()
            InitSpreadSheet(fpSpread.ActiveSheet)

            AddHandler shapePanel1.ShapeSelected, AddressOf ShapePanel1_ShapeSelected

            AddHandler fpSpread.ShapeDeactivated, AddressOf FpSpread_ShapeDeactivated
            AddHandler fpSpread.ShapeActivated, AddressOf FpSpread_ShapeActivated
        End Sub

#Region "Private methods"
        Private Sub InitSpreadSheet(sheet As SheetView)
            sheet.SetMultipleRowHeights(0, fpSpread.ActiveSheet.RowCount, 20)

            Dim shape1 As New RectangleShape()
            shape1.Size = New Size(WIDTH, HEIGHT)
            shape1.BackgroundImage = New Picture(Image.FromFile("Resources\splogo.png"))
            shape1.BackgroundImage.Style = RenderStyle.StretchAndScale

            Dim shape2 As New RectangleShape()
            shape2.Size = New Size(WIDTH, HEIGHT)

            sheet.AddShape(shape1, 3, 2)
            sheet.AddShape(shape2, 3, 6)
        End Sub

        Private Sub InitControls()
            Controls.Add(shapePanel1)
            shapePanel1.BringToFront()

            comboOutlineStyle.DataSource = [Enum].GetValues(GetType(System.Drawing.Drawing2D.DashStyle))
            comboDropShadow.DataSource = [Enum].GetValues(GetType(ShadowDirection))

            AddHandler btnPicture.Click, AddressOf BtnPicture_Click
            AddHandler btnShape.Click, AddressOf BtnShape_Click

            AddHandler btnBackColor.Click, AddressOf BtnBackColor_Click
            AddHandler btnForeColor.Click, AddressOf BtnForeColor_Click
            AddHandler btnOutlineColor.Click, AddressOf BtnOutlineColor_Click

            AddHandler btnSetPicture.Click, AddressOf BtnSetPicture_Click
            AddHandler btnBringToFront.Click, AddressOf BtnBringToFront_Click
            AddHandler btnSendToBack.Click, AddressOf BtnSendToBack_Click

            AddHandler numericRotate.ValueChanged, AddressOf NumericRotate_ValueChanged
            AddHandler numericScale.ValueChanged, AddressOf NumericScale_ValueChanged
        End Sub

        Private Sub ShowColorPicker(button As Button)
            Dim dialog As New ColorDialog()
            dialog.Color = button.BackColor

            If dialog.ShowDialog() = DialogResult.OK Then
                button.BackColor = dialog.Color
            End If
        End Sub

        Private Sub ToggleShapeControls(enable As Boolean)
            btnBackColor.Enabled = enable
            btnForeColor.Enabled = enable
            btnOutlineColor.Enabled = enable
            numericThickness.Enabled = enable
            comboOutlineStyle.Enabled = enable
            comboDropShadow.Enabled = enable
            btnBringToFront.Enabled = enable
            btnSendToBack.Enabled = enable
            btnSetPicture.Enabled = enable

            chkRotate.Enabled = enable
            chkHorizontalFlip.Enabled = enable
            chkVerticalFlip.Enabled = enable
            chkScale.Enabled = enable

            If Not enable Then
                numericRotate.Enabled = False
                numericScale.Enabled = False
            Else
                numericRotate.Enabled = chkRotate.Checked
                numericScale.Enabled = chkScale.Checked
            End If
        End Sub

        Private Function GetImageUsingFileDialog() As Image
            Dim dialog As New OpenFileDialog()
            dialog.CheckFileExists = True
            dialog.CheckPathExists = True
            dialog.Multiselect = False
            dialog.Filter = "Images|*.jpeg;*.jpg;*.png;*.bmp"

            Dim image__1 As Image = Nothing
            If dialog.ShowDialog() = DialogResult.OK Then
                Try
                    image__1 = Image.FromFile(dialog.FileName)
                Catch ex As Exception
                    MessageBox.Show(ex.Message, "Error loading image", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                End Try
            End If

            Return image__1
        End Function

        Private Sub ScaleShape(shape As PSShape, scaleFactor As Single)
            fpSpread.SuspendLayout()
            Dim scaleX As Single = scaleFactor * (CSng(WIDTH) / shape.Width)
            Dim scaleY As Single = scaleFactor * (CSng(HEIGHT) / shape.Height)
            shape.Scale(scaleX, scaleY, True)
            fpSpread.ResumeLayout(True)
        End Sub

        Private Sub RotateShape(shape As PSShape, angle As Integer)
            Dim center As New Point(shape.Left + shape.Width \ 2, shape.Top + shape.Height \ 2)
            shape.Rotate(center, -shape.RotationAngle)
            If chkRotate.Checked Then
                shape.Rotate(center, angle)
            End If
        End Sub
#End Region

#Region "Event handlers"
        Private Sub FpSpread_ShapeActivated(sender As Object, e As EventArgs)
            Dim shape As PSShape = TryCast(fpSpread.ActiveWindowlessObject, PSShape)

            btnBackColor.BackColor = shape.BackColor
            btnForeColor.BackColor = shape.ForeColor
            btnOutlineColor.BackColor = shape.ShapeOutlineColor
            numericThickness.Value = CDec(shape.ShapeOutlineThickness)
            comboOutlineStyle.SelectedItem = shape.ShapeOutlineStyle
            comboDropShadow.SelectedItem = shape.ShadowDirection
            chkHorizontalFlip.Checked = shape.FlipHorizontal
            chkVerticalFlip.Checked = shape.FlipVertical
            numericRotate.Value = CDec(shape.RotationAngle)
            chkRotate.Checked = numericRotate.Value <> 0
            chkScale.Checked = False

            ToggleShapeControls(True)

            AddHandler comboOutlineStyle.SelectedIndexChanged, AddressOf ComboOutlineStyle_SelectedIndexChanged
            AddHandler comboDropShadow.SelectedIndexChanged, AddressOf ComboDropShadow_SelectedIndexChanged
            AddHandler numericThickness.ValueChanged, AddressOf NumericThickness_ValueChanged
            AddHandler btnBackColor.BackColorChanged, AddressOf BtnBackColor_BackColorChanged
            AddHandler btnForeColor.BackColorChanged, AddressOf BtnForeColor_BackColorChanged
            AddHandler btnOutlineColor.BackColorChanged, AddressOf BtnOutlineColor_BackColorChanged

            AddHandler chkRotate.CheckedChanged, AddressOf ChkRotate_CheckedChanged
            AddHandler chkHorizontalFlip.CheckedChanged, AddressOf ChkHorizontalFlip_CheckedChanged
            AddHandler chkVerticalFlip.CheckedChanged, AddressOf ChkVerticalFlip_CheckedChanged
            AddHandler chkScale.CheckedChanged, AddressOf ChkScale_CheckedChanged
        End Sub

        Private Sub FpSpread_ShapeDeactivated(sender As Object, e As EventArgs)
            ToggleShapeControls(False)

            RemoveHandler comboOutlineStyle.SelectedIndexChanged, AddressOf ComboOutlineStyle_SelectedIndexChanged
            RemoveHandler comboDropShadow.SelectedIndexChanged, AddressOf ComboDropShadow_SelectedIndexChanged
            RemoveHandler numericThickness.ValueChanged, AddressOf NumericThickness_ValueChanged
            RemoveHandler btnBackColor.BackColorChanged, AddressOf BtnBackColor_BackColorChanged
            RemoveHandler btnForeColor.BackColorChanged, AddressOf BtnForeColor_BackColorChanged
            RemoveHandler btnOutlineColor.BackColorChanged, AddressOf BtnOutlineColor_BackColorChanged

            RemoveHandler chkHorizontalFlip.CheckedChanged, AddressOf ChkHorizontalFlip_CheckedChanged
            RemoveHandler chkVerticalFlip.CheckedChanged, AddressOf ChkVerticalFlip_CheckedChanged
            RemoveHandler chkRotate.CheckedChanged, AddressOf ChkRotate_CheckedChanged
            RemoveHandler chkScale.CheckedChanged, AddressOf ChkScale_CheckedChanged

            chkRotate.Checked = False
            numericRotate.Value = 0
            chkScale.Checked = False
            numericScale.Value = 100
        End Sub

        Private Sub ShapePanel1_ShapeSelected(sender As Object, e As ShapeSelectedEventArgs)
            Dim shape As PSShape = ShapeActions.CreateShapeInstance(e.ShapeName)
            shape.Size = New Size(WIDTH, HEIGHT)
            fpSpread.ActiveSheet.AddShape(shape, fpSpread.ActiveSheet.ActiveRowIndex, fpSpread.ActiveSheet.ActiveColumnIndex)
        End Sub

#Region "CheckBox events"
        Private Sub ChkVerticalFlip_CheckedChanged(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).FlipVertical = chkVerticalFlip.Checked
        End Sub

        Private Sub ChkHorizontalFlip_CheckedChanged(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).FlipHorizontal = chkHorizontalFlip.Checked
        End Sub

        Private Sub ChkRotate_CheckedChanged(sender As Object, e As EventArgs)
            numericRotate.Enabled = chkRotate.Checked
            Dim shape As PSShape = TryCast(fpSpread.ActiveWindowlessObject, PSShape)
            RotateShape(shape, CInt(Math.Truncate(numericRotate.Value)))
        End Sub

        Private Sub ChkScale_CheckedChanged(sender As Object, e As EventArgs)
            numericScale.Enabled = chkScale.Checked
            Dim shape As PSShape = TryCast(fpSpread.ActiveWindowlessObject, PSShape)

            If chkScale.Checked Then
                ScaleShape(shape, CSng(numericScale.Value) / 100)
            Else
                shape.Size = New Size(WIDTH, HEIGHT)
            End If
        End Sub
#End Region

#Region "Button events"
        Private Sub BtnShape_Click(sender As Object, e As EventArgs)
            Dim screenPoint As Point = groupBox1.PointToScreen(New Point(btnShape.Right, btnShape.Bottom + 3))
            shapePanel1.Location = PointToClient(New Point(screenPoint.X - shapePanel1.Width, screenPoint.Y))
            shapePanel1.Visible = True
            shapePanel1.BringToFront()
        End Sub

        Private Sub BtnPicture_Click(sender As Object, e As EventArgs)
            Dim image As Image = GetImageUsingFileDialog()
            If image Is Nothing Then
                Return
            End If

            Dim shape As New RectangleShape()
            shape.BackgroundImage = New Picture(image)
            shape.BackgroundImage.Style = RenderStyle.Normal
            Dim rect As Rectangle = fpSpread.GetCellRectangle(0, 0, fpSpread.ActiveSheet.ActiveRowIndex, fpSpread.ActiveSheet.ActiveColumnIndex)
            shape.Location = rect.Location
            shape.Size = image.Size
            fpSpread.ActiveSheet.DrawingContainer.ContainedObjects.Add(shape)
        End Sub

        Private Sub BtnBackColor_Click(sender As Object, e As EventArgs)
            ShowColorPicker(TryCast(sender, Button))
        End Sub

        Private Sub BtnForeColor_Click(sender As Object, e As EventArgs)
            ShowColorPicker(TryCast(sender, Button))
        End Sub

        Private Sub BtnOutlineColor_Click(sender As Object, e As EventArgs)
            ShowColorPicker(TryCast(sender, Button))
        End Sub

        Private Sub BtnSetPicture_Click(sender As Object, e As EventArgs)
            Dim image As Image = GetImageUsingFileDialog()
            If image Is Nothing Then
                Return
            End If

            TryCast(fpSpread.ActiveWindowlessObject, PSShape).Picture = image
        End Sub

        Private Sub BtnSendToBack_Click(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).SendToBack(fpSpread.ActiveWindowlessObject)
        End Sub

        Private Sub BtnBringToFront_Click(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).BringToFront(fpSpread.ActiveWindowlessObject)
        End Sub

        Private Sub BtnOutlineColor_BackColorChanged(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).ShapeOutlineColor = btnOutlineColor.BackColor
        End Sub

        Private Sub BtnForeColor_BackColorChanged(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).BackColor = btnForeColor.BackColor
        End Sub

        Private Sub BtnBackColor_BackColorChanged(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).BackColor = btnBackColor.BackColor
        End Sub
#End Region

#Region "ComboBox events"
        Private Sub ComboDropShadow_SelectedIndexChanged(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).ShadowDirection = CType(comboDropShadow.SelectedItem, ShadowDirection)
        End Sub

        Private Sub ComboOutlineStyle_SelectedIndexChanged(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).ShapeOutlineStyle = CType(comboOutlineStyle.SelectedItem, System.Drawing.Drawing2D.DashStyle)
        End Sub
#End Region

#Region "NumericTextBox Events"
        Private Sub NumericThickness_ValueChanged(sender As Object, e As EventArgs)
            TryCast(fpSpread.ActiveWindowlessObject, PSShape).ShapeOutlineThickness = CSng(numericThickness.Value)
        End Sub

        Private Sub NumericScale_ValueChanged(sender As Object, e As EventArgs)
            Dim shape As PSShape = TryCast(fpSpread.ActiveWindowlessObject, PSShape)
            If shape Is Nothing Then
                Return
            End If
            ScaleShape(shape, CSng(numericScale.Value) / 100)
        End Sub

        Private Sub NumericRotate_ValueChanged(sender As Object, e As EventArgs)
            Dim shape As PSShape = TryCast(fpSpread.ActiveWindowlessObject, PSShape)
            If shape Is Nothing Then
                Return
            End If
            Dim center As New Point(shape.Left + shape.Width \ 2, shape.Top + shape.Height \ 2)
            fpSpread.SuspendLayout()
            shape.Rotate(center, -shape.RotationAngle)
            shape.Rotate(center, CSng(numericRotate.Value))
            fpSpread.ResumeLayout(False)
        End Sub
#End Region

#End Region

        Private Sub groupBox2_Enter(sender As Object, e As EventArgs)

        End Sub
    End Class
End Namespace

'
'ImagesAndShapes.Designer.vb
'

Imports Spread.FloatingObjects.Spread.FloatingObjects

Namespace Features
    Partial Class ImagesAndShapes
        ''' <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()
            Dim resources As New System.ComponentModel.ComponentResourceManager(GetType(ImagesAndShapes))
            Me.fpSpread = New FarPoint.Win.Spread.FpSpread()
            Me.fpSpread_Sheet1 = New FarPoint.Win.Spread.SheetView()
            Me.groupBox1 = New System.Windows.Forms.GroupBox()
            Me.btnShape = New System.Windows.Forms.Button()
            Me.btnPicture = New System.Windows.Forms.Button()
            Me.shapePanel1 = New Spread.FloatingObjects.ShapePanel()
            Me.groupBox2 = New System.Windows.Forms.GroupBox()
            Me.btnSetPicture = New System.Windows.Forms.Button()
            Me.comboDropShadow = New System.Windows.Forms.ComboBox()
            Me.comboOutlineStyle = New System.Windows.Forms.ComboBox()
            Me.numericThickness = New System.Windows.Forms.NumericUpDown()
            Me.label6 = New System.Windows.Forms.Label()
            Me.label5 = New System.Windows.Forms.Label()
            Me.label4 = New System.Windows.Forms.Label()
            Me.btnOutlineColor = New System.Windows.Forms.Button()
            Me.btnForeColor = New System.Windows.Forms.Button()
            Me.btnBackColor = New System.Windows.Forms.Button()
            Me.label3 = New System.Windows.Forms.Label()
            Me.label2 = New System.Windows.Forms.Label()
            Me.label1 = New System.Windows.Forms.Label()
            Me.groupBox3 = New System.Windows.Forms.GroupBox()
            Me.numericScale = New System.Windows.Forms.NumericUpDown()
            Me.numericRotate = New System.Windows.Forms.NumericUpDown()
            Me.chkScale = New System.Windows.Forms.CheckBox()
            Me.chkRotate = New System.Windows.Forms.CheckBox()
            Me.chkVerticalFlip = New System.Windows.Forms.CheckBox()
            Me.chkHorizontalFlip = New System.Windows.Forms.CheckBox()
            Me.tableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
            Me.btnBringToFront = New System.Windows.Forms.Button()
            Me.btnSendToBack = New System.Windows.Forms.Button()
            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.groupBox2.SuspendLayout()
            DirectCast(Me.numericThickness, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.groupBox3.SuspendLayout()
            DirectCast(Me.numericScale, System.ComponentModel.ISupportInitialize).BeginInit()
            DirectCast(Me.numericRotate, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.tableLayoutPanel1.SuspendLayout()
            Me.SuspendLayout()
            ' 
            ' pnlMain
            ' 
            Me.pnlMain.Controls.Add(Me.fpSpread)
            Me.pnlMain.Size = New System.Drawing.Size(477, 538)
            ' 
            ' pnlControls
            ' 
            Me.pnlControls.AutoScroll = True
            Me.pnlControls.Controls.Add(Me.groupBox3)
            Me.pnlControls.Controls.Add(Me.groupBox2)
            Me.pnlControls.Controls.Add(Me.groupBox1)
            Me.pnlControls.Size = New System.Drawing.Size(157, 538)
            ' 
            ' fpSpread
            ' 
            Me.fpSpread.AccessibleDescription = ""
            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(477, 538)
            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.ColumnFooter.DefaultStyle.BackColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.ColumnFooter.DefaultStyle.ForeColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.ColumnFooterSheetCornerStyle.BackColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.ColumnFooterSheetCornerStyle.ForeColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.ColumnHeader.DefaultStyle.BackColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.ColumnHeader.DefaultStyle.ForeColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.FilterBarHeaderStyle.BackColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.FilterBarHeaderStyle.ForeColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.RowHeader.DefaultStyle.BackColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.RowHeader.DefaultStyle.ForeColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.Range
            Me.fpSpread_Sheet1.SheetCornerStyle.BackColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.SheetCornerStyle.ForeColor = System.Drawing.Color.Empty
            Me.fpSpread_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1
            ' 
            ' groupBox1
            ' 
            Me.groupBox1.Controls.Add(Me.btnShape)
            Me.groupBox1.Controls.Add(Me.btnPicture)
            Me.groupBox1.Dock = System.Windows.Forms.DockStyle.Top
            Me.groupBox1.Location = New System.Drawing.Point(0, 0)
            Me.groupBox1.Name = "groupBox1"
            Me.groupBox1.Size = New System.Drawing.Size(157, 88)
            Me.groupBox1.TabIndex = 0
            Me.groupBox1.TabStop = False
            Me.groupBox1.Text = "Insert Shape/Image"
            ' 
            ' btnShape
            ' 
            Me.btnShape.Image = DirectCast(resources.GetObject("btnShape.Image"), System.Drawing.Image)
            Me.btnShape.Location = New System.Drawing.Point(71, 19)
            Me.btnShape.Name = "btnShape"
            Me.btnShape.Size = New System.Drawing.Size(53, 59)
            Me.btnShape.TabIndex = 1
            Me.btnShape.Text = "Shape"
            Me.btnShape.TextAlign = System.Drawing.ContentAlignment.BottomCenter
            Me.btnShape.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
            Me.btnShape.UseVisualStyleBackColor = False
            ' 
            ' btnPicture
            ' 
            Me.btnPicture.Image = DirectCast(resources.GetObject("btnPicture.Image"), System.Drawing.Image)
            Me.btnPicture.Location = New System.Drawing.Point(6, 19)
            Me.btnPicture.Name = "btnPicture"
            Me.btnPicture.Size = New System.Drawing.Size(57, 59)
            Me.btnPicture.TabIndex = 0
            Me.btnPicture.Text = "Picture"
            Me.btnPicture.TextAlign = System.Drawing.ContentAlignment.BottomCenter
            Me.btnPicture.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
            Me.btnPicture.UseVisualStyleBackColor = False
            ' 
            ' shapePanel1
            ' 
            Me.shapePanel1.Location = New System.Drawing.Point(-86, 84)
            Me.shapePanel1.Name = "shapePanel1"
            Me.shapePanel1.Size = New System.Drawing.Size(210, 180)
            Me.shapePanel1.TabIndex = 2
            Me.shapePanel1.Visible = False
            ' 
            ' groupBox2
            ' 
            Me.groupBox2.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.groupBox2.Controls.Add(Me.btnSetPicture)
            Me.groupBox2.Controls.Add(Me.comboDropShadow)
            Me.groupBox2.Controls.Add(Me.comboOutlineStyle)
            Me.groupBox2.Controls.Add(Me.numericThickness)
            Me.groupBox2.Controls.Add(Me.label6)
            Me.groupBox2.Controls.Add(Me.label5)
            Me.groupBox2.Controls.Add(Me.label4)
            Me.groupBox2.Controls.Add(Me.btnOutlineColor)
            Me.groupBox2.Controls.Add(Me.btnForeColor)
            Me.groupBox2.Controls.Add(Me.btnBackColor)
            Me.groupBox2.Controls.Add(Me.label3)
            Me.groupBox2.Controls.Add(Me.label2)
            Me.groupBox2.Controls.Add(Me.label1)
            Me.groupBox2.Location = New System.Drawing.Point(0, 91)
            Me.groupBox2.Name = "groupBox2"
            Me.groupBox2.Size = New System.Drawing.Size(157, 271)
            Me.groupBox2.TabIndex = 1
            Me.groupBox2.TabStop = False
            Me.groupBox2.Text = "Shape Style"
            AddHandler Me.groupBox2.Enter, New System.EventHandler(AddressOf Me.groupBox2_Enter)
            ' 
            ' btnSetPicture
            ' 
            Me.btnSetPicture.Enabled = False
            Me.btnSetPicture.Image = DirectCast(resources.GetObject("btnSetPicture.Image"), System.Drawing.Image)
            Me.btnSetPicture.Location = New System.Drawing.Point(9, 201)
            Me.btnSetPicture.Name = "btnSetPicture"
            Me.btnSetPicture.Size = New System.Drawing.Size(69, 59)
            Me.btnSetPicture.TabIndex = 8
            Me.btnSetPicture.Text = "Set Picture"
            Me.btnSetPicture.TextAlign = System.Drawing.ContentAlignment.BottomCenter
            Me.btnSetPicture.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
            Me.btnSetPicture.UseVisualStyleBackColor = False
            ' 
            ' comboDropShadow
            ' 
            Me.comboDropShadow.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.comboDropShadow.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
            Me.comboDropShadow.Enabled = False
            Me.comboDropShadow.FormattingEnabled = True
            Me.comboDropShadow.Location = New System.Drawing.Point(84, 167)
            Me.comboDropShadow.Name = "comboDropShadow"
            Me.comboDropShadow.Size = New System.Drawing.Size(67, 21)
            Me.comboDropShadow.TabIndex = 7
            ' 
            ' comboOutlineStyle
            ' 
            Me.comboOutlineStyle.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.comboOutlineStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
            Me.comboOutlineStyle.Enabled = False
            Me.comboOutlineStyle.FormattingEnabled = True
            Me.comboOutlineStyle.Location = New System.Drawing.Point(84, 137)
            Me.comboOutlineStyle.Name = "comboOutlineStyle"
            Me.comboOutlineStyle.Size = New System.Drawing.Size(67, 21)
            Me.comboOutlineStyle.TabIndex = 6
            ' 
            ' numericThickness
            ' 
            Me.numericThickness.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.numericThickness.Enabled = False
            Me.numericThickness.Location = New System.Drawing.Point(84, 109)
            Me.numericThickness.Name = "numericThickness"
            Me.numericThickness.Size = New System.Drawing.Size(67, 20)
            Me.numericThickness.TabIndex = 5
            ' 
            ' label6
            ' 
            Me.label6.AutoSize = True
            Me.label6.Location = New System.Drawing.Point(6, 170)
            Me.label6.Name = "label6"
            Me.label6.Size = New System.Drawing.Size(72, 13)
            Me.label6.TabIndex = 4
            Me.label6.Text = "DropShadow:"
            ' 
            ' label5
            ' 
            Me.label5.AutoSize = True
            Me.label5.Location = New System.Drawing.Point(6, 140)
            Me.label5.Name = "label5"
            Me.label5.Size = New System.Drawing.Size(69, 13)
            Me.label5.TabIndex = 3
            Me.label5.Text = "Outline Style:"
            ' 
            ' label4
            ' 
            Me.label4.AutoSize = True
            Me.label4.Location = New System.Drawing.Point(6, 111)
            Me.label4.Name = "label4"
            Me.label4.Size = New System.Drawing.Size(59, 13)
            Me.label4.TabIndex = 2
            Me.label4.Text = "Thickness:"
            ' 
            ' btnOutlineColor
            ' 
            Me.btnOutlineColor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.btnOutlineColor.Enabled = False
            Me.btnOutlineColor.Location = New System.Drawing.Point(84, 77)
            Me.btnOutlineColor.Name = "btnOutlineColor"
            Me.btnOutlineColor.Size = New System.Drawing.Size(67, 23)
            Me.btnOutlineColor.TabIndex = 1
            Me.btnOutlineColor.UseVisualStyleBackColor = True
            ' 
            ' btnForeColor
            ' 
            Me.btnForeColor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.btnForeColor.Enabled = False
            Me.btnForeColor.Location = New System.Drawing.Point(84, 50)
            Me.btnForeColor.Name = "btnForeColor"
            Me.btnForeColor.Size = New System.Drawing.Size(67, 23)
            Me.btnForeColor.TabIndex = 1
            Me.btnForeColor.UseVisualStyleBackColor = True
            ' 
            ' btnBackColor
            ' 
            Me.btnBackColor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.btnBackColor.Enabled = False
            Me.btnBackColor.Location = New System.Drawing.Point(84, 22)
            Me.btnBackColor.Name = "btnBackColor"
            Me.btnBackColor.Size = New System.Drawing.Size(67, 23)
            Me.btnBackColor.TabIndex = 1
            Me.btnBackColor.UseVisualStyleBackColor = True
            ' 
            ' label3
            ' 
            Me.label3.AutoSize = True
            Me.label3.Location = New System.Drawing.Point(5, 82)
            Me.label3.Name = "label3"
            Me.label3.Size = New System.Drawing.Size(70, 13)
            Me.label3.TabIndex = 0
            Me.label3.Text = "Outline Color:"
            ' 
            ' label2
            ' 
            Me.label2.AutoSize = True
            Me.label2.Location = New System.Drawing.Point(5, 55)
            Me.label2.Name = "label2"
            Me.label2.Size = New System.Drawing.Size(58, 13)
            Me.label2.TabIndex = 0
            Me.label2.Text = "Fore Color:"
            ' 
            ' label1
            ' 
            Me.label1.AutoSize = True
            Me.label1.Location = New System.Drawing.Point(6, 27)
            Me.label1.Name = "label1"
            Me.label1.Size = New System.Drawing.Size(62, 13)
            Me.label1.TabIndex = 0
            Me.label1.Text = "Back Color:"
            ' 
            ' groupBox3
            ' 
            Me.groupBox3.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.groupBox3.Controls.Add(Me.numericScale)
            Me.groupBox3.Controls.Add(Me.numericRotate)
            Me.groupBox3.Controls.Add(Me.chkScale)
            Me.groupBox3.Controls.Add(Me.chkRotate)
            Me.groupBox3.Controls.Add(Me.chkVerticalFlip)
            Me.groupBox3.Controls.Add(Me.chkHorizontalFlip)
            Me.groupBox3.Controls.Add(Me.tableLayoutPanel1)
            Me.groupBox3.Location = New System.Drawing.Point(2, 364)
            Me.groupBox3.Name = "groupBox3"
            Me.groupBox3.Size = New System.Drawing.Size(152, 161)
            Me.groupBox3.TabIndex = 2
            Me.groupBox3.TabStop = False
            Me.groupBox3.Text = "Shape Arrange"
            ' 
            ' numericScale
            ' 
            Me.numericScale.Enabled = False
            Me.numericScale.Location = New System.Drawing.Point(69, 128)
            Me.numericScale.Maximum = New Decimal(New Integer() {2000, 0, 0, 0})
            Me.numericScale.Name = "numericScale"
            Me.numericScale.Size = New System.Drawing.Size(83, 20)
            Me.numericScale.TabIndex = 7
            Me.numericScale.Value = New Decimal(New Integer() {100, 0, 0, 0})
            ' 
            ' numericRotate
            ' 
            Me.numericRotate.Enabled = False
            Me.numericRotate.Location = New System.Drawing.Point(69, 99)
            Me.numericRotate.Maximum = New Decimal(New Integer() {360, 0, 0, 0})
            Me.numericRotate.Minimum = New Decimal(New Integer() {360, 0, 0, -2147483648})
            Me.numericRotate.Name = "numericRotate"
            Me.numericRotate.Size = New System.Drawing.Size(83, 20)
            Me.numericRotate.TabIndex = 6
            ' 
            ' chkScale
            ' 
            Me.chkScale.AutoSize = True
            Me.chkScale.Enabled = False
            Me.chkScale.Location = New System.Drawing.Point(6, 129)
            Me.chkScale.Name = "chkScale"
            Me.chkScale.Size = New System.Drawing.Size(53, 17)
            Me.chkScale.TabIndex = 5
            Me.chkScale.Text = "Scale"
            Me.chkScale.UseVisualStyleBackColor = True
            ' 
            ' chkRotate
            ' 
            Me.chkRotate.AutoSize = True
            Me.chkRotate.Enabled = False
            Me.chkRotate.Location = New System.Drawing.Point(6, 100)
            Me.chkRotate.Name = "chkRotate"
            Me.chkRotate.Size = New System.Drawing.Size(58, 17)
            Me.chkRotate.TabIndex = 5
            Me.chkRotate.Text = "Rotate"
            Me.chkRotate.UseVisualStyleBackColor = True
            ' 
            ' chkVerticalFlip
            ' 
            Me.chkVerticalFlip.AutoSize = True
            Me.chkVerticalFlip.Enabled = False
            Me.chkVerticalFlip.Location = New System.Drawing.Point(6, 77)
            Me.chkVerticalFlip.Name = "chkVerticalFlip"
            Me.chkVerticalFlip.Size = New System.Drawing.Size(80, 17)
            Me.chkVerticalFlip.TabIndex = 4
            Me.chkVerticalFlip.Text = "Vertical Flip"
            Me.chkVerticalFlip.UseVisualStyleBackColor = True
            ' 
            ' chkHorizontalFlip
            ' 
            Me.chkHorizontalFlip.AutoSize = True
            Me.chkHorizontalFlip.Enabled = False
            Me.chkHorizontalFlip.Location = New System.Drawing.Point(6, 58)
            Me.chkHorizontalFlip.Name = "chkHorizontalFlip"
            Me.chkHorizontalFlip.Size = New System.Drawing.Size(92, 17)
            Me.chkHorizontalFlip.TabIndex = 3
            Me.chkHorizontalFlip.Text = "Horizontal Flip"
            Me.chkHorizontalFlip.UseVisualStyleBackColor = True
            ' 
            ' tableLayoutPanel1
            ' 
            Me.tableLayoutPanel1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.tableLayoutPanel1.ColumnCount = 2
            Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0F))
            Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0F))
            Me.tableLayoutPanel1.Controls.Add(Me.btnBringToFront, 0, 0)
            Me.tableLayoutPanel1.Controls.Add(Me.btnSendToBack, 1, 0)
            Me.tableLayoutPanel1.Location = New System.Drawing.Point(1, 19)
            Me.tableLayoutPanel1.Name = "tableLayoutPanel1"
            Me.tableLayoutPanel1.RowCount = 1
            Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0F))
            Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0F))
            Me.tableLayoutPanel1.Size = New System.Drawing.Size(151, 27)
            Me.tableLayoutPanel1.TabIndex = 0
            ' 
            ' btnBringToFront
            ' 
            Me.btnBringToFront.AutoSize = True
            Me.btnBringToFront.Dock = System.Windows.Forms.DockStyle.Fill
            Me.btnBringToFront.Enabled = False
            Me.btnBringToFront.Location = New System.Drawing.Point(3, 3)
            Me.btnBringToFront.Name = "btnBringToFront"
            Me.btnBringToFront.Size = New System.Drawing.Size(69, 21)
            Me.btnBringToFront.TabIndex = 0
            Me.btnBringToFront.Text = "Bring To Front"
            Me.btnBringToFront.UseVisualStyleBackColor = True
            ' 
            ' btnSendToBack
            ' 
            Me.btnSendToBack.AutoSize = True
            Me.btnSendToBack.Dock = System.Windows.Forms.DockStyle.Fill
            Me.btnSendToBack.Enabled = False
            Me.btnSendToBack.Location = New System.Drawing.Point(78, 3)
            Me.btnSendToBack.Name = "btnSendToBack"
            Me.btnSendToBack.Size = New System.Drawing.Size(70, 21)
            Me.btnSendToBack.TabIndex = 1
            Me.btnSendToBack.Text = "Send To Back"
            Me.btnSendToBack.UseVisualStyleBackColor = True
            ' 
            ' ImagesAndShapes
            ' 
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0F, 13.0F)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.Name = "ImagesAndShapes"
            Me.Size = New System.Drawing.Size(635, 538)
            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.groupBox2.ResumeLayout(False)
            Me.groupBox2.PerformLayout()
            DirectCast(Me.numericThickness, System.ComponentModel.ISupportInitialize).EndInit()
            Me.groupBox3.ResumeLayout(False)
            Me.groupBox3.PerformLayout()
            DirectCast(Me.numericScale, System.ComponentModel.ISupportInitialize).EndInit()
            DirectCast(Me.numericRotate, System.ComponentModel.ISupportInitialize).EndInit()
            Me.tableLayoutPanel1.ResumeLayout(False)
            Me.tableLayoutPanel1.PerformLayout()
            Me.ResumeLayout(False)

        End Sub

#End Region

        Private fpSpread As FarPoint.Win.Spread.FpSpread
        Private fpSpread_Sheet1 As FarPoint.Win.Spread.SheetView
        Private groupBox1 As System.Windows.Forms.GroupBox
        Private btnPicture As System.Windows.Forms.Button
        Private btnShape As System.Windows.Forms.Button
        Private shapePanel1 As ShapePanel
        Private groupBox2 As System.Windows.Forms.GroupBox
        Private comboDropShadow As System.Windows.Forms.ComboBox
        Private comboOutlineStyle As System.Windows.Forms.ComboBox
        Private numericThickness As System.Windows.Forms.NumericUpDown
        Private label6 As System.Windows.Forms.Label
        Private label5 As System.Windows.Forms.Label
        Private label4 As System.Windows.Forms.Label
        Private btnOutlineColor As System.Windows.Forms.Button
        Private btnForeColor As System.Windows.Forms.Button
        Private btnBackColor As System.Windows.Forms.Button
        Private label3 As System.Windows.Forms.Label
        Private label2 As System.Windows.Forms.Label
        Private label1 As System.Windows.Forms.Label
        Private groupBox3 As System.Windows.Forms.GroupBox
        Private tableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
        Private btnBringToFront As System.Windows.Forms.Button
        Private btnSendToBack As System.Windows.Forms.Button
        Private btnSetPicture As System.Windows.Forms.Button
        Private chkVerticalFlip As System.Windows.Forms.CheckBox
        Private chkHorizontalFlip As System.Windows.Forms.CheckBox
        Private numericScale As System.Windows.Forms.NumericUpDown
        Private numericRotate As System.Windows.Forms.NumericUpDown
        Private chkScale As System.Windows.Forms.CheckBox
        Private chkRotate As System.Windows.Forms.CheckBox
    End Class
End Namespace
