(NET) NET (2019)

<< Multi Languages Spell Checker for webmaster. Part 2. Main MDI-form. <<


Sorry, no time for more details description, only code.



   1:  Imports System.Windows.Forms
   2:   
   3:  Public Class MainForm
   4:      Dim BF As BrowserForm
   5:      Dim EF As EditForm
   6:      Dim SF As SpellForm
   7:      Dim DF As DirectoriesForm
   8:   
   9:      Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles Me.Load
  10:          Text &= " (" & My.Application.Info.Version.ToString & ")"
  11:          BF = BF.OpenAsMDI
  12:          EF = EF.OpenAsMDI
  13:          SF = SF.OpenAsMDI
  14:          DF = DF.OpenAsMDI
  15:      End Sub
  16:   
  17:      Public Sub SetNewFile(FileName As String)
  18:          If My.Computer.FileSystem.FileExists(FileName) Then
  19:              ToolStripStatusLabel.Text = FileName
  20:              Dim Y = IO.Path.GetExtension(FileName)
  21:              If Y <> "" Then
  22:                  If Not (Me.MdiChildren.Any(Function(X) X Is BF)) Then BF = BF.OpenAsMDI
  23:                  If Not (Me.MdiChildren.Any(Function(X) X Is EF)) Then EF = EF.OpenAsMDI
  24:                  BF.BrowseNewFile(FileName)
  25:                  EF.EditNewFile(FileName)
  26:              End If
  27:          Else
  28:              AutoClosingMessageBox.Show(FileName & vbCrLf & "Not exists")
  29:          End If
  30:      End Sub
  31:   
  32:   
  33:      Public Sub Spell(SpellingTXT As String)
  34:          If Not (Me.MdiChildren.Any(Function(X) X Is SF)) Then SF = SF.OpenAsMDI
  35:          SF.Check(SpellingTXT)
  36:      End Sub
  37:   
  38:      Public Sub SearchWord(Txt As String)
  39:          If String.IsNullOrEmpty(Txt) Then
  40:              AutoClosingMessageBox.Show("Attempt to search empty string")
  41:          Else
  42:              If Not (Me.MdiChildren.Any(Function(X) X Is EF)) Then
  43:                  EF = EF.OpenAsMDI
  44:                  EF.EditNewFile(ToolStripStatusLabel.Text)
  45:              End If
  46:              EF.Search(Txt)
  47:          End If
  48:   
  49:      End Sub
  50:   
  51:      Private Sub ShowFilesToolStripButton_Click(sender As Object, e As EventArgs) Handles ShowFilesToolStripButton.Click
  52:          If Not (Me.MdiChildren.Any(Function(X) X Is DF)) Then
  53:              DF = DF.OpenAsMDI
  54:          Else
  55:              DF.WindowState = FormWindowState.Normal
  56:              DF.BringToFront()
  57:          End If
  58:   
  59:      End Sub
  60:   
  61:      Private Sub BrowserToolStripButton_Click(sender As Object, e As EventArgs) Handles BrowserToolStripButton.Click
  62:          If Not (Me.MdiChildren.Any(Function(X) X Is BF)) Then
  63:              BF = BF.OpenAsMDI
  64:          Else
  65:              BF.WindowState = FormWindowState.Normal
  66:              BF.BringToFront()
  67:          End If
  68:      End Sub
  69:   
  70:      Private Sub SpellToolStripButton_Click(sender As Object, e As EventArgs) Handles SpellToolStripButton.Click
  71:          If Not (Me.MdiChildren.Any(Function(X) X Is SF)) Then
  72:              SF = SF.OpenAsMDI
  73:          Else
  74:              SF.WindowState = FormWindowState.Normal
  75:              SF.BringToFront()
  76:          End If
  77:      End Sub
  78:   
  79:      Private Sub EditToolStripButton_Click(sender As Object, e As EventArgs) Handles EditToolStripButton.Click
  80:          If Not (Me.MdiChildren.Any(Function(X) X Is EF)) Then
  81:              EF = EF.OpenAsMDI
  82:          Else
  83:              EF.WindowState = FormWindowState.Normal
  84:              EF.BringToFront()
  85:          End If
  86:      End Sub
  87:   
  88:      Private Sub FFToolStripButton_Click(sender As Object, e As EventArgs) Handles FFToolStripButton.Click
  89:          Process.Start("explorer.exe", ToolStripStatusLabel.Text)
  90:      End Sub
  91:   
  92:      Private Sub NotepadPlusToolStripButton_Click(sender As Object, e As EventArgs) Handles NotepadPlusToolStripButton.Click
  93:          Process.Start("C:\Program Files (x86)\Notepad++\notepad++.exe", ToolStripStatusLabel.Text)
  94:      End Sub
  95:   
  96:      Private Sub ToolStripStatusLabel_Click(sender As Object, e As EventArgs) Handles ToolStripStatusLabel.Click
  97:          Clipboard.SetText(ToolStripStatusLabel.Text)
  98:      End Sub
  99:   
 100:      Private Sub WindowCascadeToolStripButton_Click(sender As Object, e As EventArgs) Handles WindowCascadeToolStripButton.Click
 101:          Me.LayoutMdi(MdiLayout.Cascade)
 102:      End Sub
 103:   
 104:      Private Sub WindowsVerticalToolStripButton_Click(sender As Object, e As EventArgs) Handles WindowsVerticalToolStripButton.Click
 105:          Me.LayoutMdi(MdiLayout.TileVertical)
 106:      End Sub
 107:   
 108:      Private Sub WindowsHorizontalToolStripButton_Click(sender As Object, e As EventArgs) Handles WindowsHorizontalToolStripButton.Click
 109:          Me.LayoutMdi(MdiLayout.TileHorizontal)
 110:      End Sub
 111:   
 112:      Private Sub OpenHtmToolStripButton_Click(sender As Object, e As EventArgs) Handles OpenHtmToolStripButton.Click
 113:          Dim X As New OpenFileDialog
 114:          X.Title = "Browse html files"
 115:          X.Filter = "htm files (*.htm)|*.htm|html files (*.html)|*.html|All files (*.*)|*.*"
 116:          X.FilterIndex = 3
 117:          X.CheckFileExists = True
 118:          X.CheckPathExists = True
 119:          X.Multiselect = False
 120:          If X.ShowDialog = DialogResult.OK Then
 121:              ToolStripStatusLabel.Text = X.FileName
 122:              SetNewFile(X.FileName)
 123:          End If
 124:      End Sub
 125:   
 126:      Private Sub FTPSettingToolStripButton_Click(sender As Object, e As EventArgs) Handles FTPSettingToolStripButton.Click
 127:          Dim X As New FtpSettingForm
 128:          X.OpenAsMDI
 129:      End Sub
 130:   
 131:      Private Sub ShowLogToolStripButton_Click(sender As Object, e As EventArgs) Handles ShowLogToolStripButton.Click
 132:          Dim X As New LogForm
 133:          X.OpenAsMDI
 134:      End Sub
 135:  End Class


   1:  Imports System.Runtime.CompilerServices
   2:   
   3:  Module MDIExtensions
   4:   
   5:      <Extension>
   6:      Public Function OpenAsMDI(X As SpellForm) As SpellForm
   7:          OpenAsMDI = New SpellForm
   8:          OpenAsMDI.MdiParent = MainForm_Instance
   9:          OpenAsMDI.Show()
  10:          OpenAsMDI.BringToFront()
  11:      End Function
  12:   
  13:      <Extension>
  14:      Public Function OpenAsMDI(X As EditForm) As EditForm
  15:          OpenAsMDI = New EditForm
  16:          OpenAsMDI.MdiParent = MainForm_Instance
  17:          OpenAsMDI.Show()
  18:          OpenAsMDI.BringToFront()
  19:      End Function
  20:   
  21:      <Extension>
  22:      Public Function OpenAsMDI(X As BrowserForm) As BrowserForm
  23:          OpenAsMDI = New BrowserForm
  24:          OpenAsMDI.MdiParent = MainForm_Instance
  25:          OpenAsMDI.Show()
  26:          OpenAsMDI.BringToFront()
  27:      End Function
  28:   
  29:      <Extension>
  30:      Public Function OpenAsMDI(X As DirectoriesForm) As DirectoriesForm
  31:          OpenAsMDI = New DirectoriesForm
  32:          OpenAsMDI.MdiParent = MainForm_Instance
  33:          OpenAsMDI.Show()
  34:          OpenAsMDI.BringToFront()
  35:      End Function
  36:   
  37:      <Extension>
  38:      Public Function OpenAsMDI(X As FtpSettingForm) As FtpSettingForm
  39:          OpenAsMDI = New FtpSettingForm
  40:          OpenAsMDI.MdiParent = MainForm_Instance
  41:          OpenAsMDI.Show()
  42:          OpenAsMDI.BringToFront()
  43:      End Function
  44:   
  45:      <Extension>
  46:      Public Function OpenAsMDI(X As LogForm) As LogForm
  47:          OpenAsMDI = New LogForm
  48:          OpenAsMDI.MdiParent = MainForm_Instance
  49:          OpenAsMDI.Show()
  50:          OpenAsMDI.BringToFront()
  51:      End Function
  52:   
  53:  End Module


Comments ( )
Link to this page: //www.vb-net.com/SpellChecker/MainMDI.htm
< THANKS ME>