Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Controls on VS Tools Add-In Windows Drawing Inconsistently

(0) ShareShare
ReportReport
Posted on by 1,588

Can anyone tell me why the controls on my VS Tools windows draw as expected at first, but over time eventually I come back to a window things are not behaving. Toolbar buttons are larger than they should be, text fields that used to line up perfectly have odd spaces between them, some controls overlap a little.

[View:http://screencast.com/t/zRwUflwK:320:50]

*This post is locked for comments

  • chadbruels Profile Picture
    1,588 on at
    RE: Controls on VS Tools Add-In Windows Drawing Inconsistently

    My display settings are such that Windows is choosing the scaling based on the displays used. I plan to change these settings to use a consistent scaling for all displays and then perform the above test again.

    [View:http://screencast.com/t/aa5wvlExJ5:320:50]

  • steveendow Profile Picture
    2,281 on at
    RE: Controls on VS Tools Add-In Windows Drawing Inconsistently

    Whoa.  That sounds bizarre.

    The trouble with the symptoms you describe is that it is hard to tell where the problem is originating.  Is it Visual Studio, Windows, or perhaps even how your video driver is interacting with Windows?  Or a combination of multiple factors?

    My guess is that it is a pretty low level problem, so I'm assuming it would be pretty tough to identify the specific cause and resolve.

    Maybe try updating your video drivers, as that is one of the few things you could try?

    I had briefly considered getting a Surface Pro 4 and connecting two monitors to replace my desktop, but I'm now ruling out that idea...

  • chadbruels Profile Picture
    1,588 on at
    RE: Controls on VS Tools Add-In Windows Drawing Inconsistently

    I mean to indicate that I first noticed this issue when I ran GP with the AddIn loaded and the window looked all wrong. I then opened the project in VS and found it was all wrong as well. I began resizing everything but stopped and started with a bit of research.

    Here is a test with a winform project.

    1. Create vanilla winform project
    2. Size window to 450x450
    3. Add button and size to 90x30
    4. Add label, change AutoSize to false, and size to 50x14
    5. Add textbox and size to 120x20
    6. Close VS
    7. Open laptop and unplug monitors
    8. Restart
    9. Open project

    Results
    - Window is now 452x458
    - Size unchanged for button, label, and textbox

    10. Restart - still just on laptop
    11. Open project

    Results
    - Window is now 597x553
    - Button is now 120x37
    - Label is now 67x17
    - Texbox is now 159x22

    12. Close VS
    13. Plug in monitors and close laptop
    14. Open project

    Results
    - No change

    15. Restart
    16. Open project

    Results
    - Window is now 595x545
    - Size unchanged for button, label, and texbox

    17. Restart
    18. Open project

    Results
    - Window is back to 450x450
    - Button is back to 90x30
    - Label is back to 50x14
    - Textbox is back to 120x20

    If this is all a result of scaling with different settings, they are settings I've not specifically set myself - or certainly ones I don't recall ever making. I feel I'm a victim of whatever Windows is doing when changing between running the monitors and not. I find it interesting that I have to restart twice in order to get back to the original sizes.

  • TimDotNet Profile Picture
    95 on at
    RE: Controls on VS Tools Add-In Windows Drawing Inconsistently

    Chad,

    Could you elaborate on that last bit again, I'm not totally clear on what you mean.

    "What is interesting (or worrying) is the window running in GP changes as well. That is where I first noticed the window looking terribly wrong."

    I've just noticed the additional screen shots you included, 1186->1576 = 33% tells me its a screen font scaling issue between 96dpi fonts and 120dpi fonts, my guess is you have different settings for different screen setups?

    -The DexFormUI that underpins the form uses AutoScaleDimensions = new SizeF(6f, 13f); which means it tries to auto scale the form size (and components there  of) to accommodate the new larger font size, normal behaviour. You get rounding issues, messes up your layouts. 

    ,

    tim

  • chadbruels Profile Picture
    1,588 on at
    RE: Controls on VS Tools Add-In Windows Drawing Inconsistently

    Brief Update : After restarting a second time, the sizes of the window and all controls go back to their proper values. What is interesting (or worrying) is the window running in GP changes as well. That is where I first noticed the window looking terribly wrong.

  • steveendow Profile Picture
    2,281 on at
    RE: Controls on VS Tools Add-In Windows Drawing Inconsistently

    If I'm interpreting the screen shots correctly, it looks like some type of Windows scaling issue, and not just the control resizing issue that Tim and I observed with VST.

    Have you tried with a vanilla Visual Studio winform app?  I'm curious if you see the same behavior with a non-GP related app.

  • chadbruels Profile Picture
    1,588 on at
    RE: Controls on VS Tools Add-In Windows Drawing Inconsistently

    I can replicate the scenario you described, however, I also have something else happening.

    Your Metadata scenario

    I confirmed that I had two buttons on the window whose DexDefaultsSet metadata was missing from the .resx file. I performed the workaround on one of them, changed their sizes, and I see the one persisted the size change and the other did not.

    My Changes that Happen to Everything

    I noted that when I saw this occur earlier today I had just transitioned from working on the laptop itself to plugging into my external monitors. When I do this (in either direction) the resolution, text size, and text clarity just doesn't quite look right until I restart Windows. By the way, I'm running with power settings such that the lid is closed and I'm working on two monitors - one connected to HDMI, the other to VGA. It is after plugging into the monitors and restarting - with the resolution and all other applications now looking as expected - that the really odd behaviors occur.

    The window itself is much larger.

    [View:http://screencast.com/t/HFjruWvy:320:50]

    Also, all controls I have looked at change size as well - including buttons whose metadata have been added by flipped their type back and forth.

    [View:http://screencast.com/t/iDntW6u8VUiT:320:50]

  • Tim Wappat Profile Picture
    5,703 on at
    RE: Controls on VS Tools Add-In Windows Drawing Inconsistently

    Chad,

    Is this similar to the issue I blogged here:

    timwappat.info/.../Buttons-not-persisting-size-in-Dynamics-GP-add-in

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans