dcsimg
Results 1 to 5 of 5

Thread: keep the forms at a fixed size, no matter what the DPI is

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2016
    Posts
    440

    keep the forms at a fixed size, no matter what the DPI is

    Hello Vbforums
    I've developed a small application with Dpi 100% . Everything looks fine.
    However when the DPI changes, my application becomes very ugly.
    This issue is bothering me.
    I wonder if there is a way to prepare the program to work in different DPI settings.
    I followed a tutorial of Mr Lavolve

    http://www.vbforums.com/showthread.p...est-Creator-II
    I downloaded the sample project Manifest creator II.
    From menu I chose "Create from project file (Vbp). Then I exported the file to the
    project directory under the name "manifest.res".
    The file is created.
    I copied the Sub Main and started the application from that sub Main.
    I compiled my project but unfortunately, I felt no change.
    I can only get the appropriate size of controls and fonts when I set the Dpi again to 100%.
    Am I missing something?
    Thank you for any help.
    Last edited by Mustaphi; Aug 5th, 2019 at 10:58 AM.

  2. #2
    Hyperactive Member
    Join Date
    Feb 2019
    Posts
    382

    Re: keep the forms at a fixed size, no matter what the DPI is

    I haven't used Manifest Creator II, but used a similar one, but it sounds like that you didn't add the manifest as a resource. If so, then recompiling would erase the changes, and you would need to run Manifest creator II every time you compile, so it's better to add your manifest as a resource, so you don't have to do that.

    Also, see this post about a resizing method that works like HTML pages, resizing controls based on their percentage of form width and height. You would need to adjust it to work with the type of controls that you are having.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2016
    Posts
    440

    Re: keep the forms at a fixed size, no matter what the DPI is

    Quote Originally Posted by qvb6 View Post
    it sounds like that you didn't add the manifest as a resource.
    thanks sir for your interest
    I HAVE added the manifest as a resource
    I HAVE TESTED your codes, but the only remarkable thing is that labels kept their size regardless the dpi setting.
    usercontrols captions is distorted.
    Part of Pictureboxes and toolbar became invisible on the right side of the screen

  4. #4
    Frenzied Member
    Join Date
    Feb 2017
    Posts
    1,784

    Re: keep the forms at a fixed size, no matter what the DPI is

    For making the programs DPI aware, aside from adding the manifest, basically and the most important thing is to work in Twips. (ScaleMode property of every container -Forms/PictureBoxes/UserControls-).

    In the same thread that qvb6 linked, in the message #7, from the statement "About my approach..." and ahead, you can read simple explanation with the basics of making/adapting a program to be DPI aware.

  5. #5
    Hyperactive Member
    Join Date
    Feb 2019
    Posts
    382

    Re: keep the forms at a fixed size, no matter what the DPI is

    My code wasn't meant to be a complete example. You need to tweak it to work with your situation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width