DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2002
    Posts
    7

    keep the size of a line even if the screen settings are change

    Hi, i have a weird things to do, and found nothing on google and others place...
    For example, i draw a line of 1 inch into my computer where my resolution is 96dpi and my screen area is 1024x768
    i need to made modification to this line to have a 1 inch line on every screen settings. example: my friend that are in 800x600 and have a dpi of 128 opn my program to see the line... i want him to see a 1 inch line too
    so i need to find a way to do that so when i have the screen size and the screen resolution that i could have on the screen a 1 inch (example) line for every settings...
    sorry for my english! can someone help me to find an idea...?
    thx a lot
    bumpert

  2. #2
    Join Date
    Nov 2002
    Posts
    59
    I came across a similar problem in that I had to find out the size of ALL monitors...including for a multiple monitor setup, so this should work all the same:

    Code:
    private Vector monitors = new Vector();
        private int numOfMon;
    public void initMonitors() {
            monitors.clear();
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            GraphicsDevice[] gd = ge.getScreenDevices();
            for (int i = 0; i<gd.length; i++) {
                GraphicsConfiguration[]  gc = gd[i].getConfigurations();
                for (int j = 0; j<gc.length; j++) {
                    if (monitors.contains(gc[j].getBounds()) == false) {
                        
                        monitors.addElement(gc[j].getBounds());
                        
                    }
                }
                
            }
            numOfMon = monitors.size();
        }
    public int getNumOfMonitors() {
            return numOfMon;
        }
        
        public Rectangle getSizeOfMonitor(int numOfMonitor) {
            return (Rectangle)monitors.elementAt(numOfMonitor);
        }
    Sorry if some of the variables and stuff are missing, but the rest of it should work. I left out the code to set which monitor you want a window on...hope this helps!

  3. #3
    Join Date
    Sep 2002
    Posts
    7
    thx

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links