Imports System.IO

Public Class Form_Poin  
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
   Friend WithEvents tlb_Puan As System.Windows.Forms.ToolBar
   Friend WithEvents ToolBarButton100 As System.Windows.Forms.ToolBarButton
   Friend WithEvents ToolBarButton110 As System.Windows.Forms.ToolBarButton
   Friend WithEvents ToolBarButton112 As System.Windows.Forms.ToolBarButton
   Friend WithEvents ToolBarButton114 As System.Windows.Forms.ToolBarButton
   Friend WithEvents ToolBarButton118 As System.Windows.Forms.ToolBarButton
   Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
   Friend WithEvents tbb_Puan_Read As System.Windows.Forms.ToolBarButton
   Friend WithEvents tbb_Puan_Save As System.Windows.Forms.ToolBarButton
   Friend WithEvents tbb_Puan_Help As System.Windows.Forms.ToolBarButton
   Friend WithEvents tbb_Puan_Exit As System.Windows.Forms.ToolBarButton
   Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
   Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
   Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
   Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
   Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
   Friend WithEvents mi_Temp As System.Windows.Forms.MenuItem
   Friend WithEvents Pan_Poin As System.Windows.Forms.Panel
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
      Me.components = New System.ComponentModel.Container
      Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form_Poin))
      Me.tlb_Puan = New System.Windows.Forms.ToolBar
      Me.ToolBarButton100 = New System.Windows.Forms.ToolBarButton
      Me.ToolBarButton110 = New System.Windows.Forms.ToolBarButton
      Me.tbb_Puan_Read = New System.Windows.Forms.ToolBarButton
      Me.ContextMenu1 = New System.Windows.Forms.ContextMenu
      Me.mi_Temp = New System.Windows.Forms.MenuItem
      Me.ToolBarButton112 = New System.Windows.Forms.ToolBarButton
      Me.tbb_Puan_Save = New System.Windows.Forms.ToolBarButton
      Me.ToolBarButton114 = New System.Windows.Forms.ToolBarButton
      Me.tbb_Puan_Help = New System.Windows.Forms.ToolBarButton
      Me.ToolBarButton118 = New System.Windows.Forms.ToolBarButton
      Me.tbb_Puan_Exit = New System.Windows.Forms.ToolBarButton
      Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
      Me.Pan_Poin = New System.Windows.Forms.Panel
      Me.TextBox4 = New System.Windows.Forms.TextBox
      Me.TextBox3 = New System.Windows.Forms.TextBox
      Me.TextBox2 = New System.Windows.Forms.TextBox
      Me.TextBox1 = New System.Windows.Forms.TextBox
      Me.Pan_Poin.SuspendLayout()
      Me.SuspendLayout()
      '
      'tlb_Puan
      '
      Me.tlb_Puan.AutoSize = False
      Me.tlb_Puan.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.ToolBarButton100, Me.ToolBarButton110, Me.tbb_Puan_Read, Me.ToolBarButton112, Me.tbb_Puan_Save, Me.ToolBarButton114, Me.tbb_Puan_Help, Me.ToolBarButton118, Me.tbb_Puan_Exit})
      Me.tlb_Puan.ButtonSize = New System.Drawing.Size(50, 52)
      Me.tlb_Puan.Dock = System.Windows.Forms.DockStyle.Left
      Me.tlb_Puan.DropDownArrows = True
      Me.tlb_Puan.ImageList = Me.ImageList1
      Me.tlb_Puan.Location = New System.Drawing.Point(0, 0)
      Me.tlb_Puan.Name = "tlb_Puan"
      Me.tlb_Puan.ShowToolTips = True
      Me.tlb_Puan.Size = New System.Drawing.Size(65, 693)
      Me.tlb_Puan.TabIndex = 17
      '
      'ToolBarButton100
      '
      Me.ToolBarButton100.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
      '
      'ToolBarButton110
      '
      Me.ToolBarButton110.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
      '
      'tbb_Puan_Read
      '
      Me.tbb_Puan_Read.DropDownMenu = Me.ContextMenu1
      Me.tbb_Puan_Read.ImageIndex = 0
      Me.tbb_Puan_Read.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton
      Me.tbb_Puan_Read.Text = "Read"
      Me.tbb_Puan_Read.ToolTipText = "Read Components"
      '
      'ContextMenu1
      '
      Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mi_Temp})
      '
      'mi_Temp
      '
      Me.mi_Temp.Index = 0
      Me.mi_Temp.Text = "Template"
      '
      'ToolBarButton112
      '
      Me.ToolBarButton112.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
      '
      'tbb_Puan_Save
      '
      Me.tbb_Puan_Save.ImageIndex = 1
      Me.tbb_Puan_Save.Text = "Save"
      Me.tbb_Puan_Save.ToolTipText = "Save"
      '
      'ToolBarButton114
      '
      Me.ToolBarButton114.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
      '
      'tbb_Puan_Help
      '
      Me.tbb_Puan_Help.ImageIndex = 2
      Me.tbb_Puan_Help.Text = "Help"
      Me.tbb_Puan_Help.ToolTipText = "Help"
      '
      'ToolBarButton118
      '
      Me.ToolBarButton118.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
      '
      'tbb_Puan_Exit
      '
      Me.tbb_Puan_Exit.ImageIndex = 3
      Me.tbb_Puan_Exit.Text = "Exit"
      Me.tbb_Puan_Exit.ToolTipText = "Exit"
      '
      'ImageList1
      '
      Me.ImageList1.ImageSize = New System.Drawing.Size(32, 32)
      Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
      Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
      '
      'Pan_Poin
      '
      Me.Pan_Poin.AutoScroll = True
      Me.Pan_Poin.BackColor = System.Drawing.Color.Gainsboro
      Me.Pan_Poin.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
      Me.Pan_Poin.Controls.Add(Me.TextBox4)
      Me.Pan_Poin.Controls.Add(Me.TextBox3)
      Me.Pan_Poin.Controls.Add(Me.TextBox2)
      Me.Pan_Poin.Controls.Add(Me.TextBox1)
      Me.Pan_Poin.Dock = System.Windows.Forms.DockStyle.Left
      Me.Pan_Poin.Location = New System.Drawing.Point(65, 0)
      Me.Pan_Poin.Name = "Pan_Poin"
      Me.Pan_Poin.Size = New System.Drawing.Size(270, 693)
      Me.Pan_Poin.TabIndex = 18
      '
      'TextBox4
      '
      Me.TextBox4.AutoSize = False
      Me.TextBox4.BackColor = System.Drawing.Color.Silver
      Me.TextBox4.BorderStyle = System.Windows.Forms.BorderStyle.None
      Me.TextBox4.Font = New System.Drawing.Font("Courier New", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
      Me.TextBox4.Location = New System.Drawing.Point(0, 0)
      Me.TextBox4.Name = "TextBox4"
      Me.TextBox4.Size = New System.Drawing.Size(252, 17)
      Me.TextBox4.TabIndex = 4
      Me.TextBox4.Text = "Poincare-hyperplane (N, X - Xo) = 0"
      Me.TextBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
      '
      'TextBox3
      '
      Me.TextBox3.AutoSize = False
      Me.TextBox3.BackColor = System.Drawing.Color.Silver
      Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.None
      Me.TextBox3.Font = New System.Drawing.Font("Courier New", 9.0!, System.Drawing.FontStyle.Bold)
      Me.TextBox3.Location = New System.Drawing.Point(152, 18)
      Me.TextBox3.Name = "TextBox3"
      Me.TextBox3.Size = New System.Drawing.Size(100, 17)
      Me.TextBox3.TabIndex = 2
      Me.TextBox3.Text = "Xo(I)"
      Me.TextBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
      '
      'TextBox2
      '
      Me.TextBox2.AutoSize = False
      Me.TextBox2.BackColor = System.Drawing.Color.Silver
      Me.TextBox2.BorderStyle = System.Windows.Forms.BorderStyle.None
      Me.TextBox2.Font = New System.Drawing.Font("Courier New", 9.0!, System.Drawing.FontStyle.Bold)
      Me.TextBox2.Location = New System.Drawing.Point(51, 18)
      Me.TextBox2.Name = "TextBox2"
      Me.TextBox2.Size = New System.Drawing.Size(100, 17)
      Me.TextBox2.TabIndex = 1
      Me.TextBox2.Text = "N(I)"
      Me.TextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
      '
      'TextBox1
      '
      Me.TextBox1.AutoSize = False
      Me.TextBox1.BackColor = System.Drawing.Color.Silver
      Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None
      Me.TextBox1.Font = New System.Drawing.Font("Courier New", 9.0!, System.Drawing.FontStyle.Bold)
      Me.TextBox1.Location = New System.Drawing.Point(0, 18)
      Me.TextBox1.Name = "TextBox1"
      Me.TextBox1.Size = New System.Drawing.Size(50, 17)
      Me.TextBox1.TabIndex = 0
      Me.TextBox1.Text = "I"
      Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
      '
      'Form_Poin
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.ClientSize = New System.Drawing.Size(335, 693)
      Me.Controls.Add(Me.Pan_Poin)
      Me.Controls.Add(Me.tlb_Puan)
      Me.Name = "Form_Poin"
      Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
      Me.Text = "Form Poinñare"
      Me.Pan_Poin.ResumeLayout(False)
      Me.ResumeLayout(False)

   End Sub

#End Region

   Private tbxPuan_Num(), tbxPuan_N(), tbxPuan_Xo() As TextBox


   Private Sub Form_Puan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      ReDim tbxPuan_Num(NComp), tbxPuan_N(NComp), tbxPuan_Xo(NComp)

      For I As Integer = 1 To NComp
         tbxComp_(I, tbxPuan_Num, "Num",   0,  50)
         tbxComp_(I, tbxPuan_N,     "N",  51, 100)
         tbxComp_(I, tbxPuan_Xo,   "Xo", 152, 100)
      Next I
   End Sub


'=======================================================================================================
   Public Sub tbxComp_(ByVal Ir%, ByVal tbxCom() As TextBox, ByVal Str$, ByVal Left%, ByVal Width%)
         tbxCom(Ir) = New TextBox
         With tbxCom(Ir)
            .BorderStyle = BorderStyle.None:    .BackColor = Color.FromArgb(255, 255, 235)
            .TextAlign = HorizontalAlignment.Center:    .Font = txtFont_CN
            If Str = "Num" Then
               .BackColor = Color.Silver:    .Text = Ir:    .ReadOnly = True:    End If
            .Location = New Drawing.Point(Left, 36 + (Ir - 1) * 18)
            .Size     = New Drawing.Size(Width, 17):    .AutoSize = False
         End With
         Pan_Poin.Controls.Add(tbxCom(Ir))
   End Sub
'=======================================================================================================



'------------- tlb_Puan ----------------------------------------------------------------------------------------------- tlb_Puant
'------------- tlb_Puan ----------------------------------------------------------------------------------------------- tlb_Puant
'------------- tlb_Puan ----------------------------------------------------------------------------------------------- tlb_Puant
   Private Sub tlb_Puan_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) _
       Handles tlb_Puan.ButtonClick    'Handles tlb_Puan.ButtonClick
      If e.Button Is tbb_Puan_Read Then Puan_Read()
      If e.Button Is tbb_Puan_Save Then Puan_Save()
      If e.Button Is tbb_Puan_Help Then MsgBox("Puan_Help")
      If e.Button Is tbb_Puan_Exit Then Close()
   End Sub


   Private Sub mi_Temp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi_Temp.Click
      For I As Integer = 1 To NComp
         tbxPuan_N(I).Text  = 0
         tbxPuan_Xo(I).Text = 0
      Next I

      tbxPuan_N(1).Text = 1
      tbxPuan_N(2).Text = -1
   End Sub


   Private Sub Puan_Read()
      SR  = New StreamReader(WorkDirRe & "\NormC.pnc")
      SR1 = New StreamReader(WorkDirRe & "\PointC.pnc")
      For I As Integer = 1 To NComp
         tbxPuan_N(I).Text  = SR.ReadLine()
         tbxPuan_Xo(I).Text = SR1.ReadLine()
      Next I
      SR.Close
      SR1.Close
   End Sub


   Private Sub Puan_Save()
      Dim msg2 As DialogResult
      msg2 = MessageBox.Show("Do you want to save this variant?", "  Puan", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
      If msg2 = DialogResult.No Then Exit Sub

      SW  = New StreamWriter(WorkDirRe & "\NormC.pnc")
      SW1 = New StreamWriter(WorkDirRe & "\PointC.pnc")
      For I As Integer = 1 To NComp
         SW.WriteLine(tbxPuan_N(I).Text)
         SW1.WriteLine(tbxPuan_Xo(I).Text)
      Next I
      SW.Close
      SW1.Close
   End Sub


End Class
