Public Class CForm Public Parameter As String = "" '//트리노드로부터들어오는 화면파라미터 Public TreeTag As String = "" '//트리노드의 태그값 Public Overridable Function AcceptChanged() As Boolean Return True End Function Public Overridable Function RejectChanged() As Boolean Return True End Function Public Overridable Function HasChanged() As Boolean Return True End Function Private Sub Frm_Base_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed If Not Pub.Setting Is Nothing AndAlso Me.WindowState = FormWindowState.Normal Then Dim screenCount As Integer = Screen.AllScreens.Length Dim screenwidth As Integer = Screen.PrimaryScreen.Bounds.Width Dim screenheight As Integer = Screen.PrimaryScreen.Bounds.Height Dim iniKeyP As String = "Position{0}{1}" Dim iniKeyS As String = "Size{0}{1}" iniKeyP = String.Format(iniKeyP, screenwidth, screenheight) iniKeyS = String.Format(iniKeyS, screenwidth, screenheight) Pub.Setting.Data("formsetting_" + Me.Name.ToLower(), iniKeyP, "") = Me.Left.ToString() + "," + Me.Top.ToString() '고정폼에는 크기를 조정하지 않는다. 160713 If Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedDialog AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.Fixed3D AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedSingle AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedToolWindow Then Pub.Setting.Data("formsetting_" + Me.Name.ToLower(), iniKeyS, "") = Me.Width.ToString() + "," + Me.Height.ToString() End If Pub.Setting.Save() End If End Sub Private Sub Frm_Base_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown If e.KeyCode = Keys.Escape Then e.Handled = True e.SuppressKeyPress = True DialogResult = Windows.Forms.DialogResult.Cancel Me.Close() End If End Sub Private Sub Frm_Base_Load(sender As Object, e As EventArgs) Handles MyBase.Load '일반상태일때의 처리 If Me.WindowState = FormWindowState.Normal Then If StartPosition = FormStartPosition.Manual OrElse StartPosition = FormStartPosition.WindowsDefaultLocation Then FormPositionLoad() End If '고정폼에는 크기를 조정하지 않는다. 160713 If Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedDialog AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.Fixed3D AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedSingle AndAlso Me.FormBorderStyle <> System.Windows.Forms.FormBorderStyle.FixedToolWindow Then FormSizeLoad() End If End If End Sub Protected Sub FormPositionLoad() If Pub.Setting IsNot Nothing Then Dim screenCount As Integer = Screen.AllScreens.Length Dim screenwidth As Integer = Screen.PrimaryScreen.Bounds.Width Dim screenheight As Integer = Screen.PrimaryScreen.Bounds.Height Dim iniKey As String = "Position{0}{1}" iniKey = String.Format(iniKey, screenwidth, screenheight) Dim pos As String = Pub.Setting.Data("formsetting_" + Me.Name.ToLower(), iniKey, "") Dim posbuf As String() = pos.Split(","c) If posbuf.Length = 2 Then Me.Left = Integer.Parse(posbuf(0)) Me.Top = Integer.Parse(posbuf(1)) End If End If End Sub Protected Sub FormSizeLoad() If Pub.Setting IsNot Nothing Then Dim screenCount As Integer = Screen.AllScreens.Length Dim screenwidth As Integer = Screen.PrimaryScreen.Bounds.Width Dim screenheight As Integer = Screen.PrimaryScreen.Bounds.Height Dim iniKey As String = "Size{0}{1}" iniKey = String.Format(iniKey, screenwidth, screenheight) Dim pos As String = Pub.Setting.Data("formsetting_" + Me.Name.ToLower(), iniKey, "") Dim posbuf As String() = pos.Split(","c) If posbuf.Length = 2 Then Me.Width = Integer.Parse(posbuf(0)) Me.Height = Integer.Parse(posbuf(1)) End If End If End Sub End Class