0% found this document useful (0 votes)
15 views3 pages

CPROG2YES

The document contains code for a Windows Forms application with an MDI (Multiple Document Interface) setup. It includes functionalities for opening new forms, managing window layouts, and changing colors and fonts in a RichTextBox. The main form allows users to exit the application and provides menu options for cascading, tiling, and creating new child forms.

Uploaded by

penp15501
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

CPROG2YES

The document contains code for a Windows Forms application with an MDI (Multiple Document Interface) setup. It includes functionalities for opening new forms, managing window layouts, and changing colors and fonts in a RichTextBox. The main form allows users to exit the application and provides menu options for cascading, tiling, and creating new child forms.

Uploaded by

penp15501
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Public Class Form1

‘Needed to allow adding new window forms


Private m_ChildFormNumber As Integer

‘Enables MDI and turn on Maximized window state automatically


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
IsMdiContainer = True
Me.WindowState = FormWindowState.Maximized

End Sub

‘Enables closing of application in MENUSTRIP


Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles ExitToolStripMenuItem.Click

Application.Exit()

End Sub

‘Opens Form inside by using MENUSTRIP


Private Sub FormColorDialogToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
FormColorDialogToolStripMenuItem.Click
FormColorDialog.MdiParent = Me
FormColorDialog.Show()

End Sub
‘Makes the windows cascade
Private Sub CascadeToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CascadeToolStripMenuItem.Click
LayoutMdi(MdiLayout.Cascade)
End Sub

‘Makes the windows align vertically


Private Sub TileVerticalToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
TileVerticalToolStripMenuItem.Click
LayoutMdi(MdiLayout.TileVertical)

End Sub

‘Makes the windows align horizontally


Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
TileHorizontalToolStripMenuItem.Click
LayoutMdi(MdiLayout.TileHorizontal)

End Sub

‘Opens Form inside by using MENUSTRIP


Private Sub Form3ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Form3ToolStripMenuItem.Click
Form3.MdiParent = Me
Form3.Show()

End Sub
‘Allows to open new window forms
Private Sub NewFormToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles NewFormToolStripMenuItem.Click
Dim ChildForm As New System.Windows.Forms.Form
ChildForm.MdiParent = Me
'
m_ChildFormNumber += 1
ChildForm.Text = "Window " & m_ChildFormNumber

ChildForm.Show()

End Sub
End Class

Public Class FormColorDialog


‘Right click CONTEXTMENUSTRIP
Private Sub FormColorDialog_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.ContextMenuStrip = Me.ContextMenuStrip1

End Sub

‘Opens COLORDIALOG for BACKCOLOR


Private Sub BackgroundColorToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BackgroundColorToolStripMenuItem.Click
Me.ColorDialog1.ShowDialog()
Me.BackColor = Me.ColorDialog1.Color

End Sub

‘Opens FONTDIALOG for RICHTEXTBOX


Private Sub ChangeFontToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ChangeFontToolStripMenuItem.Click

Me.FontDialog1.ShowDialog()
Me.RichTextBox1.Font = Me.FontDialog1.Font

End Sub

‘Opens COLORDIALOG for RICHTEXTBOX


Private Sub ChangeFontColorToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ChangeFontColorToolStripMenuItem.Click
Me.ColorDialog1.ShowDialog()
Me.RichTextBox1.ForeColor = Me.ColorDialog1.Color
End Sub
End Class

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy