Files
Tongsin/SpreadNet.v5/Epole/StyleEdit.vb
2020-05-24 15:14:12 +09:00

55 lines
2.4 KiB
VB.net

Public Class StyleEdit
Public ListIndex As Integer = -1
Public Path As System.IO.DirectoryInfo
Public Target() As String = {"X1", "X2", "X3", "X4", "X5", "X6", "X7", "X8", "X9", "X10", "X11", "X12", "X13"}
Private Sub StyleEdit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'MsgBox(ListIndex)
Me.lb_filename.Text = StyleList(ListIndex).File
Me.RichTextBox1.LoadFile(Path.FullName & "\" & StyleList(ListIndex).File, RichTextBoxStreamType.PlainText)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim src As String
Dim pos() As String
Dim Cnt As Integer = 0
Me.RichTextBox2.Clear()
For Each A As String In Me.RichTextBox1.Lines
src = A
Cnt = 0
For Each Z As String In Me.Target
If A.ToUpper.IndexOf(Z & "POS") > -1 Then
pos = A.Substring(A.IndexOf("=") + 1).Trim.Split(",") '//위치값을 가졌으니 그 위치값으로 변경해서 다시 저장한다.
pos(0) += Val(Me.TextBox1.Text)
pos(1) += Val(Me.TextBox2.Text)
Cnt += 1
Me.RichTextBox2.AppendText(Z & "POS = " & pos(0) & "," & pos(1) & "," & pos(2) & "," & pos(3) & vbCrLf)
End If
Next
If Cnt = 0 Then
Me.RichTextBox2.AppendText(A & vbCrLf)
End If
Next
MsgBox("변경완료")
End Sub
Private Sub 저장ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_save.Click
If MsgBox("기존의 내용이 새로 기록됩니다", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "저장확인") = MsgBoxResult.Ok Then
Me.RichTextBox2.SaveFile(Me.Path.FullName & "\" & StyleList(ListIndex).File, RichTextBoxStreamType.PlainText)
MsgBox("저장이완료되었습니다", MsgBoxStyle.Information, "확인")
End If
End Sub
Private Sub 파일을다시불러옵니다ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_load.Click
Me.RichTextBox1.LoadFile(Path.FullName & "\" & StyleList(ListIndex).File, RichTextBoxStreamType.PlainText)
End Sub
End Class