Can I set the size of a GUI control in centimeters?

Hi,
    I know that I can get the resolution of the monitor, and with that set the display size of a control in a GUI. However, the real size (in centimeters) depends actually on the sizes (in centimeters) of the screen. Can I get that, programatically?
Solved!
Go to Solution.

After writing #include <windows.h> at the beginning of the program, I wrote the following function called by the main.
void GeometriaGUI(){
HDC dc;
double xPixelsPerCentimer, yPixelsPerCentimer,xPixelsPerMilimeter, yPixelsPerMilimeter;;
dc = GetDC (NULL);
xPixelsPerCentimer = GetDeviceCaps (dc, LOGPIXELSX) / 2.54;
yPixelsPerCentimer = GetDeviceCaps (dc, LOGPIXELSY) / 2.54;
xPixelsPerMilimeter= GetDeviceCaps (dc, HORZRES)/GetDeviceCaps (dc, HORZSIZE);
yPixelsPerMilimeter= /*GetDeviceCaps (dc, VERTRES)/GetDeviceCaps (dc, VERTSIZE);
//ReleaseDC (dc);
SetCtrlAttribute (panelHandle, PNL_INSTR_2, ATTR_HEIGHT, (int)(40.0*yPixelsPerMilimeter));
SetCtrlAttribute (panelHandle, PNL_INSTR_2, ATTR_WIDTH, (int)(40.0*yPixelsPerMilimeter));
 First, I eliminated the ReleaseDC line because it caused an error "Type error in argument 1 to `ReleaseDC'; found 'HDC' expected 'HWND'." at compile time.
If I use xPixelsPerCentimeter to set the size of a control in the GUI, and set a value of 4*xPixelsPerCentimeter, I get, after measuring with a ruler, only 3.5 cm.
If I use 40*xPixelsPerMilimeter,  I get a size of 1.8 cm. In both cases, 4 cm are expected.
If I look at the values given the Windows sdk functions, the ones given by the resolution are atribute are fine (1280 x 800). However, the ones given by HORZSIZE and VERTSIZE attributes don't match what I measure physically. The sizes given are larger than the computer itself (a notebook with only 1 monitor).
The idea is that the size of certain controls are constant across any monitor used. But the function, unfortunately, is not giving the expected results.

Similar Messages

  • HELP !!! How can I set the size of each component separately

    Please tell me, when adding components (a mix of
    labels , buttons etc.) on a container (swing), how can I set the size
    of each component separately.
    for example:
    the code here has a mix of button and a grid that is actually another JPanel. Its a part of a bigger
    program. When running the grid is cut (not seen in its full size).
    So, please try to anser also about the specific acse of frame contining another frame in it , and the interior should be right sized.
    The relevant part of the code:
    =========================================
    public class Reversi extends JFrame {
    public static void main(String[] args) {
    Reversi ourGame = new Reversi();
    public Reversi() {
    super("Grid Reversi");
    setSize(new Dimension(300, 300));
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    Grid g = new Grid(); // the grid was built at another part..
    ReversiGame ourGame = new ReversiGame();
    JButton b;
    JFrame f = new JFrame("Hello Java");
    f.setSize(new Dimension(300, 300));
    f.setDefaultCloseOperation(EXIT_ON_CLOSE);
    Container c = f.getContentPane();
    c.add(g,BorderLayout.NORTH );
    c.add(b = new JButton("Hola"), BorderLayout.CENTER);
    //f.pack();
    f.show();

    BorderLayout chooses the sizes of each of the components added to it. Choose a different layout manager (or set the placement/size manually with a 'null' layout)
    http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html

  • How can I set the size of the font so I don't have to change every new word?

    How can I set the size of the font so I don't have to change every new word?

    In what application?

  • How can I set the size of an image in java?

    How can I set the size of an image in java? I have to choose the width and height of image...thanks to everybody...sorry for my english :-)

    Hi 43477
    Can you provide more details, do you want to setsize to display an image on a screen of when saving image etc?
    PS.
    There is a good invention called googlegoogle is good, but sometimes it's better to use more specific search, there is a search field avove on this page :)

  • How do i set the size of 3d picture control

    dear sir,
                I have attached my vi.I have one doubt  ie I have used translate object. vi in my vi to move my picture according to the value set by the y position.This y position indicates depth my object.this is sample object  insteat of i am going to update my underwater vehicle.
    What my problem is when i chnage the y value beyond 200 I can not see my picture.so  how do i set the size of the 3d picture control size.
           I have to see my picture within the 3d picture control eventhough i change the y value between 0-500,how do i solve my problem.
    Another my doubt is how do i show the depth value (ie y value in translate object .vi) in 3d picture control ie while the picture is moving in a 3d picture control at the same time i want to display the corresponding depth rating in the 3d picture control
    Pls anyone suggest me as soon as possible.
    Thanks and regards
    jayanthi.k
    Attachments:
    Untitled 1.llb ‏67 KB

    Jayanth,
    Take a look at the attached example.  Alternatively, you can search for it in NI Example Finder by going to Help>>Find Examples in LabVIEW, click on the search tab, and search for meshes.  I had difficulty reading your code, but I believe you need to position your lighting source in the optimal location to get better definition.  And the example shows how to bind a color to the object.
    Trey B
    Applications Engineering
    National Instruments
    Attachments:
    Using Meshes.vi ‏76 KB

  • How can I set the caption text of picture controls inside an array or how can I choose which array element is assigned using the array elements caption text property.

    I have 8 picture controls inside an array and I would like to set the caption text of these controls.
    I have used the property node of the array and used the array elements property caption text to set the text.
    The problem is however that I set the same text to all the picture controls inside the array.
    My question is how to set caption text of specific elements (Picture control) that I have so far only been able to access using the array elements caption text property.

    Some more help
    1 You could use the caption of the array and place it in front of the selected picture and update that using property nodes.
    2 Like Norbett said if you use a cluster of pictures then their caption can be updated individually.
    Here is a an example that demonstrates the above
    David
    Attachments:
    Modify the Captions Of Pictures.vi ‏83 KB

  • How can I set the size of combo boxes on a toolbar

    Hi, I am trying to use setMinimumSize of a combo box on a toolbar, It doesn't seem work. The code as following? Can anyone tell me how I can do it ?
    JComboBox sw = New ComboBox();
    sw.setMinimumSize(new Dimension(10,10));
    Thank you.
    Scott

    use the method preferred size of the JComponent superclass of the combos:
    setPreferredSize
    public void setPreferredSize(Dimension preferredSize)
    Sets the preferred size of the receiving component. If preferredSize is null, the UI will be asked for the preferred size.

  • How can i set the size of the task windows and text to something more suitable?

    When i bought my HP Touchsmart 600 pc the text size and window size on the desktop were tiny as Default, i manage to change it where it wasnt to big or small it was just right.
    but recently i had to restore my whole computer back to factory settings and now the text is huge and the windows are coming up big as well. i played around in the display settings and put it at 100% default and that doesnt help i then tried it on 125% but that is still big...
    i cant remember how i did it last time and its really hard to explain. but could anyone help me and point me in the right direction cause its annoying i use to fit like 10 icons vertically in a row on my desktop now i can fit only 8 and the start menu comes up huge.
    so if any one could help me out it would be great! thankyou in advance. 

    Hi 43477
    Can you provide more details, do you want to setsize to display an image on a screen of when saving image etc?
    PS.
    There is a good invention called googlegoogle is good, but sometimes it's better to use more specific search, there is a search field avove on this page :)

  • My popup windows open too small to show all the information can i set the size so i dont have to readjust it each time?

    as i use the popup box on a regular basis

    Are you using an increased default font size?
    * [http://kb.mozillazine.org/Menu_differences Edit > Preferences] > Content : Fonts & Colors > Advanced
    You can also look at:
    * http://kb.mozillazine.org/Corrupt_localstore.rdf

  • How to set the size of JTextPane according to the size of text??

    hello
    how can i set the size of JTextPane according to the size of text it would contain in such a way that JTextPane should not have ScrollBar.

    StanislavL wrote:
    width should be defined for your container width. suppose you have a very long row of text. Widht full screen widht it wraps into 2 lines but if you set widht of your window to half screen widht there should be 4 lines.
    But you can use the same code and get preferred widht as well.u mean like this :
    objTextPane.getParent().getWidth();Edited by: 811243 on Sep 6, 2011 5:32 AM

  • Can I edit the size of my photo when setting up an email signature?

    Can I edit the size of my photo when setting up an email signature?

    Not sure what you mean by "photo screen?" Do you mean your Photo Stream?
    In the Photos app there are several ways to view the photos. Tap on Albums. Your Photo Stream is one Album but there may be others including the Camera Roll, albums made on the iPad with photos from the Camera Roll, and albums of photos copied to your iPhone by syncing with your computer.
    To remove albums from the Camera Roll, tap on the Camera Roll album to see the small thumbnails of the photos there. Tap on Select, tap on the photos to delete, then tap on the trashcan. The photos will then be moved to another album called Recently Deleted. They remain there for 30 days to allow you time to reconsider whether you really want to delete them or not. After 30 days they will automatically be deleted from your iPhone. But if you are sure you want the photos deleted from your iPhone delete them again from the Recently Deleted album.
    Albums created on the iPad with photos from the Camera Roll can be deleted in the same way.
    To delete albums copied to your iPhone by syncing with your computer running iTunes are deleted by doing another sync. But before you click on Sync deselect the albums in iTunes. Then when you click on Apply or Sync the albums will be removed from your iPhone but they will remain on your computer.

  • Formatting issues: when I open a msg, the font is sooo small you need a magnifier to read it. How can I set the font size to one I can easily read?

    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    I have various formatting issues:
    a. When I open a msg from my web browser (Cablevision), the font is sooo small I need a magnifier to read it. How can I set the font to a size I can easily read?
    b. When I forward msgs, the text gets all distorted and I need to clean it up (some symbols, lots of spaces between words). How can this be fixed?
    c. When I want to tell someone about a website, I cannot type the URL in so that all they have to do is click on it. How can this be fixed?
    d. When I open messages, the text opens in a small window and covers the "Show Images" button. Why?
    == This happened
    ==
    Every time Firefox opened
    == Ever since I started using Firefox (a few months ago)
    ==
    '''Troubleshooting information'''
    I didn't find any results
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows 7
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
    == Plugins installed
    ==
    *-nphpclipbook
    *Office Plugin for Netscape Navigator
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *Default Plug-in
    *Adobe PDF Plug-In For Firefox and Netscape "9.3.2"
    *NPRuntime Script Plug-in Library for Java(TM) Deploy
    *The Hulu Desktop Plugin allows Hulu.com to integrate with the Hulu Desktop application.
    *Shockwave Flash 10.0 r45
    *Adobe Shockwave for Director Netscape plug-in, version 11.5
    *iTunes Detector Plug-in
    *3.0.40624.0
    *NPWLPG
    *Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers

    The text editor is the text area that you use on the webmail (Yahoo, Hotmail) website to create a new mail.
    You can compare that with the ''Post new message'' text area that you use to create a new post on this forum.
    Just above the text area that you use to enter the message text there is usually a button bar with buttons that allows some text formatting like Bold and Italic and can also include a button to make a clickable hyperlink.
    Check the tooltip of each button by hovering with the mouse over each button.
    Make Link - https://addons.mozilla.org/firefox/addon/142

  • How Can I Determine the Size of the 'My Documents' Folder for every user on a local machine using VBScript?

    Hello,
    I am at my wits end into this. Either I am doing it the wrong way or it is not possible.
    Let me explain. I need a vb script for the following scenario:
    1. The script is to run on multiple Windows 7 machines (32-Bit & 64-Bit alike).
    2. These are shared workstation i.e. different users login to these machines from time to time.
    3. The objective of this script is to traverse through each User Profile folder and get the size of the 'My Documents' folder within each User Profile folder. This information is to be written to a
    .CSV file located at C:\Temp directory on the machine.
    4. This script would be pushed to all workstations from SCCM. It would be configured to execute with
    System Rights
    I tried the script detailed at:
    http://blogs.technet.com/b/heyscriptingguy/archive/2005/03/31/how-can-i-determine-the-size-of-the-my-documents-folder.aspx 
    Const MY_DOCUMENTS = &H5&
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(MY_DOCUMENTS)
    Set objFolderItem = objFolder.Self
    strPath = objFolderItem.Path
    Set objFolder = objFSO.GetFolder(strPath)
    Wscript.Echo objFolder.Size
    The Wscript.Echo objFolder.Size command in the script at the above mentioned link returned the value as
    '0' (zero) for the current logged on user. Although the actual size was like 30 MB or so.
    I then tried the script at:
    http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_27869829.html
    This script returns the correct value but only for the current logged-on user.
    Const blnShowErrors = False
    ' Set up filesystem object for usage
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("WScript.Shell")
    ' Display desired folder sizes
    Wscript.Echo "MyDocuments : " & FormatSize(FindFiles(objFSO.GetFolder(objShell.SpecialFolders("MyDocuments"))))
    ' Recursively tally the size of all files under a folder
    ' Protect against folders or files that are not accessible
    Function FindFiles(objFolder)
    On Error Resume Next
    ' List files
    For Each objFile In objFolder.Files
    On Error Resume Next
    If Err.Number <> 0 Then ShowError "FindFiles:01", objFolder.Path
    On Error Resume Next
    FindFiles = FindFiles + objFile.Size
    If Err.Number <> 0 Then ShowError "FindFiles:02", objFile.Path
    Next
    If Err.Number = 0 Then
    ' Recursively drill down into subfolder
    For Each objSubFolder In objFolder.SubFolders
    On Error Resume Next
    If Err.Number <> 0 Then ShowError "FindFiles:04", objFolder.Path
    FindFiles = FindFiles + FindFiles(objSubFolder)
    If Err.Number <> 0 Then ShowError "FindFiles:05", objSubFolder.Path
    Next
    Else
    ShowError "FindFiles:03", objFolder.Path
    End If
    End Function
    ' Function to format a number into typical size scales
    Function FormatSize(iSize)
    aLabel = Array("bytes", "KB", "MB", "GB", "TB")
    For i = 0 to 4
    If iSize > 1024 Then iSize = iSize / 1024 Else Exit For End If
    Next
    FormatSize = Round(iSize, 2) & " " & aLabel(i)
    End Function
    Sub ShowError(strLocation, strMessage)
    If blnShowErrors Then
    WScript.StdErr.WriteLine "==> ERROR at [" & strLocation & "]"
    WScript.StdErr.WriteLine " Number:[" & Err.Number & "], Source:[" & Err.Source & "], Desc:[" & Err.Description & "]"
    WScript.StdErr.WriteLine " " & strMessage
    Err.Clear
    End If
    End Sub
    The only part pending, is to achieve this for the 'My Documents' folder within each User Profile folder.
    Is this possible?
    Please help.

    Here are a bunch of scripts to get folder size under all circumstances.  Take your pick.
    https://gallery.technet.microsoft.com/scriptcenter/site/search?query=get%20folder%20size&f%5B0%5D.Value=get%20folder%20size&f%5B0%5D.Type=SearchText&ac=2
    ¯\_(ツ)_/¯

  • How to set the size for height of iView tray?

    Hi,
    I have created a ABAP webdynpro component and integrated this comp with iView. Then i integrated iView into Page in portal. That is working fine.
    But the size of tray/window which is displayed in the page is very small.
    How to increase the height of that Tray/window/iView containing my component?

    Hi,
    By changing the maximum automatic height and Minimum automatic height property of the iview you can set the size for height of your iview.
    to do this follow the setps:
    goto content administrator -> portal content -> your folder where you created your iview or directly to your iview -> right click -> open -> object,
    and now in property category choose appearance-Size from the drop down menu and set the above properties to your required height.
    if you want the end user to modify this property set the property to read/write .
    *********please reward points if the information is helpful to you********************

  • How can I change the size of table control in table maintenance re-gen?

    Hello Experts,
    I hv created a maintenance view and after generated table maintenance view for it.
    now it adjusts the size of table control in table maintenance generation.
    I want to change the size (width) of table control and again re-generate the table maintenance.
    But when re-generation occurs, table control size is set to initial.
    why it is happening? and wt to do to solve this issue? any user exit?
    I need the changed size of table control even if its re-generated.
    Regards,
    R.Hanks

    Hello Ronny,
    Goto SM30, Enter your table name for which you have maintained your table maintainence generator .
    When the maintainence screen appears for your table name , Goto System->Status->Screen Program name.
    Copy that program name from there.
    Open that module program through SE80,this is the program name of your SM30 screen which appears when we enter our table name in SM30 transaction.
    In SE80,click the layout of the module program name you have entered there.
    Its layout will display you the table control(of SM30) present to enter your your enteries.
    In the change mode you can change its size , savee it and activate that program.
    Now goto to SM30 again and enter your table name, it will show you the changed size of the table control used to take the enteries.
    Note:This changed size is only for your table name and it will remain of its previous size for other table enteries.
    Hope it helps you.
    Thanks Mansi

Maybe you are looking for

  • Hp 7525 Photosmart printer won't scan to my PC but will scan to other PCs on the LAN

    Hp 7525 Photosmart printer won't scan to my PC but will scan to other PCs on the LAN.  I tried to install the printer software but it says it is already installed.  Do I have a security setting wrong? Other PC names show up on the printer's touch scr

  • Premiere Pro crashes after quit - Mac OSX Lion

    Greetings, Symptoms: I'm experiencing a consistent crash behavior after quiting Premiere Pro (ver 5.5.1 and 5.5.2). The complexity of the project doesn't seem to matter and once it crashes, i get the prompt indicating the app encountered a serious er

  • Com.sap.aii.adapter.file.ftp.FTPEx: 421

    Hi Guys, I am getting these two error messages: 1) com.sap.aii.adapter.file.ftp.FTPEx: 421 Maximum session time exceeded - closing 2) com.sap.aii.adapter.file.ftp.FTPEx: 421 Too many users - please try again later when XI Sender File Adapter tries to

  • PDF modified while opened in preview

    Here is a weird behavior (bug) for 10.6. When a pdf file is modified outside while it is opened in Preview, now Preview automatically shows the first page. (The behavior for Leopard was showing the updated pdf in the current page.) This new behavior

  • Max users in Discoverer 11.1.1.3

    HI Experts, we need your assistance. upgraded the Discoverer 9.0.4 to 11g ( 11.1.1.3) with cumilative patchset. Middletier is on RHEL 5. with 8 processor and 25 gb ram server . when we have tested it ( with users) only 500 could able to login other w