'  
'   Rebex Sample Code License
' 
'   Copyright 2026, REBEX CR s.r.o.
'   All rights reserved.
'   https://www.rebex.net/
' 
'   Permission to use, copy, modify, and/or distribute this software for any
'   purpose with or without fee is hereby granted.
' 
'   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
'   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
'   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
'   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
'   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
'   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
'   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
'   OTHER DEALINGS IN THE SOFTWARE.
' 

Imports System

Partial Class MailEditor

#Region "Controls"
    Protected mainMenu As System.Windows.Forms.MenuStrip
    Protected menuItemFile As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemNewMessage As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemSave As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemSaveAs As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemSaveAttachment As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemClose As System.Windows.Forms.ToolStripMenuItem
    Protected menuItemEdit As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemCut As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemCopy As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemPaste As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemSelectAll As System.Windows.Forms.ToolStripMenuItem
    Protected menuItemInsert As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemFileAttachment As System.Windows.Forms.ToolStripMenuItem
    Protected WithEvents menuItemOpenMessage As System.Windows.Forms.ToolStripMenuItem
    Protected menuItemSeparator As System.Windows.Forms.ToolStripSeparator
    Protected openFileDialogMessage As System.Windows.Forms.OpenFileDialog
    Protected saveFileDialogMessage As System.Windows.Forms.SaveFileDialog
    Protected openFileDialogAttachment As System.Windows.Forms.OpenFileDialog
    Protected saveFileDialogAttachment As System.Windows.Forms.SaveFileDialog
    Protected WithEvents txtFrom As System.Windows.Forms.TextBox
    Protected lblFrom As System.Windows.Forms.Label
    Protected listBoxAttachments As System.Windows.Forms.ListBox
    Protected lblAttach As System.Windows.Forms.Label
    Protected WithEvents txtSubject As System.Windows.Forms.TextBox
    Protected lblSubject As System.Windows.Forms.Label
    Protected WithEvents txtCc As System.Windows.Forms.TextBox
    Protected WithEvents txtTo As System.Windows.Forms.TextBox
    Protected WithEvents txtBody As System.Windows.Forms.TextBox
    Protected lblCc As System.Windows.Forms.Label
    Protected lblTo As System.Windows.Forms.Label
    Protected contextMenuAttach As System.Windows.Forms.ContextMenuStrip
    Protected WithEvents menuItemDelete As System.Windows.Forms.ToolStripMenuItem
    Protected folderBrowserDialog As System.Windows.Forms.FolderBrowserDialog
#End Region

#Region " Windows Form Designer generated code "

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

    '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

    '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.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.mainMenu = New System.Windows.Forms.MenuStrip()
        Me.menuItemFile = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemNewMessage = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemOpenMessage = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemSave = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemSaveAs = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemSaveAttachment = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemSeparator = New System.Windows.Forms.ToolStripSeparator()
        Me.menuItemClose = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemEdit = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemCut = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemCopy = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemPaste = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemSelectAll = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemInsert = New System.Windows.Forms.ToolStripMenuItem()
        Me.menuItemFileAttachment = New System.Windows.Forms.ToolStripMenuItem()
        Me.openFileDialogMessage = New System.Windows.Forms.OpenFileDialog()
        Me.saveFileDialogMessage = New System.Windows.Forms.SaveFileDialog()
        Me.openFileDialogAttachment = New System.Windows.Forms.OpenFileDialog()
        Me.saveFileDialogAttachment = New System.Windows.Forms.SaveFileDialog()
        Me.folderBrowserDialog = New System.Windows.Forms.FolderBrowserDialog()
        Me.txtFrom = New System.Windows.Forms.TextBox()
        Me.lblFrom = New System.Windows.Forms.Label()
        Me.listBoxAttachments = New System.Windows.Forms.ListBox()
        Me.contextMenuAttach = New System.Windows.Forms.ContextMenuStrip(Me.components)
        Me.menuItemDelete = New System.Windows.Forms.ToolStripMenuItem()
        Me.lblAttach = New System.Windows.Forms.Label()
        Me.txtSubject = New System.Windows.Forms.TextBox()
        Me.lblSubject = New System.Windows.Forms.Label()
        Me.txtCc = New System.Windows.Forms.TextBox()
        Me.txtTo = New System.Windows.Forms.TextBox()
        Me.txtBody = New System.Windows.Forms.TextBox()
        Me.lblCc = New System.Windows.Forms.Label()
        Me.lblTo = New System.Windows.Forms.Label()
        Me.mainMenu.SuspendLayout()
        Me.contextMenuAttach.SuspendLayout()
        Me.SuspendLayout()
        '
        'mainMenu
        '
        Me.mainMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.menuItemFile, Me.menuItemEdit, Me.menuItemInsert})
        Me.mainMenu.Location = New System.Drawing.Point(0, 0)
        Me.mainMenu.Name = "mainMenu"
        Me.mainMenu.Size = New System.Drawing.Size(760, 24)
        Me.mainMenu.TabIndex = 22
        '
        'menuItemFile
        '
        Me.menuItemFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.menuItemNewMessage, Me.menuItemOpenMessage, Me.menuItemSave, Me.menuItemSaveAs, Me.menuItemSaveAttachment, Me.menuItemSeparator, Me.menuItemClose})
        Me.menuItemFile.MergeIndex = 0
        Me.menuItemFile.Name = "menuItemFile"
        Me.menuItemFile.Size = New System.Drawing.Size(37, 20)
        Me.menuItemFile.Text = "&File"
        '
        'menuItemNewMessage
        '
        Me.menuItemNewMessage.MergeIndex = 0
        Me.menuItemNewMessage.Name = "menuItemNewMessage"
        Me.menuItemNewMessage.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.N), System.Windows.Forms.Keys)
        Me.menuItemNewMessage.Size = New System.Drawing.Size(250, 22)
        Me.menuItemNewMessage.Text = "&New message"
        '
        'menuItemOpenMessage
        '
        Me.menuItemOpenMessage.MergeIndex = 1
        Me.menuItemOpenMessage.Name = "menuItemOpenMessage"
        Me.menuItemOpenMessage.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.O), System.Windows.Forms.Keys)
        Me.menuItemOpenMessage.Size = New System.Drawing.Size(250, 22)
        Me.menuItemOpenMessage.Text = "&Open message..."
        '
        'menuItemSave
        '
        Me.menuItemSave.MergeIndex = 2
        Me.menuItemSave.Name = "menuItemSave"
        Me.menuItemSave.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.S), System.Windows.Forms.Keys)
        Me.menuItemSave.Size = New System.Drawing.Size(250, 22)
        Me.menuItemSave.Text = "&Save"
        '
        'menuItemSaveAs
        '
        Me.menuItemSaveAs.MergeIndex = 3
        Me.menuItemSaveAs.Name = "menuItemSaveAs"
        Me.menuItemSaveAs.ShortcutKeys = CType(((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Shift) _
            Or System.Windows.Forms.Keys.S), System.Windows.Forms.Keys)
        Me.menuItemSaveAs.Size = New System.Drawing.Size(250, 22)
        Me.menuItemSaveAs.Text = "Sa&ve as..."
        '
        'menuItemSaveAttachment
        '
        Me.menuItemSaveAttachment.MergeIndex = 4
        Me.menuItemSaveAttachment.Name = "menuItemSaveAttachment"
        Me.menuItemSaveAttachment.ShortcutKeys = CType(((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Shift) _
            Or System.Windows.Forms.Keys.A), System.Windows.Forms.Keys)
        Me.menuItemSaveAttachment.Size = New System.Drawing.Size(250, 22)
        Me.menuItemSaveAttachment.Text = "Save &attachments..."
        '
        'menuItemSeparator
        '
        Me.menuItemSeparator.MergeIndex = 5
        Me.menuItemSeparator.Name = "menuItemSeparator"
        Me.menuItemSeparator.Size = New System.Drawing.Size(247, 6)
        '
        'menuItemClose
        '
        Me.menuItemClose.MergeIndex = 6
        Me.menuItemClose.Name = "menuItemClose"
        Me.menuItemClose.ShortcutKeys = CType((System.Windows.Forms.Keys.Alt Or System.Windows.Forms.Keys.F4), System.Windows.Forms.Keys)
        Me.menuItemClose.Size = New System.Drawing.Size(250, 22)
        Me.menuItemClose.Text = "&Close"
        '
        'menuItemEdit
        '
        Me.menuItemEdit.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.menuItemCut, Me.menuItemCopy, Me.menuItemPaste, Me.menuItemSelectAll})
        Me.menuItemEdit.MergeIndex = 1
        Me.menuItemEdit.Name = "menuItemEdit"
        Me.menuItemEdit.Size = New System.Drawing.Size(39, 20)
        Me.menuItemEdit.Text = "&Edit"
        '
        'menuItemCut
        '
        Me.menuItemCut.MergeIndex = 0
        Me.menuItemCut.Name = "menuItemCut"
        Me.menuItemCut.Size = New System.Drawing.Size(120, 22)
        Me.menuItemCut.Text = "&Cut"
        '
        'menuItemCopy
        '
        Me.menuItemCopy.MergeIndex = 1
        Me.menuItemCopy.Name = "menuItemCopy"
        Me.menuItemCopy.Size = New System.Drawing.Size(120, 22)
        Me.menuItemCopy.Text = "C&opy"
        '
        'menuItemPaste
        '
        Me.menuItemPaste.MergeIndex = 2
        Me.menuItemPaste.Name = "menuItemPaste"
        Me.menuItemPaste.Size = New System.Drawing.Size(120, 22)
        Me.menuItemPaste.Text = "&Paste"
        '
        'menuItemSelectAll
        '
        Me.menuItemSelectAll.MergeIndex = 3
        Me.menuItemSelectAll.Name = "menuItemSelectAll"
        Me.menuItemSelectAll.Size = New System.Drawing.Size(120, 22)
        Me.menuItemSelectAll.Text = "&Select all"
        '
        'menuItemInsert
        '
        Me.menuItemInsert.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.menuItemFileAttachment})
        Me.menuItemInsert.MergeIndex = 2
        Me.menuItemInsert.Name = "menuItemInsert"
        Me.menuItemInsert.Size = New System.Drawing.Size(48, 20)
        Me.menuItemInsert.Text = "&Insert"
        '
        'menuItemFileAttachment
        '
        Me.menuItemFileAttachment.MergeIndex = 0
        Me.menuItemFileAttachment.Name = "menuItemFileAttachment"
        Me.menuItemFileAttachment.Size = New System.Drawing.Size(146, 22)
        Me.menuItemFileAttachment.Text = "&Attachment..."
        '
        'openFileDialogMessage
        '
        Me.openFileDialogMessage.Filter = "Outlook mails (*.msg)|*.msg|All files (*.*)|*.*"
        '
        'saveFileDialogMessage
        '
        Me.saveFileDialogMessage.Filter = "Outlook mails (*.msg)|*.msg|All files (*.*)|*.*"
        '
        'openFileDialogAttachment
        '
        Me.openFileDialogAttachment.Filter = "All files (*.*)|*.*"
        '
        'saveFileDialogAttachment
        '
        Me.saveFileDialogAttachment.Filter = "All files (*.*)|*.*"
        '
        'txtFrom
        '
        Me.txtFrom.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.txtFrom.Location = New System.Drawing.Point(88, 35)
        Me.txtFrom.Name = "txtFrom"
        Me.txtFrom.Size = New System.Drawing.Size(664, 20)
        Me.txtFrom.TabIndex = 1
        '
        'lblFrom
        '
        Me.lblFrom.Location = New System.Drawing.Point(0, 35)
        Me.lblFrom.Name = "lblFrom"
        Me.lblFrom.Size = New System.Drawing.Size(80, 16)
        Me.lblFrom.TabIndex = 19
        Me.lblFrom.Text = "From:"
        Me.lblFrom.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'listBoxAttachments
        '
        Me.listBoxAttachments.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.listBoxAttachments.ContextMenuStrip = Me.contextMenuAttach
        Me.listBoxAttachments.Location = New System.Drawing.Point(88, 131)
        Me.listBoxAttachments.MultiColumn = True
        Me.listBoxAttachments.Name = "listBoxAttachments"
        Me.listBoxAttachments.Size = New System.Drawing.Size(664, 56)
        Me.listBoxAttachments.TabIndex = 18
        '
        'contextMenuAttach
        '
        Me.contextMenuAttach.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.menuItemDelete})
        Me.contextMenuAttach.Name = "contextMenuAttach"
        Me.contextMenuAttach.RightToLeft = System.Windows.Forms.RightToLeft.Yes
        Me.contextMenuAttach.Size = New System.Drawing.Size(108, 26)
        '
        'menuItemDelete
        '
        Me.menuItemDelete.MergeIndex = 0
        Me.menuItemDelete.Name = "menuItemDelete"
        Me.menuItemDelete.Size = New System.Drawing.Size(107, 22)
        Me.menuItemDelete.Text = "Delete"
        '
        'lblAttach
        '
        Me.lblAttach.Location = New System.Drawing.Point(0, 131)
        Me.lblAttach.Name = "lblAttach"
        Me.lblAttach.Size = New System.Drawing.Size(80, 16)
        Me.lblAttach.TabIndex = 17
        Me.lblAttach.Text = "Attachments:"
        Me.lblAttach.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtSubject
        '
        Me.txtSubject.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.txtSubject.Location = New System.Drawing.Point(88, 107)
        Me.txtSubject.Name = "txtSubject"
        Me.txtSubject.Size = New System.Drawing.Size(664, 20)
        Me.txtSubject.TabIndex = 16
        '
        'lblSubject
        '
        Me.lblSubject.Location = New System.Drawing.Point(0, 107)
        Me.lblSubject.Name = "lblSubject"
        Me.lblSubject.Size = New System.Drawing.Size(80, 16)
        Me.lblSubject.TabIndex = 15
        Me.lblSubject.Text = "Subject:"
        Me.lblSubject.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtCc
        '
        Me.txtCc.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.txtCc.Location = New System.Drawing.Point(88, 83)
        Me.txtCc.Name = "txtCc"
        Me.txtCc.Size = New System.Drawing.Size(664, 20)
        Me.txtCc.TabIndex = 14
        '
        'txtTo
        '
        Me.txtTo.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.txtTo.Location = New System.Drawing.Point(88, 59)
        Me.txtTo.Name = "txtTo"
        Me.txtTo.Size = New System.Drawing.Size(664, 20)
        Me.txtTo.TabIndex = 13
        '
        'txtBody
        '
        Me.txtBody.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
            Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.txtBody.Location = New System.Drawing.Point(3, 193)
        Me.txtBody.Multiline = True
        Me.txtBody.Name = "txtBody"
        Me.txtBody.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtBody.Size = New System.Drawing.Size(749, 221)
        Me.txtBody.TabIndex = 17
        '
        'lblCc
        '
        Me.lblCc.Location = New System.Drawing.Point(0, 83)
        Me.lblCc.Name = "lblCc"
        Me.lblCc.Size = New System.Drawing.Size(80, 16)
        Me.lblCc.TabIndex = 12
        Me.lblCc.Text = "Cc:"
        Me.lblCc.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'lblTo
        '
        Me.lblTo.Location = New System.Drawing.Point(0, 59)
        Me.lblTo.Name = "lblTo"
        Me.lblTo.Size = New System.Drawing.Size(80, 16)
        Me.lblTo.TabIndex = 11
        Me.lblTo.Text = "To:"
        Me.lblTo.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'MailEditor
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(760, 417)
        Me.Controls.Add(Me.txtFrom)
        Me.Controls.Add(Me.txtSubject)
        Me.Controls.Add(Me.txtCc)
        Me.Controls.Add(Me.txtTo)
        Me.Controls.Add(Me.txtBody)
        Me.Controls.Add(Me.lblFrom)
        Me.Controls.Add(Me.listBoxAttachments)
        Me.Controls.Add(Me.lblAttach)
        Me.Controls.Add(Me.lblSubject)
        Me.Controls.Add(Me.lblCc)
        Me.Controls.Add(Me.lblTo)
        Me.Controls.Add(Me.mainMenu)
        Me.MainMenuStrip = Me.mainMenu
        Me.Name = "MailEditor"
        Me.Text = "MSG Mail Message Editor"
        Me.mainMenu.ResumeLayout(False)
        Me.mainMenu.PerformLayout()
        Me.contextMenuAttach.ResumeLayout(False)
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

End Class 'MailEditor 
