Starting the Dynamics GP AddIn form centered in the screen

While working on VSToolkit and VSMenus, I had a problem in starting the AddIn form centered in the screen; I tried to change “StartPosition” to Center Screen and Center Parent with no success, the form keep opening in the left top corner of the screen which is very annoying to the end users.

I found that the tool is ignoring the “StartPosition” property and is using the “Location” property instead, but the location cannot be fixed since the screen resolution is changeable.

To workaround this issue I have created the following code segment that gets the screen resolution and set the form boundaries to the screen center

Just add the following code segment to your form load:

Me.SetBounds(Math.Round((Screen.PrimaryScreen.Bounds.Width / 2) – (Me.Width / 2), 0), Math.Round((Screen.PrimaryScreen.Bounds.Height / 2) – (Me.Height / 2), 0), Me.Width, Me.Height)

Hope this helps!


Mohammad R. Daoud
Software Development Manager
+962 – 79 – 999 65 85
Great Package For Business Solutions


About Mohammad R. Daoud
Mohammad R. Daoud has been working as a Microsoft Dynamics GP consultant since 2004. His career path started with version 7.5; he studied every single tip of the application technicalities and did allot of successful implementations that includes functional consultations, analysis, and custom development projects. He holds a graduate degree in Computer Science and currently he is pursuing MBA degree in Accounting. In January 2007 he was nominated to the Microsoft Most Valuable Professional (MVP) certificate and was certified in April 2008 due to his online contributions in the Dynamics Community (Dynamics GP Newsgroups, Forums, User Groups and his blog: Worth to mention that he was also listed as one of the Microsoft Dynamics Top 100 Most Influential People in 2009 by DynamicsWorld. And more... • Demonstrated Passion for MS Products through participating in beta testing for some product versions, an effective member of Microsoft Connect. • Talented in securing strong high quality relationships with premier customers, partners and sales teams passionately and profitably. • Dedicated to meeting the expectations and requirements of internal and/or external customers • Problem Solver – Uses systematic approach to uncover true problem(s) and practical solution and can marshal resources to solve problem! • Proven record of effective account management, including Account Planning, Opportunity Management, and Business Management Excellence and working as part of a larger virtual team • Successful in delivering high quality technical engagements in the enterprise Dynamics GP implementations area according to customer requirements. • Dedicated, Committed, Self Motivated, Creative and highly focused with excellent communication, Negotiation, presentation, Active Listening and Objection Handling skills. • Experienced in Profitable researches and studies including white papers and technical presentations.

One Response to Starting the Dynamics GP AddIn form centered in the screen

  1. Steve Endow says:

    Thanks for the post–I came to the same conclusion a while ago and ended up writing the same code to just center the window. An interesting variant of this is to be able to center the AddIn window relative to its GP “parent” window: haven’t found a solution to that one yet, but it would be nice!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: