Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Graphics problems - DPI settings!!!!

Graphics problems - DPI settings!!!!

Scheduled Pinned Locked Moved C#
graphicshelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paul Griffin
    wrote on last edited by
    #1

    Hi all, i'm developing an application which involves a lot of drawing of lines and shapes, using panels as drawing surfaces. The panels themselves are on pages of a tab control. In addition the panels also contain various labels and combo boxes which are connected by the lines drawn. My problem is that if i change the system settings so that i'm running at 120dpi (instead of 96 std.) the lines and shapes get "scattered" all over the panel and no longer connect the other controls. Is there a way to detect what dpi setting a system is at and apply a transformation to my drawing routines? Any advice or suggestions are welcome Thanks Paul Griffin

    J W 2 Replies Last reply
    0
    • P Paul Griffin

      Hi all, i'm developing an application which involves a lot of drawing of lines and shapes, using panels as drawing surfaces. The panels themselves are on pages of a tab control. In addition the panels also contain various labels and combo boxes which are connected by the lines drawn. My problem is that if i change the system settings so that i'm running at 120dpi (instead of 96 std.) the lines and shapes get "scattered" all over the panel and no longer connect the other controls. Is there a way to detect what dpi setting a system is at and apply a transformation to my drawing routines? Any advice or suggestions are welcome Thanks Paul Griffin

      J Offline
      J Offline
      John Fisher
      wrote on last edited by
      #2

      A host of possibilities have run across my brain just now, but I have not taken the time to look up the proper solution. 1) Look through the documentation for the Graphics class and related classes. There is a strong probability that the answer is in there. 2) Modify your drawing routines to use the location of the controls, rather than using preset pixel counts. 3) Compare the positions of two controls that are always present in your application. In one dpi setting, they will have certain locations, while they will have other locations (and sizes) in another dpi setting. With that information, you could pretty much detect the setting (but it may not be reliable, test first). John
      "You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.

      1 Reply Last reply
      0
      • P Paul Griffin

        Hi all, i'm developing an application which involves a lot of drawing of lines and shapes, using panels as drawing surfaces. The panels themselves are on pages of a tab control. In addition the panels also contain various labels and combo boxes which are connected by the lines drawn. My problem is that if i change the system settings so that i'm running at 120dpi (instead of 96 std.) the lines and shapes get "scattered" all over the panel and no longer connect the other controls. Is there a way to detect what dpi setting a system is at and apply a transformation to my drawing routines? Any advice or suggestions are welcome Thanks Paul Griffin

        W Offline
        W Offline
        Werdna
        wrote on last edited by
        #3

        You can get DPI from graphic: Graphics.DpiX and Graphics.DpiY

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups