473,287 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Windows Form problem in Designer

Hi,

I have a form that when opened in the designer appears of the screen. The
form selector can't be dragged (or resized) and if I scroll right and down
to centralise it the form simply jumps further away, completely leaving the
selector box area.

Any ideas? VS 2003 and VB.Net

This is a simple application at the moment but the form is inherited from a
base form. The solution consists of a base form and two forms that inherit
the baseform. No other functionality at this stage. The solution builds and
runs as expected the only problem is the designer for both inherited forms.
A new form when inserted behaves as expected, but a new inherited form also
skips off screen in the designer.

The base form has one label control and one OK button.

--

Rod Gill
Nov 21 '05 #1
4 3112
Hey that's pretty funky! I've dealt with compiler and parser problems
before, but not this. Can you show us the source code for the base class and
the inherited class so we can try and duplicate the problem here?

-B

"Rod Gill" <rod AT project-systems DOT co DOT nz> wrote in message
news:OU**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a form that when opened in the designer appears of the screen. The
form selector can't be dragged (or resized) and if I scroll right and down
to centralise it the form simply jumps further away, completely leaving
the selector box area.

Any ideas? VS 2003 and VB.Net

This is a simple application at the moment but the form is inherited from
a base form. The solution consists of a base form and two forms that
inherit the baseform. No other functionality at this stage. The solution
builds and runs as expected the only problem is the designer for both
inherited forms. A new form when inserted behaves as expected, but a new
inherited form also skips off screen in the designer.

The base form has one label control and one OK button.

--

Rod Gill

Nov 21 '05 #2
Base form first then inherited form: thanks.

Imports System.Windows.Forms

Imports System.Drawing

Public Class BaseForm

Inherits System.Windows.Forms.Form

Private mouseOffset As Point

Private isMouseDown As Boolean = False

Const fWidth = 500

Const fHeight = 500

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'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.

Friend WithEvents OK As System.Windows.Forms.Button

Friend WithEvents Title As System.Windows.Forms.Label

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.OK = New System.Windows.Forms.Button

Me.Title = New System.Windows.Forms.Label

Me.SuspendLayout()

'

'OK

'

Me.OK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or
System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)

Me.OK.BackColor = System.Drawing.Color.Salmon

Me.OK.Cursor = System.Windows.Forms.Cursors.Hand

Me.OK.DialogResult = System.Windows.Forms.DialogResult.OK

Me.OK.FlatStyle = System.Windows.Forms.FlatStyle.Flat

Me.OK.ForeColor = System.Drawing.Color.White

Me.OK.Location = New System.Drawing.Point(600, 320)

Me.OK.Name = "OK"

Me.OK.TabIndex = 1

Me.OK.Text = "OK"

'

'Title

'

Me.Title.Anchor = System.Windows.Forms.AnchorStyles.Top

Me.Title.Font = New System.Drawing.Font("Microsoft Sans Serif",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Title.ForeColor = System.Drawing.Color.Goldenrod

Me.Title.Location = New System.Drawing.Point(168, 32)

Me.Title.Name = "Title"

Me.Title.Size = New System.Drawing.Size(408, 40)

Me.Title.TabIndex = 0

Me.Title.Text = "Project Program Manager .Net"

Me.Title.TextAlign = System.Drawing.ContentAlignment.TopCenter

'

'BaseForm

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.BackColor = System.Drawing.Color.CadetBlue

Me.ClientSize = New System.Drawing.Size(760, 584)

Me.Controls.Add(Me.Title)

Me.Controls.Add(Me.OK)

Me.Cursor = System.Windows.Forms.Cursors.Default

Me.ForeColor = System.Drawing.Color.White

Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None

Me.Name = "BaseForm"

Me.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScree n

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub BaseForm_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Draw Form

Me.FormBorderStyle = FormBorderStyle.None

OnBaseFormLoad()

Dim p As New System.Drawing.Drawing2D.GraphicsPath

Dim CurveSize As Int32 = 250

p.StartFigure()

p.AddArc(New Rectangle(0, 0, CurveSize, CurveSize), 180, 90)

p.AddLine(CurveSize, 0, Me.Width - CurveSize, 0)

p.AddArc(New Rectangle(Me.Width - CurveSize, 0, CurveSize,
CurveSize), -90, 90)

p.AddLine(Me.Width, CurveSize, Me.Width, Me.Height - CurveSize)

p.AddArc(New Rectangle(Me.Width - CurveSize, Me.Height - CurveSize,
CurveSize, CurveSize), 0, 90)

p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)

p.AddArc(New Rectangle(0, Me.Height - CurveSize, CurveSize,
CurveSize), 90, 90)

p.CloseFigure()

Me.Region = New Region(p)

Me.BackColor = Color.Teal

p.Dispose()

End Sub

Private Sub BaseForm_MouseDown(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseDown

Dim xOffset As Integer

Dim yOffset As Integer

If e.Button = MouseButtons.Left Then

xOffset = -e.X - SystemInformation.FrameBorderSize.Width

yOffset = -e.Y - SystemInformation.CaptionHeight - _

SystemInformation.FrameBorderSize.Height

mouseOffset = New Point(xOffset, yOffset)

isMouseDown = True

End If

End Sub

Private Sub BaseForm_MouseUp(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseUp

' Changes the isMouseDown field so that the form does

' not move unless the user is pressing the left mouse button.

If e.Button = MouseButtons.Left Then

isMouseDown = False

End If

End Sub

Private Sub oldbtest_MouseMove(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseMove

If isMouseDown Then

Dim mousePos As Point = Control.MousePosition

mousePos.Offset(mouseOffset.X, mouseOffset.Y)

Location = mousePos

End If

End Sub

Private Sub OK_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles OK.Click

Me.DialogResult = DialogResult.OK

Me.Close()

End Sub

Private Sub OK_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles OK.Paint

Dim p As New Drawing2D.GraphicsPath

p.AddEllipse(New Rectangle(30, 30, 42, 40))

With OK

.Region = New Region(p)

.BackColor = Color.CadetBlue

.ForeColor = Color.White

.Size = New Size(100, 100)

End With

OnOKPaint()

p.Dispose()

End Sub

Protected Overridable Sub OnOKPaint()

Me.Location = New Point(Me.Width - 115, Me.Height - 115)

End Sub

Protected Overridable Sub OnBaseFormLoad()

Me.StartPosition = FormStartPosition.CenterScreen

Me.Size = New Size(800, 500)

OnOKPaint()

End Sub

End Class

Inherited Form

Public Class MainMenu

Inherits Net.BaseForm

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

Me.Size = New Size(750, 500)

End Sub

'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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'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.

Friend WithEvents ProgramCenter As System.Windows.Forms.Button

Friend WithEvents ProjectCenter As System.Windows.Forms.Button

Friend WithEvents Enterprise As System.Windows.Forms.Button

Friend WithEvents EnterpriseText As System.Windows.Forms.TextBox

Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

Friend WithEvents TextBox2 As System.Windows.Forms.TextBox

Friend WithEvents TextBox3 As System.Windows.Forms.TextBox

Friend WithEvents Options As System.Windows.Forms.Button

Friend WithEvents Tools As System.Windows.Forms.Button

Friend WithEvents TextBox4 As System.Windows.Forms.TextBox

Friend WithEvents TextBox5 As System.Windows.Forms.TextBox

Friend WithEvents WeeklyProcess As System.Windows.Forms.Button

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.Enterprise = New System.Windows.Forms.Button

Me.ProgramCenter = New System.Windows.Forms.Button

Me.ProjectCenter = New System.Windows.Forms.Button

Me.EnterpriseText = New System.Windows.Forms.TextBox

Me.TextBox1 = New System.Windows.Forms.TextBox

Me.TextBox2 = New System.Windows.Forms.TextBox

Me.Options = New System.Windows.Forms.Button

Me.TextBox3 = New System.Windows.Forms.TextBox

Me.Tools = New System.Windows.Forms.Button

Me.TextBox4 = New System.Windows.Forms.TextBox

Me.WeeklyProcess = New System.Windows.Forms.Button

Me.TextBox5 = New System.Windows.Forms.TextBox

Me.SuspendLayout()

'

'Enterprise

'

Me.Enterprise.Font = New System.Drawing.Font("Microsoft Sans Serif",
12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Enterprise.ForeColor = System.Drawing.Color.White

Me.Enterprise.Location = New System.Drawing.Point(72, 104)

Me.Enterprise.Name = "Enterprise"

Me.Enterprise.Size = New System.Drawing.Size(192, 56)

Me.Enterprise.TabIndex = 2

Me.Enterprise.Text = "Enterprise"

'

'ProgramCenter

'

Me.ProgramCenter.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.ProgramCenter.ForeColor = System.Drawing.Color.White

Me.ProgramCenter.Location = New System.Drawing.Point(72, 168)

Me.ProgramCenter.Name = "ProgramCenter"

Me.ProgramCenter.Size = New System.Drawing.Size(192, 56)

Me.ProgramCenter.TabIndex = 3

Me.ProgramCenter.Text = "Program Center"

'

'ProjectCenter

'

Me.ProjectCenter.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.ProjectCenter.ForeColor = System.Drawing.Color.White

Me.ProjectCenter.Location = New System.Drawing.Point(72, 232)

Me.ProjectCenter.Name = "ProjectCenter"

Me.ProjectCenter.Size = New System.Drawing.Size(192, 56)

Me.ProjectCenter.TabIndex = 4

Me.ProjectCenter.Text = "Project Center"

'

'EnterpriseText

'

Me.EnterpriseText.AutoSize = False

Me.EnterpriseText.BackColor = System.Drawing.Color.Teal

Me.EnterpriseText.BorderStyle =
System.Windows.Forms.BorderStyle.None

Me.EnterpriseText.Location = New System.Drawing.Point(280, 125)

Me.EnterpriseText.Multiline = True

Me.EnterpriseText.Name = "EnterpriseText"

Me.EnterpriseText.Size = New System.Drawing.Size(408, 32)

Me.EnterpriseText.TabIndex = 5

Me.EnterpriseText.Text = "Report on, add, edit and maintain groups
of Programs"

'

'TextBox1

'

Me.TextBox1.AutoSize = False

Me.TextBox1.BackColor = System.Drawing.Color.Teal

Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox1.Location = New System.Drawing.Point(280, 192)

Me.TextBox1.Multiline = True

Me.TextBox1.Name = "TextBox1"

Me.TextBox1.Size = New System.Drawing.Size(408, 32)

Me.TextBox1.TabIndex = 6

Me.TextBox1.Text = "Report on, add, edit and maintain Programs of
Projects"

'

'TextBox2

'

Me.TextBox2.AutoSize = False

Me.TextBox2.BackColor = System.Drawing.Color.Teal

Me.TextBox2.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox2.Location = New System.Drawing.Point(280, 255)

Me.TextBox2.Multiline = True

Me.TextBox2.Name = "TextBox2"

Me.TextBox2.Size = New System.Drawing.Size(408, 32)

Me.TextBox2.TabIndex = 7

Me.TextBox2.Text = "Report on, add, edit and maintain individual
Projects"

'

'Options

'

Me.Options.Font = New System.Drawing.Font("Microsoft Sans Serif",
12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Options.ForeColor = System.Drawing.Color.White

Me.Options.Location = New System.Drawing.Point(72, 424)

Me.Options.Name = "Options"

Me.Options.Size = New System.Drawing.Size(192, 56)

Me.Options.TabIndex = 8

Me.Options.Text = "Options"

'

'TextBox3

'

Me.TextBox3.AutoSize = False

Me.TextBox3.BackColor = System.Drawing.Color.Teal

Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox3.Location = New System.Drawing.Point(280, 382)

Me.TextBox3.Multiline = True

Me.TextBox3.Name = "TextBox3"

Me.TextBox3.Size = New System.Drawing.Size(408, 32)

Me.TextBox3.TabIndex = 9

Me.TextBox3.Text = "Run the weekly process on all Projects"

'

'Tools

'

Me.Tools.Font = New System.Drawing.Font("Microsoft Sans Serif",
12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Tools.ForeColor = System.Drawing.Color.White

Me.Tools.Location = New System.Drawing.Point(72, 296)

Me.Tools.Name = "Tools"

Me.Tools.Size = New System.Drawing.Size(192, 56)

Me.Tools.TabIndex = 10

Me.Tools.Text = "Tools"

'

'TextBox4

'

Me.TextBox4.AutoSize = False

Me.TextBox4.BackColor = System.Drawing.Color.Teal

Me.TextBox4.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox4.Location = New System.Drawing.Point(280, 319)

Me.TextBox4.Multiline = True

Me.TextBox4.Name = "TextBox4"

Me.TextBox4.Size = New System.Drawing.Size(488, 32)

Me.TextBox4.TabIndex = 11

Me.TextBox4.Text = "Tools to create consoildated projects, Maintain
Calendars, Change pay rate tables" & _

" and more"

'

'WeeklyProcess

'

Me.WeeklyProcess.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.WeeklyProcess.ForeColor = System.Drawing.Color.White

Me.WeeklyProcess.Location = New System.Drawing.Point(72, 360)

Me.WeeklyProcess.Name = "WeeklyProcess"

Me.WeeklyProcess.Size = New System.Drawing.Size(192, 56)

Me.WeeklyProcess.TabIndex = 12

Me.WeeklyProcess.Text = "Weekly Process"

'

'TextBox5

'

Me.TextBox5.AutoSize = False

Me.TextBox5.BackColor = System.Drawing.Color.Teal

Me.TextBox5.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox5.Location = New System.Drawing.Point(280, 448)

Me.TextBox5.Multiline = True

Me.TextBox5.Name = "TextBox5"

Me.TextBox5.Size = New System.Drawing.Size(304, 32)

Me.TextBox5.TabIndex = 13

Me.TextBox5.Text = "Set options for Projects and PPM.Net"

'

'MainMenu

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.AutoScroll = True

Me.BackColor = System.Drawing.Color.Teal

Me.ClientSize = New System.Drawing.Size(800, 500)

Me.Controls.Add(Me.WeeklyProcess)

Me.Controls.Add(Me.TextBox4)

Me.Controls.Add(Me.Tools)

Me.Controls.Add(Me.TextBox3)

Me.Controls.Add(Me.Options)

Me.Controls.Add(Me.TextBox2)

Me.Controls.Add(Me.TextBox1)

Me.Controls.Add(Me.EnterpriseText)

Me.Controls.Add(Me.ProjectCenter)

Me.Controls.Add(Me.ProgramCenter)

Me.Controls.Add(Me.Enterprise)

Me.Controls.Add(Me.TextBox5)

Me.Name = "MainMenu"

Me.Controls.SetChildIndex(Me.TextBox5, 0)

Me.Controls.SetChildIndex(Me.Enterprise, 0)

Me.Controls.SetChildIndex(Me.ProgramCenter, 0)

Me.Controls.SetChildIndex(Me.ProjectCenter, 0)

Me.Controls.SetChildIndex(Me.EnterpriseText, 0)

Me.Controls.SetChildIndex(Me.TextBox1, 0)

Me.Controls.SetChildIndex(Me.TextBox2, 0)

Me.Controls.SetChildIndex(Me.Options, 0)

Me.Controls.SetChildIndex(Me.TextBox3, 0)

Me.Controls.SetChildIndex(Me.Tools, 0)

Me.Controls.SetChildIndex(Me.TextBox4, 0)

Me.Controls.SetChildIndex(Me.WeeklyProcess, 0)

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Enterprise_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Enterprise.Click

MessageBox.Show("Enterprise Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

Private Sub ProgramCenter_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ProgramCenter.Click

MessageBox.Show("Program Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

Private Sub ProjectCenter_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ProjectCenter.Click

MessageBox.Show("Project Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

' Private Sub MainMenu_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

' Me.Size = New Size(800, 500)

' End Sub

Private Sub MainMenu_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

OnBaseFormLoad()

End Sub

Protected Overrides Sub OnOKPaint()

Me.OK.Location = New Point(Me.Width - 120, Me.Height - 120)

End Sub

Protected Overloads Sub OnBaseFormLoad()

Me.StartPosition = FormStartPosition.CenterScreen

Me.Size = New Size(800, 500)

End Sub

End Class


--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more
"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
Hey that's pretty funky! I've dealt with compiler and parser problems
before, but not this. Can you show us the source code for the base class
and the inherited class so we can try and duplicate the problem here?

-B

"Rod Gill" <rod AT project-systems DOT co DOT nz> wrote in message
news:OU**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a form that when opened in the designer appears of the screen. The
form selector can't be dragged (or resized) and if I scroll right and
down to centralise it the form simply jumps further away, completely
leaving the selector box area.

Any ideas? VS 2003 and VB.Net

This is a simple application at the moment but the form is inherited from
a base form. The solution consists of a base form and two forms that
inherit the baseform. No other functionality at this stage. The solution
builds and runs as expected the only problem is the designer for both
inherited forms. A new form when inserted behaves as expected, but a new
inherited form also skips off screen in the designer.

The base form has one label control and one OK button.

--

Rod Gill


Nov 21 '05 #3
Okay, I see. You need to remember that all that MouseDown and Load code in
your base class will run even in the designer. So you need to check for that
using the Me.DesignMode property. It will return True if you are in the
designer. I placed this check in your OnBaseFormLoad method and it looks
like it fixed the problem.

"Rod Gill" <rod AT project-systems DOT co DOT nz> wrote in message
news:eV*************@TK2MSFTNGP15.phx.gbl...
Base form first then inherited form: thanks.

Imports System.Windows.Forms

Imports System.Drawing

Public Class BaseForm

Inherits System.Windows.Forms.Form

Private mouseOffset As Point

Private isMouseDown As Boolean = False

Const fWidth = 500

Const fHeight = 500

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'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.

Friend WithEvents OK As System.Windows.Forms.Button

Friend WithEvents Title As System.Windows.Forms.Label

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.OK = New System.Windows.Forms.Button

Me.Title = New System.Windows.Forms.Label

Me.SuspendLayout()

'

'OK

'

Me.OK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or
System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)

Me.OK.BackColor = System.Drawing.Color.Salmon

Me.OK.Cursor = System.Windows.Forms.Cursors.Hand

Me.OK.DialogResult = System.Windows.Forms.DialogResult.OK

Me.OK.FlatStyle = System.Windows.Forms.FlatStyle.Flat

Me.OK.ForeColor = System.Drawing.Color.White

Me.OK.Location = New System.Drawing.Point(600, 320)

Me.OK.Name = "OK"

Me.OK.TabIndex = 1

Me.OK.Text = "OK"

'

'Title

'

Me.Title.Anchor = System.Windows.Forms.AnchorStyles.Top

Me.Title.Font = New System.Drawing.Font("Microsoft Sans Serif",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Title.ForeColor = System.Drawing.Color.Goldenrod

Me.Title.Location = New System.Drawing.Point(168, 32)

Me.Title.Name = "Title"

Me.Title.Size = New System.Drawing.Size(408, 40)

Me.Title.TabIndex = 0

Me.Title.Text = "Project Program Manager .Net"

Me.Title.TextAlign = System.Drawing.ContentAlignment.TopCenter

'

'BaseForm

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.BackColor = System.Drawing.Color.CadetBlue

Me.ClientSize = New System.Drawing.Size(760, 584)

Me.Controls.Add(Me.Title)

Me.Controls.Add(Me.OK)

Me.Cursor = System.Windows.Forms.Cursors.Default

Me.ForeColor = System.Drawing.Color.White

Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None

Me.Name = "BaseForm"

Me.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScree n

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub BaseForm_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Draw Form

Me.FormBorderStyle = FormBorderStyle.None

OnBaseFormLoad()

Dim p As New System.Drawing.Drawing2D.GraphicsPath

Dim CurveSize As Int32 = 250

p.StartFigure()

p.AddArc(New Rectangle(0, 0, CurveSize, CurveSize), 180, 90)

p.AddLine(CurveSize, 0, Me.Width - CurveSize, 0)

p.AddArc(New Rectangle(Me.Width - CurveSize, 0, CurveSize,
CurveSize), -90, 90)

p.AddLine(Me.Width, CurveSize, Me.Width, Me.Height - CurveSize)

p.AddArc(New Rectangle(Me.Width - CurveSize, Me.Height - CurveSize,
CurveSize, CurveSize), 0, 90)

p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)

p.AddArc(New Rectangle(0, Me.Height - CurveSize, CurveSize,
CurveSize), 90, 90)

p.CloseFigure()

Me.Region = New Region(p)

Me.BackColor = Color.Teal

p.Dispose()

End Sub

Private Sub BaseForm_MouseDown(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseDown

Dim xOffset As Integer

Dim yOffset As Integer

If e.Button = MouseButtons.Left Then

xOffset = -e.X - SystemInformation.FrameBorderSize.Width

yOffset = -e.Y - SystemInformation.CaptionHeight - _

SystemInformation.FrameBorderSize.Height

mouseOffset = New Point(xOffset, yOffset)

isMouseDown = True

End If

End Sub

Private Sub BaseForm_MouseUp(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseUp

' Changes the isMouseDown field so that the form does

' not move unless the user is pressing the left mouse button.

If e.Button = MouseButtons.Left Then

isMouseDown = False

End If

End Sub

Private Sub oldbtest_MouseMove(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseMove

If isMouseDown Then

Dim mousePos As Point = Control.MousePosition

mousePos.Offset(mouseOffset.X, mouseOffset.Y)

Location = mousePos

End If

End Sub

Private Sub OK_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles OK.Click

Me.DialogResult = DialogResult.OK

Me.Close()

End Sub

Private Sub OK_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles OK.Paint

Dim p As New Drawing2D.GraphicsPath

p.AddEllipse(New Rectangle(30, 30, 42, 40))

With OK

.Region = New Region(p)

.BackColor = Color.CadetBlue

.ForeColor = Color.White

.Size = New Size(100, 100)

End With

OnOKPaint()

p.Dispose()

End Sub

Protected Overridable Sub OnOKPaint()

Me.Location = New Point(Me.Width - 115, Me.Height - 115)

End Sub

Protected Overridable Sub OnBaseFormLoad()

Me.StartPosition = FormStartPosition.CenterScreen

Me.Size = New Size(800, 500)

OnOKPaint()

End Sub

End Class

Inherited Form

Public Class MainMenu

Inherits Net.BaseForm

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

Me.Size = New Size(750, 500)

End Sub

'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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'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.

Friend WithEvents ProgramCenter As System.Windows.Forms.Button

Friend WithEvents ProjectCenter As System.Windows.Forms.Button

Friend WithEvents Enterprise As System.Windows.Forms.Button

Friend WithEvents EnterpriseText As System.Windows.Forms.TextBox

Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

Friend WithEvents TextBox2 As System.Windows.Forms.TextBox

Friend WithEvents TextBox3 As System.Windows.Forms.TextBox

Friend WithEvents Options As System.Windows.Forms.Button

Friend WithEvents Tools As System.Windows.Forms.Button

Friend WithEvents TextBox4 As System.Windows.Forms.TextBox

Friend WithEvents TextBox5 As System.Windows.Forms.TextBox

Friend WithEvents WeeklyProcess As System.Windows.Forms.Button

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.Enterprise = New System.Windows.Forms.Button

Me.ProgramCenter = New System.Windows.Forms.Button

Me.ProjectCenter = New System.Windows.Forms.Button

Me.EnterpriseText = New System.Windows.Forms.TextBox

Me.TextBox1 = New System.Windows.Forms.TextBox

Me.TextBox2 = New System.Windows.Forms.TextBox

Me.Options = New System.Windows.Forms.Button

Me.TextBox3 = New System.Windows.Forms.TextBox

Me.Tools = New System.Windows.Forms.Button

Me.TextBox4 = New System.Windows.Forms.TextBox

Me.WeeklyProcess = New System.Windows.Forms.Button

Me.TextBox5 = New System.Windows.Forms.TextBox

Me.SuspendLayout()

'

'Enterprise

'

Me.Enterprise.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Enterprise.ForeColor = System.Drawing.Color.White

Me.Enterprise.Location = New System.Drawing.Point(72, 104)

Me.Enterprise.Name = "Enterprise"

Me.Enterprise.Size = New System.Drawing.Size(192, 56)

Me.Enterprise.TabIndex = 2

Me.Enterprise.Text = "Enterprise"

'

'ProgramCenter

'

Me.ProgramCenter.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.ProgramCenter.ForeColor = System.Drawing.Color.White

Me.ProgramCenter.Location = New System.Drawing.Point(72, 168)

Me.ProgramCenter.Name = "ProgramCenter"

Me.ProgramCenter.Size = New System.Drawing.Size(192, 56)

Me.ProgramCenter.TabIndex = 3

Me.ProgramCenter.Text = "Program Center"

'

'ProjectCenter

'

Me.ProjectCenter.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.ProjectCenter.ForeColor = System.Drawing.Color.White

Me.ProjectCenter.Location = New System.Drawing.Point(72, 232)

Me.ProjectCenter.Name = "ProjectCenter"

Me.ProjectCenter.Size = New System.Drawing.Size(192, 56)

Me.ProjectCenter.TabIndex = 4

Me.ProjectCenter.Text = "Project Center"

'

'EnterpriseText

'

Me.EnterpriseText.AutoSize = False

Me.EnterpriseText.BackColor = System.Drawing.Color.Teal

Me.EnterpriseText.BorderStyle =
System.Windows.Forms.BorderStyle.None

Me.EnterpriseText.Location = New System.Drawing.Point(280, 125)

Me.EnterpriseText.Multiline = True

Me.EnterpriseText.Name = "EnterpriseText"

Me.EnterpriseText.Size = New System.Drawing.Size(408, 32)

Me.EnterpriseText.TabIndex = 5

Me.EnterpriseText.Text = "Report on, add, edit and maintain groups
of Programs"

'

'TextBox1

'

Me.TextBox1.AutoSize = False

Me.TextBox1.BackColor = System.Drawing.Color.Teal

Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox1.Location = New System.Drawing.Point(280, 192)

Me.TextBox1.Multiline = True

Me.TextBox1.Name = "TextBox1"

Me.TextBox1.Size = New System.Drawing.Size(408, 32)

Me.TextBox1.TabIndex = 6

Me.TextBox1.Text = "Report on, add, edit and maintain Programs of
Projects"

'

'TextBox2

'

Me.TextBox2.AutoSize = False

Me.TextBox2.BackColor = System.Drawing.Color.Teal

Me.TextBox2.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox2.Location = New System.Drawing.Point(280, 255)

Me.TextBox2.Multiline = True

Me.TextBox2.Name = "TextBox2"

Me.TextBox2.Size = New System.Drawing.Size(408, 32)

Me.TextBox2.TabIndex = 7

Me.TextBox2.Text = "Report on, add, edit and maintain individual
Projects"

'

'Options

'

Me.Options.Font = New System.Drawing.Font("Microsoft Sans Serif",
12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Options.ForeColor = System.Drawing.Color.White

Me.Options.Location = New System.Drawing.Point(72, 424)

Me.Options.Name = "Options"

Me.Options.Size = New System.Drawing.Size(192, 56)

Me.Options.TabIndex = 8

Me.Options.Text = "Options"

'

'TextBox3

'

Me.TextBox3.AutoSize = False

Me.TextBox3.BackColor = System.Drawing.Color.Teal

Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox3.Location = New System.Drawing.Point(280, 382)

Me.TextBox3.Multiline = True

Me.TextBox3.Name = "TextBox3"

Me.TextBox3.Size = New System.Drawing.Size(408, 32)

Me.TextBox3.TabIndex = 9

Me.TextBox3.Text = "Run the weekly process on all Projects"

'

'Tools

'

Me.Tools.Font = New System.Drawing.Font("Microsoft Sans Serif",
12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Tools.ForeColor = System.Drawing.Color.White

Me.Tools.Location = New System.Drawing.Point(72, 296)

Me.Tools.Name = "Tools"

Me.Tools.Size = New System.Drawing.Size(192, 56)

Me.Tools.TabIndex = 10

Me.Tools.Text = "Tools"

'

'TextBox4

'

Me.TextBox4.AutoSize = False

Me.TextBox4.BackColor = System.Drawing.Color.Teal

Me.TextBox4.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox4.Location = New System.Drawing.Point(280, 319)

Me.TextBox4.Multiline = True

Me.TextBox4.Name = "TextBox4"

Me.TextBox4.Size = New System.Drawing.Size(488, 32)

Me.TextBox4.TabIndex = 11

Me.TextBox4.Text = "Tools to create consoildated projects, Maintain
Calendars, Change pay rate tables" & _

" and more"

'

'WeeklyProcess

'

Me.WeeklyProcess.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.WeeklyProcess.ForeColor = System.Drawing.Color.White

Me.WeeklyProcess.Location = New System.Drawing.Point(72, 360)

Me.WeeklyProcess.Name = "WeeklyProcess"

Me.WeeklyProcess.Size = New System.Drawing.Size(192, 56)

Me.WeeklyProcess.TabIndex = 12

Me.WeeklyProcess.Text = "Weekly Process"

'

'TextBox5

'

Me.TextBox5.AutoSize = False

Me.TextBox5.BackColor = System.Drawing.Color.Teal

Me.TextBox5.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox5.Location = New System.Drawing.Point(280, 448)

Me.TextBox5.Multiline = True

Me.TextBox5.Name = "TextBox5"

Me.TextBox5.Size = New System.Drawing.Size(304, 32)

Me.TextBox5.TabIndex = 13

Me.TextBox5.Text = "Set options for Projects and PPM.Net"

'

'MainMenu

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.AutoScroll = True

Me.BackColor = System.Drawing.Color.Teal

Me.ClientSize = New System.Drawing.Size(800, 500)

Me.Controls.Add(Me.WeeklyProcess)

Me.Controls.Add(Me.TextBox4)

Me.Controls.Add(Me.Tools)

Me.Controls.Add(Me.TextBox3)

Me.Controls.Add(Me.Options)

Me.Controls.Add(Me.TextBox2)

Me.Controls.Add(Me.TextBox1)

Me.Controls.Add(Me.EnterpriseText)

Me.Controls.Add(Me.ProjectCenter)

Me.Controls.Add(Me.ProgramCenter)

Me.Controls.Add(Me.Enterprise)

Me.Controls.Add(Me.TextBox5)

Me.Name = "MainMenu"

Me.Controls.SetChildIndex(Me.TextBox5, 0)

Me.Controls.SetChildIndex(Me.Enterprise, 0)

Me.Controls.SetChildIndex(Me.ProgramCenter, 0)

Me.Controls.SetChildIndex(Me.ProjectCenter, 0)

Me.Controls.SetChildIndex(Me.EnterpriseText, 0)

Me.Controls.SetChildIndex(Me.TextBox1, 0)

Me.Controls.SetChildIndex(Me.TextBox2, 0)

Me.Controls.SetChildIndex(Me.Options, 0)

Me.Controls.SetChildIndex(Me.TextBox3, 0)

Me.Controls.SetChildIndex(Me.Tools, 0)

Me.Controls.SetChildIndex(Me.TextBox4, 0)

Me.Controls.SetChildIndex(Me.WeeklyProcess, 0)

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Enterprise_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Enterprise.Click

MessageBox.Show("Enterprise Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

Private Sub ProgramCenter_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ProgramCenter.Click

MessageBox.Show("Program Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

Private Sub ProjectCenter_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ProjectCenter.Click

MessageBox.Show("Project Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

' Private Sub MainMenu_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

' Me.Size = New Size(800, 500)

' End Sub

Private Sub MainMenu_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

OnBaseFormLoad()

End Sub

Protected Overrides Sub OnOKPaint()

Me.OK.Location = New Point(Me.Width - 120, Me.Height - 120)

End Sub

Protected Overloads Sub OnBaseFormLoad()

Me.StartPosition = FormStartPosition.CenterScreen

Me.Size = New Size(800, 500)

End Sub

End Class


--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more
"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
Hey that's pretty funky! I've dealt with compiler and parser problems
before, but not this. Can you show us the source code for the base class
and the inherited class so we can try and duplicate the problem here?

-B

"Rod Gill" <rod AT project-systems DOT co DOT nz> wrote in message
news:OU**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a form that when opened in the designer appears of the screen.
The form selector can't be dragged (or resized) and if I scroll right
and down to centralise it the form simply jumps further away, completely
leaving the selector box area.

Any ideas? VS 2003 and VB.Net

This is a simple application at the moment but the form is inherited
from a base form. The solution consists of a base form and two forms
that inherit the baseform. No other functionality at this stage. The
solution builds and runs as expected the only problem is the designer
for both inherited forms. A new form when inserted behaves as expected,
but a new inherited form also skips off screen in the designer.

The base form has one label control and one OK button.

--

Rod Gill



Nov 21 '05 #4
Awesome. That wasn't pointed out that I remember in the article I copied
that code from!. I also had to test in the menu form load event then it
stopped moving.

Many thanks
--

Rod Gill
"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:ef**************@TK2MSFTNGP15.phx.gbl...
Okay, I see. You need to remember that all that MouseDown and Load code in
your base class will run even in the designer. So you need to check for
that using the Me.DesignMode property. It will return True if you are in
the designer. I placed this check in your OnBaseFormLoad method and it
looks like it fixed the problem.

"Rod Gill" <rod AT project-systems DOT co DOT nz> wrote in message
news:eV*************@TK2MSFTNGP15.phx.gbl...
Base form first then inherited form: thanks.

Imports System.Windows.Forms

Imports System.Drawing

Public Class BaseForm

Inherits System.Windows.Forms.Form

Private mouseOffset As Point

Private isMouseDown As Boolean = False

Const fWidth = 500

Const fHeight = 500

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'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.

Friend WithEvents OK As System.Windows.Forms.Button

Friend WithEvents Title As System.Windows.Forms.Label

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.OK = New System.Windows.Forms.Button

Me.Title = New System.Windows.Forms.Label

Me.SuspendLayout()

'

'OK

'

Me.OK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or
System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)

Me.OK.BackColor = System.Drawing.Color.Salmon

Me.OK.Cursor = System.Windows.Forms.Cursors.Hand

Me.OK.DialogResult = System.Windows.Forms.DialogResult.OK

Me.OK.FlatStyle = System.Windows.Forms.FlatStyle.Flat

Me.OK.ForeColor = System.Drawing.Color.White

Me.OK.Location = New System.Drawing.Point(600, 320)

Me.OK.Name = "OK"

Me.OK.TabIndex = 1

Me.OK.Text = "OK"

'

'Title

'

Me.Title.Anchor = System.Windows.Forms.AnchorStyles.Top

Me.Title.Font = New System.Drawing.Font("Microsoft Sans Serif",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Title.ForeColor = System.Drawing.Color.Goldenrod

Me.Title.Location = New System.Drawing.Point(168, 32)

Me.Title.Name = "Title"

Me.Title.Size = New System.Drawing.Size(408, 40)

Me.Title.TabIndex = 0

Me.Title.Text = "Project Program Manager .Net"

Me.Title.TextAlign = System.Drawing.ContentAlignment.TopCenter

'

'BaseForm

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.BackColor = System.Drawing.Color.CadetBlue

Me.ClientSize = New System.Drawing.Size(760, 584)

Me.Controls.Add(Me.Title)

Me.Controls.Add(Me.OK)

Me.Cursor = System.Windows.Forms.Cursors.Default

Me.ForeColor = System.Drawing.Color.White

Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None

Me.Name = "BaseForm"

Me.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScree n

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub BaseForm_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Draw Form

Me.FormBorderStyle = FormBorderStyle.None

OnBaseFormLoad()

Dim p As New System.Drawing.Drawing2D.GraphicsPath

Dim CurveSize As Int32 = 250

p.StartFigure()

p.AddArc(New Rectangle(0, 0, CurveSize, CurveSize), 180, 90)

p.AddLine(CurveSize, 0, Me.Width - CurveSize, 0)

p.AddArc(New Rectangle(Me.Width - CurveSize, 0, CurveSize,
CurveSize), -90, 90)

p.AddLine(Me.Width, CurveSize, Me.Width, Me.Height - CurveSize)

p.AddArc(New Rectangle(Me.Width - CurveSize, Me.Height -
CurveSize, CurveSize, CurveSize), 0, 90)

p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)

p.AddArc(New Rectangle(0, Me.Height - CurveSize, CurveSize,
CurveSize), 90, 90)

p.CloseFigure()

Me.Region = New Region(p)

Me.BackColor = Color.Teal

p.Dispose()

End Sub

Private Sub BaseForm_MouseDown(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseDown

Dim xOffset As Integer

Dim yOffset As Integer

If e.Button = MouseButtons.Left Then

xOffset = -e.X - SystemInformation.FrameBorderSize.Width

yOffset = -e.Y - SystemInformation.CaptionHeight - _

SystemInformation.FrameBorderSize.Height

mouseOffset = New Point(xOffset, yOffset)

isMouseDown = True

End If

End Sub

Private Sub BaseForm_MouseUp(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseUp

' Changes the isMouseDown field so that the form does

' not move unless the user is pressing the left mouse button.

If e.Button = MouseButtons.Left Then

isMouseDown = False

End If

End Sub

Private Sub oldbtest_MouseMove(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseMove

If isMouseDown Then

Dim mousePos As Point = Control.MousePosition

mousePos.Offset(mouseOffset.X, mouseOffset.Y)

Location = mousePos

End If

End Sub

Private Sub OK_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles OK.Click

Me.DialogResult = DialogResult.OK

Me.Close()

End Sub

Private Sub OK_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles OK.Paint

Dim p As New Drawing2D.GraphicsPath

p.AddEllipse(New Rectangle(30, 30, 42, 40))

With OK

.Region = New Region(p)

.BackColor = Color.CadetBlue

.ForeColor = Color.White

.Size = New Size(100, 100)

End With

OnOKPaint()

p.Dispose()

End Sub

Protected Overridable Sub OnOKPaint()

Me.Location = New Point(Me.Width - 115, Me.Height - 115)

End Sub

Protected Overridable Sub OnBaseFormLoad()

Me.StartPosition = FormStartPosition.CenterScreen

Me.Size = New Size(800, 500)

OnOKPaint()

End Sub

End Class

Inherited Form

Public Class MainMenu

Inherits Net.BaseForm

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

Me.Size = New Size(750, 500)

End Sub

'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

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'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.

Friend WithEvents ProgramCenter As System.Windows.Forms.Button

Friend WithEvents ProjectCenter As System.Windows.Forms.Button

Friend WithEvents Enterprise As System.Windows.Forms.Button

Friend WithEvents EnterpriseText As System.Windows.Forms.TextBox

Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

Friend WithEvents TextBox2 As System.Windows.Forms.TextBox

Friend WithEvents TextBox3 As System.Windows.Forms.TextBox

Friend WithEvents Options As System.Windows.Forms.Button

Friend WithEvents Tools As System.Windows.Forms.Button

Friend WithEvents TextBox4 As System.Windows.Forms.TextBox

Friend WithEvents TextBox5 As System.Windows.Forms.TextBox

Friend WithEvents WeeklyProcess As System.Windows.Forms.Button

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

Me.Enterprise = New System.Windows.Forms.Button

Me.ProgramCenter = New System.Windows.Forms.Button

Me.ProjectCenter = New System.Windows.Forms.Button

Me.EnterpriseText = New System.Windows.Forms.TextBox

Me.TextBox1 = New System.Windows.Forms.TextBox

Me.TextBox2 = New System.Windows.Forms.TextBox

Me.Options = New System.Windows.Forms.Button

Me.TextBox3 = New System.Windows.Forms.TextBox

Me.Tools = New System.Windows.Forms.Button

Me.TextBox4 = New System.Windows.Forms.TextBox

Me.WeeklyProcess = New System.Windows.Forms.Button

Me.TextBox5 = New System.Windows.Forms.TextBox

Me.SuspendLayout()

'

'Enterprise

'

Me.Enterprise.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Enterprise.ForeColor = System.Drawing.Color.White

Me.Enterprise.Location = New System.Drawing.Point(72, 104)

Me.Enterprise.Name = "Enterprise"

Me.Enterprise.Size = New System.Drawing.Size(192, 56)

Me.Enterprise.TabIndex = 2

Me.Enterprise.Text = "Enterprise"

'

'ProgramCenter

'

Me.ProgramCenter.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.ProgramCenter.ForeColor = System.Drawing.Color.White

Me.ProgramCenter.Location = New System.Drawing.Point(72, 168)

Me.ProgramCenter.Name = "ProgramCenter"

Me.ProgramCenter.Size = New System.Drawing.Size(192, 56)

Me.ProgramCenter.TabIndex = 3

Me.ProgramCenter.Text = "Program Center"

'

'ProjectCenter

'

Me.ProjectCenter.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.ProjectCenter.ForeColor = System.Drawing.Color.White

Me.ProjectCenter.Location = New System.Drawing.Point(72, 232)

Me.ProjectCenter.Name = "ProjectCenter"

Me.ProjectCenter.Size = New System.Drawing.Size(192, 56)

Me.ProjectCenter.TabIndex = 4

Me.ProjectCenter.Text = "Project Center"

'

'EnterpriseText

'

Me.EnterpriseText.AutoSize = False

Me.EnterpriseText.BackColor = System.Drawing.Color.Teal

Me.EnterpriseText.BorderStyle =
System.Windows.Forms.BorderStyle.None

Me.EnterpriseText.Location = New System.Drawing.Point(280, 125)

Me.EnterpriseText.Multiline = True

Me.EnterpriseText.Name = "EnterpriseText"

Me.EnterpriseText.Size = New System.Drawing.Size(408, 32)

Me.EnterpriseText.TabIndex = 5

Me.EnterpriseText.Text = "Report on, add, edit and maintain groups
of Programs"

'

'TextBox1

'

Me.TextBox1.AutoSize = False

Me.TextBox1.BackColor = System.Drawing.Color.Teal

Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox1.Location = New System.Drawing.Point(280, 192)

Me.TextBox1.Multiline = True

Me.TextBox1.Name = "TextBox1"

Me.TextBox1.Size = New System.Drawing.Size(408, 32)

Me.TextBox1.TabIndex = 6

Me.TextBox1.Text = "Report on, add, edit and maintain Programs of
Projects"

'

'TextBox2

'

Me.TextBox2.AutoSize = False

Me.TextBox2.BackColor = System.Drawing.Color.Teal

Me.TextBox2.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox2.Location = New System.Drawing.Point(280, 255)

Me.TextBox2.Multiline = True

Me.TextBox2.Name = "TextBox2"

Me.TextBox2.Size = New System.Drawing.Size(408, 32)

Me.TextBox2.TabIndex = 7

Me.TextBox2.Text = "Report on, add, edit and maintain individual
Projects"

'

'Options

'

Me.Options.Font = New System.Drawing.Font("Microsoft Sans Serif",
12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Options.ForeColor = System.Drawing.Color.White

Me.Options.Location = New System.Drawing.Point(72, 424)

Me.Options.Name = "Options"

Me.Options.Size = New System.Drawing.Size(192, 56)

Me.Options.TabIndex = 8

Me.Options.Text = "Options"

'

'TextBox3

'

Me.TextBox3.AutoSize = False

Me.TextBox3.BackColor = System.Drawing.Color.Teal

Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox3.Location = New System.Drawing.Point(280, 382)

Me.TextBox3.Multiline = True

Me.TextBox3.Name = "TextBox3"

Me.TextBox3.Size = New System.Drawing.Size(408, 32)

Me.TextBox3.TabIndex = 9

Me.TextBox3.Text = "Run the weekly process on all Projects"

'

'Tools

'

Me.Tools.Font = New System.Drawing.Font("Microsoft Sans Serif",
12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))

Me.Tools.ForeColor = System.Drawing.Color.White

Me.Tools.Location = New System.Drawing.Point(72, 296)

Me.Tools.Name = "Tools"

Me.Tools.Size = New System.Drawing.Size(192, 56)

Me.Tools.TabIndex = 10

Me.Tools.Text = "Tools"

'

'TextBox4

'

Me.TextBox4.AutoSize = False

Me.TextBox4.BackColor = System.Drawing.Color.Teal

Me.TextBox4.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox4.Location = New System.Drawing.Point(280, 319)

Me.TextBox4.Multiline = True

Me.TextBox4.Name = "TextBox4"

Me.TextBox4.Size = New System.Drawing.Size(488, 32)

Me.TextBox4.TabIndex = 11

Me.TextBox4.Text = "Tools to create consoildated projects,
Maintain Calendars, Change pay rate tables" & _

" and more"

'

'WeeklyProcess

'

Me.WeeklyProcess.Font = New System.Drawing.Font("Microsoft Sans
Serif", 12.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.WeeklyProcess.ForeColor = System.Drawing.Color.White

Me.WeeklyProcess.Location = New System.Drawing.Point(72, 360)

Me.WeeklyProcess.Name = "WeeklyProcess"

Me.WeeklyProcess.Size = New System.Drawing.Size(192, 56)

Me.WeeklyProcess.TabIndex = 12

Me.WeeklyProcess.Text = "Weekly Process"

'

'TextBox5

'

Me.TextBox5.AutoSize = False

Me.TextBox5.BackColor = System.Drawing.Color.Teal

Me.TextBox5.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox5.Location = New System.Drawing.Point(280, 448)

Me.TextBox5.Multiline = True

Me.TextBox5.Name = "TextBox5"

Me.TextBox5.Size = New System.Drawing.Size(304, 32)

Me.TextBox5.TabIndex = 13

Me.TextBox5.Text = "Set options for Projects and PPM.Net"

'

'MainMenu

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.AutoScroll = True

Me.BackColor = System.Drawing.Color.Teal

Me.ClientSize = New System.Drawing.Size(800, 500)

Me.Controls.Add(Me.WeeklyProcess)

Me.Controls.Add(Me.TextBox4)

Me.Controls.Add(Me.Tools)

Me.Controls.Add(Me.TextBox3)

Me.Controls.Add(Me.Options)

Me.Controls.Add(Me.TextBox2)

Me.Controls.Add(Me.TextBox1)

Me.Controls.Add(Me.EnterpriseText)

Me.Controls.Add(Me.ProjectCenter)

Me.Controls.Add(Me.ProgramCenter)

Me.Controls.Add(Me.Enterprise)

Me.Controls.Add(Me.TextBox5)

Me.Name = "MainMenu"

Me.Controls.SetChildIndex(Me.TextBox5, 0)

Me.Controls.SetChildIndex(Me.Enterprise, 0)

Me.Controls.SetChildIndex(Me.ProgramCenter, 0)

Me.Controls.SetChildIndex(Me.ProjectCenter, 0)

Me.Controls.SetChildIndex(Me.EnterpriseText, 0)

Me.Controls.SetChildIndex(Me.TextBox1, 0)

Me.Controls.SetChildIndex(Me.TextBox2, 0)

Me.Controls.SetChildIndex(Me.Options, 0)

Me.Controls.SetChildIndex(Me.TextBox3, 0)

Me.Controls.SetChildIndex(Me.Tools, 0)

Me.Controls.SetChildIndex(Me.TextBox4, 0)

Me.Controls.SetChildIndex(Me.WeeklyProcess, 0)

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Enterprise_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Enterprise.Click

MessageBox.Show("Enterprise Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

Private Sub ProgramCenter_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ProgramCenter.Click

MessageBox.Show("Program Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

Private Sub ProjectCenter_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ProjectCenter.Click

MessageBox.Show("Project Form", "Menu", MessageBoxButtons.OK,
MessageBoxIcon.Information)

End Sub

' Private Sub MainMenu_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

' Me.Size = New Size(800, 500)

' End Sub

Private Sub MainMenu_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

OnBaseFormLoad()

End Sub

Protected Overrides Sub OnOKPaint()

Me.OK.Location = New Point(Me.Width - 120, Me.Height - 120)

End Sub

Protected Overloads Sub OnBaseFormLoad()

Me.StartPosition = FormStartPosition.CenterScreen

Me.Size = New Size(800, 500)

End Sub

End Class


--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more
"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
Hey that's pretty funky! I've dealt with compiler and parser problems
before, but not this. Can you show us the source code for the base class
and the inherited class so we can try and duplicate the problem here?

-B

"Rod Gill" <rod AT project-systems DOT co DOT nz> wrote in message
news:OU**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a form that when opened in the designer appears of the screen.
The form selector can't be dragged (or resized) and if I scroll right
and down to centralise it the form simply jumps further away,
completely leaving the selector box area.

Any ideas? VS 2003 and VB.Net

This is a simple application at the moment but the form is inherited
from a base form. The solution consists of a base form and two forms
that inherit the baseform. No other functionality at this stage. The
solution builds and runs as expected the only problem is the designer
for both inherited forms. A new form when inserted behaves as expected,
but a new inherited form also skips off screen in the designer.

The base form has one label control and one OK button.

--

Rod Gill



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: gregory_may | last post by:
This code seems to "work" but I get the following errors: An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll then this one: An unhandled...
6
by: Ayende Rahien | last post by:
Excetremely annoying problem, I've an application with a long startup time. So I created another form with my logo in it to as a splash screen. The splash screen is run from another thread and is...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
8
by: Alison | last post by:
Hi, Al I am trying to design a user interface which provides both menus and toolbars for some users to click on whatever they want to do, at the same time, I would like to have a console window...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
13
by: cj | last post by:
In a project done in 2003 about a year ago I was told to add the SocketWrench code below into the Windows Form Designer generated code area as shown below. #Region " Windows Form Designer...
15
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.