473,703 Members | 3,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3157
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******** ******@TK2MSFTN GP12.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.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() 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.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

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

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

Me.SuspendLayou t()

'

'OK

'

Me.OK.Anchor = CType((System.W indows.Forms.An chorStyles.Bott om Or
System.Windows. Forms.AnchorSty les.Right), System.Windows. Forms.AnchorSty les)

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

Me.OK.Cursor = System.Windows. Forms.Cursors.H and

Me.OK.DialogRes ult = System.Windows. Forms.DialogRes ult.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.AnchorSty les.Top

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

Me.Title.ForeCo lor = System.Drawing. Color.Goldenrod

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

Me.Title.Name = "Title"

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

Me.Title.TabInd ex = 0

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

Me.Title.TextAl ign = System.Drawing. ContentAlignmen t.TopCenter

'

'BaseForm

'

Me.AutoScaleBas eSize = 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.D efault

Me.ForeColor = System.Drawing. Color.White

Me.FormBorderSt yle = System.Windows. Forms.FormBorde rStyle.None

Me.Name = "BaseForm"

Me.StartPositio n =
System.Windows. Forms.FormStart Position.Center Screen

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub BaseForm_Load(B yVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load

'Draw Form

Me.FormBorderSt yle = FormBorderStyle .None

OnBaseFormLoad( )

Dim p As New System.Drawing. Drawing2D.Graph icsPath

Dim CurveSize As Int32 = 250

p.StartFigure()

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

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

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

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

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

p.AddLine(Me.Wi dth - 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_MouseD own(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseDow n

Dim xOffset As Integer

Dim yOffset As Integer

If e.Button = MouseButtons.Le ft Then

xOffset = -e.X - SystemInformati on.FrameBorderS ize.Width

yOffset = -e.Y - SystemInformati on.CaptionHeigh t - _

SystemInformati on.FrameBorderS ize.Height

mouseOffset = New Point(xOffset, yOffset)

isMouseDown = True

End If

End Sub

Private Sub BaseForm_MouseU p(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.Le ft Then

isMouseDown = False

End If

End Sub

Private Sub oldbtest_MouseM ove(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseMov e

If isMouseDown Then

Dim mousePos As Point = Control.MousePo sition

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

Location = mousePos

End If

End Sub

Private Sub OK_Click(ByVal sender As Object, ByVal e As
System.EventArg s) 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.PaintEven tArgs) Handles OK.Paint

Dim p As New Drawing2D.Graph icsPath

p.AddEllipse(Ne w 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.StartPositio n = FormStartPositi on.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.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() 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.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

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

Me.ProgramCente r = New System.Windows. Forms.Button

Me.ProjectCente r = New System.Windows. Forms.Button

Me.EnterpriseTe xt = 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.WeeklyProces s = New System.Windows. Forms.Button

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

Me.SuspendLayou t()

'

'Enterprise

'

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

Me.Enterprise.F oreColor = System.Drawing. Color.White

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

Me.Enterprise.N ame = "Enterprise "

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

Me.Enterprise.T abIndex = 2

Me.Enterprise.T ext = "Enterprise "

'

'ProgramCenter

'

Me.ProgramCente r.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.ProgramCente r.ForeColor = System.Drawing. Color.White

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

Me.ProgramCente r.Name = "ProgramCen ter"

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

Me.ProgramCente r.TabIndex = 3

Me.ProgramCente r.Text = "Program Center"

'

'ProjectCenter

'

Me.ProjectCente r.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.ProjectCente r.ForeColor = System.Drawing. Color.White

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

Me.ProjectCente r.Name = "ProjectCen ter"

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

Me.ProjectCente r.TabIndex = 4

Me.ProjectCente r.Text = "Project Center"

'

'EnterpriseText

'

Me.EnterpriseTe xt.AutoSize = False

Me.EnterpriseTe xt.BackColor = System.Drawing. Color.Teal

Me.EnterpriseTe xt.BorderStyle =
System.Windows. Forms.BorderSty le.None

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

Me.EnterpriseTe xt.Multiline = True

Me.EnterpriseTe xt.Name = "EnterpriseText "

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

Me.EnterpriseTe xt.TabIndex = 5

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

'

'TextBox1

'

Me.TextBox1.Aut oSize = False

Me.TextBox1.Bac kColor = System.Drawing. Color.Teal

Me.TextBox1.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox1.Mul tiline = True

Me.TextBox1.Nam e = "TextBox1"

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

Me.TextBox1.Tab Index = 6

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

'

'TextBox2

'

Me.TextBox2.Aut oSize = False

Me.TextBox2.Bac kColor = System.Drawing. Color.Teal

Me.TextBox2.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox2.Mul tiline = True

Me.TextBox2.Nam e = "TextBox2"

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

Me.TextBox2.Tab Index = 7

Me.TextBox2.Tex t = "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.Po int,
CType(0, Byte))

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

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

Me.Options.Name = "Options"

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

Me.Options.TabI ndex = 8

Me.Options.Text = "Options"

'

'TextBox3

'

Me.TextBox3.Aut oSize = False

Me.TextBox3.Bac kColor = System.Drawing. Color.Teal

Me.TextBox3.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox3.Mul tiline = True

Me.TextBox3.Nam e = "TextBox3"

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

Me.TextBox3.Tab Index = 9

Me.TextBox3.Tex t = "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.Po int,
CType(0, Byte))

Me.Tools.ForeCo lor = System.Drawing. Color.White

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

Me.Tools.Name = "Tools"

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

Me.Tools.TabInd ex = 10

Me.Tools.Text = "Tools"

'

'TextBox4

'

Me.TextBox4.Aut oSize = False

Me.TextBox4.Bac kColor = System.Drawing. Color.Teal

Me.TextBox4.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox4.Mul tiline = True

Me.TextBox4.Nam e = "TextBox4"

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

Me.TextBox4.Tab Index = 11

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

" and more"

'

'WeeklyProcess

'

Me.WeeklyProces s.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.WeeklyProces s.ForeColor = System.Drawing. Color.White

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

Me.WeeklyProces s.Name = "WeeklyProc ess"

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

Me.WeeklyProces s.TabIndex = 12

Me.WeeklyProces s.Text = "Weekly Process"

'

'TextBox5

'

Me.TextBox5.Aut oSize = False

Me.TextBox5.Bac kColor = System.Drawing. Color.Teal

Me.TextBox5.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox5.Mul tiline = True

Me.TextBox5.Nam e = "TextBox5"

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

Me.TextBox5.Tab Index = 13

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

'

'MainMenu

'

Me.AutoScaleBas eSize = 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.WeeklyProce ss)

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.EnterpriseT ext)

Me.Controls.Add (Me.ProjectCent er)

Me.Controls.Add (Me.ProgramCent er)

Me.Controls.Add (Me.Enterprise)

Me.Controls.Add (Me.TextBox5)

Me.Name = "MainMenu"

Me.Controls.Set ChildIndex(Me.T extBox5, 0)

Me.Controls.Set ChildIndex(Me.E nterprise, 0)

Me.Controls.Set ChildIndex(Me.P rogramCenter, 0)

Me.Controls.Set ChildIndex(Me.P rojectCenter, 0)

Me.Controls.Set ChildIndex(Me.E nterpriseText, 0)

Me.Controls.Set ChildIndex(Me.T extBox1, 0)

Me.Controls.Set ChildIndex(Me.T extBox2, 0)

Me.Controls.Set ChildIndex(Me.O ptions, 0)

Me.Controls.Set ChildIndex(Me.T extBox3, 0)

Me.Controls.Set ChildIndex(Me.T ools, 0)

Me.Controls.Set ChildIndex(Me.T extBox4, 0)

Me.Controls.Set ChildIndex(Me.W eeklyProcess, 0)

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub Enterprise_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles Enterprise.Clic k

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

End Sub

Private Sub ProgramCenter_C lick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ProgramCenter.C lick

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

End Sub

Private Sub ProjectCenter_C lick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ProjectCenter.C lick

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

End Sub

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

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

' End Sub

Private Sub MainMenu_Load(B yVal sender As Object, ByVal e As
System.EventArg s) 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.StartPositio n = FormStartPositi on.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******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P15.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.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() 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.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

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

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

Me.SuspendLayou t()

'

'OK

'

Me.OK.Anchor = CType((System.W indows.Forms.An chorStyles.Bott om Or
System.Windows. Forms.AnchorSty les.Right),
System.Windows. Forms.AnchorSty les)

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

Me.OK.Cursor = System.Windows. Forms.Cursors.H and

Me.OK.DialogRes ult = System.Windows. Forms.DialogRes ult.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.AnchorSty les.Top

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

Me.Title.ForeCo lor = System.Drawing. Color.Goldenrod

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

Me.Title.Name = "Title"

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

Me.Title.TabInd ex = 0

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

Me.Title.TextAl ign = System.Drawing. ContentAlignmen t.TopCenter

'

'BaseForm

'

Me.AutoScaleBas eSize = 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.D efault

Me.ForeColor = System.Drawing. Color.White

Me.FormBorderSt yle = System.Windows. Forms.FormBorde rStyle.None

Me.Name = "BaseForm"

Me.StartPositio n =
System.Windows. Forms.FormStart Position.Center Screen

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub BaseForm_Load(B yVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load

'Draw Form

Me.FormBorderSt yle = FormBorderStyle .None

OnBaseFormLoad( )

Dim p As New System.Drawing. Drawing2D.Graph icsPath

Dim CurveSize As Int32 = 250

p.StartFigure()

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

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

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

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

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

p.AddLine(Me.Wi dth - 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_MouseD own(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseDow n

Dim xOffset As Integer

Dim yOffset As Integer

If e.Button = MouseButtons.Le ft Then

xOffset = -e.X - SystemInformati on.FrameBorderS ize.Width

yOffset = -e.Y - SystemInformati on.CaptionHeigh t - _

SystemInformati on.FrameBorderS ize.Height

mouseOffset = New Point(xOffset, yOffset)

isMouseDown = True

End If

End Sub

Private Sub BaseForm_MouseU p(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.Le ft Then

isMouseDown = False

End If

End Sub

Private Sub oldbtest_MouseM ove(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseMov e

If isMouseDown Then

Dim mousePos As Point = Control.MousePo sition

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

Location = mousePos

End If

End Sub

Private Sub OK_Click(ByVal sender As Object, ByVal e As
System.EventArg s) 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.PaintEven tArgs) Handles OK.Paint

Dim p As New Drawing2D.Graph icsPath

p.AddEllipse(Ne w 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.StartPositio n = FormStartPositi on.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.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() 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.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

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

Me.ProgramCente r = New System.Windows. Forms.Button

Me.ProjectCente r = New System.Windows. Forms.Button

Me.EnterpriseTe xt = 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.WeeklyProces s = New System.Windows. Forms.Button

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

Me.SuspendLayou t()

'

'Enterprise

'

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

Me.Enterprise.F oreColor = System.Drawing. Color.White

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

Me.Enterprise.N ame = "Enterprise "

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

Me.Enterprise.T abIndex = 2

Me.Enterprise.T ext = "Enterprise "

'

'ProgramCenter

'

Me.ProgramCente r.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.ProgramCente r.ForeColor = System.Drawing. Color.White

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

Me.ProgramCente r.Name = "ProgramCen ter"

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

Me.ProgramCente r.TabIndex = 3

Me.ProgramCente r.Text = "Program Center"

'

'ProjectCenter

'

Me.ProjectCente r.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.ProjectCente r.ForeColor = System.Drawing. Color.White

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

Me.ProjectCente r.Name = "ProjectCen ter"

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

Me.ProjectCente r.TabIndex = 4

Me.ProjectCente r.Text = "Project Center"

'

'EnterpriseText

'

Me.EnterpriseTe xt.AutoSize = False

Me.EnterpriseTe xt.BackColor = System.Drawing. Color.Teal

Me.EnterpriseTe xt.BorderStyle =
System.Windows. Forms.BorderSty le.None

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

Me.EnterpriseTe xt.Multiline = True

Me.EnterpriseTe xt.Name = "EnterpriseText "

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

Me.EnterpriseTe xt.TabIndex = 5

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

'

'TextBox1

'

Me.TextBox1.Aut oSize = False

Me.TextBox1.Bac kColor = System.Drawing. Color.Teal

Me.TextBox1.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox1.Mul tiline = True

Me.TextBox1.Nam e = "TextBox1"

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

Me.TextBox1.Tab Index = 6

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

'

'TextBox2

'

Me.TextBox2.Aut oSize = False

Me.TextBox2.Bac kColor = System.Drawing. Color.Teal

Me.TextBox2.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox2.Mul tiline = True

Me.TextBox2.Nam e = "TextBox2"

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

Me.TextBox2.Tab Index = 7

Me.TextBox2.Tex t = "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.Po int,
CType(0, Byte))

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

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

Me.Options.Name = "Options"

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

Me.Options.TabI ndex = 8

Me.Options.Text = "Options"

'

'TextBox3

'

Me.TextBox3.Aut oSize = False

Me.TextBox3.Bac kColor = System.Drawing. Color.Teal

Me.TextBox3.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox3.Mul tiline = True

Me.TextBox3.Nam e = "TextBox3"

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

Me.TextBox3.Tab Index = 9

Me.TextBox3.Tex t = "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.Po int,
CType(0, Byte))

Me.Tools.ForeCo lor = System.Drawing. Color.White

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

Me.Tools.Name = "Tools"

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

Me.Tools.TabInd ex = 10

Me.Tools.Text = "Tools"

'

'TextBox4

'

Me.TextBox4.Aut oSize = False

Me.TextBox4.Bac kColor = System.Drawing. Color.Teal

Me.TextBox4.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox4.Mul tiline = True

Me.TextBox4.Nam e = "TextBox4"

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

Me.TextBox4.Tab Index = 11

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

" and more"

'

'WeeklyProcess

'

Me.WeeklyProces s.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.WeeklyProces s.ForeColor = System.Drawing. Color.White

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

Me.WeeklyProces s.Name = "WeeklyProc ess"

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

Me.WeeklyProces s.TabIndex = 12

Me.WeeklyProces s.Text = "Weekly Process"

'

'TextBox5

'

Me.TextBox5.Aut oSize = False

Me.TextBox5.Bac kColor = System.Drawing. Color.Teal

Me.TextBox5.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox5.Mul tiline = True

Me.TextBox5.Nam e = "TextBox5"

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

Me.TextBox5.Tab Index = 13

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

'

'MainMenu

'

Me.AutoScaleBas eSize = 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.WeeklyProce ss)

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.EnterpriseT ext)

Me.Controls.Add (Me.ProjectCent er)

Me.Controls.Add (Me.ProgramCent er)

Me.Controls.Add (Me.Enterprise)

Me.Controls.Add (Me.TextBox5)

Me.Name = "MainMenu"

Me.Controls.Set ChildIndex(Me.T extBox5, 0)

Me.Controls.Set ChildIndex(Me.E nterprise, 0)

Me.Controls.Set ChildIndex(Me.P rogramCenter, 0)

Me.Controls.Set ChildIndex(Me.P rojectCenter, 0)

Me.Controls.Set ChildIndex(Me.E nterpriseText, 0)

Me.Controls.Set ChildIndex(Me.T extBox1, 0)

Me.Controls.Set ChildIndex(Me.T extBox2, 0)

Me.Controls.Set ChildIndex(Me.O ptions, 0)

Me.Controls.Set ChildIndex(Me.T extBox3, 0)

Me.Controls.Set ChildIndex(Me.T ools, 0)

Me.Controls.Set ChildIndex(Me.T extBox4, 0)

Me.Controls.Set ChildIndex(Me.W eeklyProcess, 0)

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub Enterprise_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles Enterprise.Clic k

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

End Sub

Private Sub ProgramCenter_C lick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ProgramCenter.C lick

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

End Sub

Private Sub ProjectCenter_C lick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ProjectCenter.C lick

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

End Sub

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

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

' End Sub

Private Sub MainMenu_Load(B yVal sender As Object, ByVal e As
System.EventArg s) 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.StartPositio n = FormStartPositi on.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******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP15.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******** *****@TK2MSFTNG P15.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.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() 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.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

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

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

Me.SuspendLayou t()

'

'OK

'

Me.OK.Anchor = CType((System.W indows.Forms.An chorStyles.Bott om Or
System.Windows. Forms.AnchorSty les.Right),
System.Windows. Forms.AnchorSty les)

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

Me.OK.Cursor = System.Windows. Forms.Cursors.H and

Me.OK.DialogRes ult = System.Windows. Forms.DialogRes ult.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.AnchorSty les.Top

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

Me.Title.ForeCo lor = System.Drawing. Color.Goldenrod

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

Me.Title.Name = "Title"

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

Me.Title.TabInd ex = 0

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

Me.Title.TextAl ign = System.Drawing. ContentAlignmen t.TopCenter

'

'BaseForm

'

Me.AutoScaleBas eSize = 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.D efault

Me.ForeColor = System.Drawing. Color.White

Me.FormBorderSt yle = System.Windows. Forms.FormBorde rStyle.None

Me.Name = "BaseForm"

Me.StartPositio n =
System.Windows. Forms.FormStart Position.Center Screen

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub BaseForm_Load(B yVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load

'Draw Form

Me.FormBorderSt yle = FormBorderStyle .None

OnBaseFormLoad( )

Dim p As New System.Drawing. Drawing2D.Graph icsPath

Dim CurveSize As Int32 = 250

p.StartFigure()

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

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

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

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

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

p.AddLine(Me.Wi dth - 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_MouseD own(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseDow n

Dim xOffset As Integer

Dim yOffset As Integer

If e.Button = MouseButtons.Le ft Then

xOffset = -e.X - SystemInformati on.FrameBorderS ize.Width

yOffset = -e.Y - SystemInformati on.CaptionHeigh t - _

SystemInformati on.FrameBorderS ize.Height

mouseOffset = New Point(xOffset, yOffset)

isMouseDown = True

End If

End Sub

Private Sub BaseForm_MouseU p(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.Le ft Then

isMouseDown = False

End If

End Sub

Private Sub oldbtest_MouseM ove(ByVal sender As Object, _

ByVal e As MouseEventArgs) Handles MyBase.MouseMov e

If isMouseDown Then

Dim mousePos As Point = Control.MousePo sition

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

Location = mousePos

End If

End Sub

Private Sub OK_Click(ByVal sender As Object, ByVal e As
System.EventArg s) 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.PaintEven tArgs) Handles OK.Paint

Dim p As New Drawing2D.Graph icsPath

p.AddEllipse(Ne w 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.StartPositio n = FormStartPositi on.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.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() 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.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

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

Me.ProgramCente r = New System.Windows. Forms.Button

Me.ProjectCente r = New System.Windows. Forms.Button

Me.EnterpriseTe xt = 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.WeeklyProces s = New System.Windows. Forms.Button

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

Me.SuspendLayou t()

'

'Enterprise

'

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

Me.Enterprise.F oreColor = System.Drawing. Color.White

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

Me.Enterprise.N ame = "Enterprise "

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

Me.Enterprise.T abIndex = 2

Me.Enterprise.T ext = "Enterprise "

'

'ProgramCenter

'

Me.ProgramCente r.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.ProgramCente r.ForeColor = System.Drawing. Color.White

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

Me.ProgramCente r.Name = "ProgramCen ter"

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

Me.ProgramCente r.TabIndex = 3

Me.ProgramCente r.Text = "Program Center"

'

'ProjectCenter

'

Me.ProjectCente r.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.ProjectCente r.ForeColor = System.Drawing. Color.White

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

Me.ProjectCente r.Name = "ProjectCen ter"

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

Me.ProjectCente r.TabIndex = 4

Me.ProjectCente r.Text = "Project Center"

'

'EnterpriseText

'

Me.EnterpriseTe xt.AutoSize = False

Me.EnterpriseTe xt.BackColor = System.Drawing. Color.Teal

Me.EnterpriseTe xt.BorderStyle =
System.Windows. Forms.BorderSty le.None

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

Me.EnterpriseTe xt.Multiline = True

Me.EnterpriseTe xt.Name = "EnterpriseText "

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

Me.EnterpriseTe xt.TabIndex = 5

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

'

'TextBox1

'

Me.TextBox1.Aut oSize = False

Me.TextBox1.Bac kColor = System.Drawing. Color.Teal

Me.TextBox1.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox1.Mul tiline = True

Me.TextBox1.Nam e = "TextBox1"

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

Me.TextBox1.Tab Index = 6

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

'

'TextBox2

'

Me.TextBox2.Aut oSize = False

Me.TextBox2.Bac kColor = System.Drawing. Color.Teal

Me.TextBox2.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox2.Mul tiline = True

Me.TextBox2.Nam e = "TextBox2"

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

Me.TextBox2.Tab Index = 7

Me.TextBox2.Tex t = "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.Po int,
CType(0, Byte))

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

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

Me.Options.Name = "Options"

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

Me.Options.TabI ndex = 8

Me.Options.Text = "Options"

'

'TextBox3

'

Me.TextBox3.Aut oSize = False

Me.TextBox3.Bac kColor = System.Drawing. Color.Teal

Me.TextBox3.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox3.Mul tiline = True

Me.TextBox3.Nam e = "TextBox3"

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

Me.TextBox3.Tab Index = 9

Me.TextBox3.Tex t = "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.Po int,
CType(0, Byte))

Me.Tools.ForeCo lor = System.Drawing. Color.White

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

Me.Tools.Name = "Tools"

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

Me.Tools.TabInd ex = 10

Me.Tools.Text = "Tools"

'

'TextBox4

'

Me.TextBox4.Aut oSize = False

Me.TextBox4.Bac kColor = System.Drawing. Color.Teal

Me.TextBox4.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox4.Mul tiline = True

Me.TextBox4.Nam e = "TextBox4"

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

Me.TextBox4.Tab Index = 11

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

" and more"

'

'WeeklyProcess

'

Me.WeeklyProces s.Font = New System.Drawing. Font("Microsoft Sans
Serif", 12.0!, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, CType(0, Byte))

Me.WeeklyProces s.ForeColor = System.Drawing. Color.White

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

Me.WeeklyProces s.Name = "WeeklyProc ess"

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

Me.WeeklyProces s.TabIndex = 12

Me.WeeklyProces s.Text = "Weekly Process"

'

'TextBox5

'

Me.TextBox5.Aut oSize = False

Me.TextBox5.Bac kColor = System.Drawing. Color.Teal

Me.TextBox5.Bor derStyle = System.Windows. Forms.BorderSty le.None

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

Me.TextBox5.Mul tiline = True

Me.TextBox5.Nam e = "TextBox5"

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

Me.TextBox5.Tab Index = 13

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

'

'MainMenu

'

Me.AutoScaleBas eSize = 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.WeeklyProce ss)

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.EnterpriseT ext)

Me.Controls.Add (Me.ProjectCent er)

Me.Controls.Add (Me.ProgramCent er)

Me.Controls.Add (Me.Enterprise)

Me.Controls.Add (Me.TextBox5)

Me.Name = "MainMenu"

Me.Controls.Set ChildIndex(Me.T extBox5, 0)

Me.Controls.Set ChildIndex(Me.E nterprise, 0)

Me.Controls.Set ChildIndex(Me.P rogramCenter, 0)

Me.Controls.Set ChildIndex(Me.P rojectCenter, 0)

Me.Controls.Set ChildIndex(Me.E nterpriseText, 0)

Me.Controls.Set ChildIndex(Me.T extBox1, 0)

Me.Controls.Set ChildIndex(Me.T extBox2, 0)

Me.Controls.Set ChildIndex(Me.O ptions, 0)

Me.Controls.Set ChildIndex(Me.T extBox3, 0)

Me.Controls.Set ChildIndex(Me.T ools, 0)

Me.Controls.Set ChildIndex(Me.T extBox4, 0)

Me.Controls.Set ChildIndex(Me.W eeklyProcess, 0)

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub Enterprise_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles Enterprise.Clic k

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

End Sub

Private Sub ProgramCenter_C lick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ProgramCenter.C lick

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

End Sub

Private Sub ProjectCenter_C lick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ProjectCenter.C lick

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

End Sub

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

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

' End Sub

Private Sub MainMenu_Load(B yVal sender As Object, ByVal e As
System.EventArg s) 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.StartPositio n = FormStartPositi on.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******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP12.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
5978
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 exception of type 'System.ExecutionEngineException' occurred in system.windows.forms.dll Anyone know how to either trap these errors or prevent them from happening?
6
2565
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 communicated solely through static method and Invoke()'s However, when I close my second form, the first one (main window) is hiding under all the windows on the desktop. If I don't close the splash screen, then everything is fine. I tried...
1
3453
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 going wrong. The program has been written to do the following tasks: - Select remote server - Select from two specific services
0
3936
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 - Select from two specific services - Check the status of the server
8
18652
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 available in the same form for users to enter commands and display outputs if some prefer to use character based user interface. I would like to implement the user interface in vb .net. Now I have menus and toolbars ready, but do not now how to get a...
4
4180
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 check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
13
5247
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 generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer.
15
7080
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 every second. I remote desktop to the computer hosting this application and run the application. It starts up and displays the counter incrementing every second. If I disconnect the network cable between the two computers for 10 seconds and...
21
3370
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 a zipcode that is unknown this form will open. I don't want users to modify any of this customers data until they close the zipcode form. Normally this can accomplished using a modal form, however this prevents me from opening a new copy of...
0
9252
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8966
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6588
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5922
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3125
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2070
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.