Form en plein écran et height

testeur115 Messages postés 34 Date d'inscription jeudi 12 avril 2007 Statut Membre Dernière intervention 15 juin 2008 - 4 juin 2008 à 23:50
PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 - 5 juin 2008 à 17:18
J'ai un form sur lequel j'ai mis windowstate a maximized et j'ai mon écran qui fait 800 de hauteur.
Si je fait un me.height dans mon form, ça me sort 808. Pourquoi ?

8 réponses

Kevin.Ory Messages postés 840 Date d'inscription mercredi 22 octobre 2003 Statut Membre Dernière intervention 7 janvier 2009 11
5 juin 2008 à 00:10
Salut,




Ton écran fait 800 de hauteur? Tu es sûr? Je n'ai jamais vu une telle résolution sur un écran PC...
Moi mon écran 864 pixels de haut, et mon Form.Height 842, les 22 manquants sont ma barre des tâches...
0
testeur115 Messages postés 34 Date d'inscription jeudi 12 avril 2007 Statut Membre Dernière intervention 15 juin 2008
5 juin 2008 à 00:14
Oui j'ai 1280 * 800
J'ai pas la barre de taches, j'ai mis plein écran mon form et donc il fait 8 de plus que la hauteur de mon écran bizar
0
Kevin.Ory Messages postés 840 Date d'inscription mercredi 22 octobre 2003 Statut Membre Dernière intervention 7 janvier 2009 11
5 juin 2008 à 00:19
"Oui j'ai 1280 * 800"
Ouais ok..

Mais alors ouais, je ne sais pas
0
testeur115 Messages postés 34 Date d'inscription jeudi 12 avril 2007 Statut Membre Dernière intervention 15 juin 2008
5 juin 2008 à 00:23
pareil avec width ça me sort 1288
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
mortalino Messages postés 6786 Date d'inscription vendredi 16 décembre 2005 Statut Membre Dernière intervention 21 décembre 2011 18
5 juin 2008 à 00:46
Salut,

je suis aussi en 1280 x 800 et j'ai le même résultat.

Me.Height / Screen.TwipsPerPixelX
=>808

Screen.Height / Screen.TwipsPerPixelX
=>800

Mais je viens de remarquer que la bordure de la Form, quand celle ci est maximisée, on ne la voit pas en bas et sur les côtés (et un bout est rogné sur le haut du bandeau Caption) Donc c'est c'est ta différence de 8 pixels (4 de chaque côté)

@++

le mystérieux chevalier,"Provençal, le gaulois"
Forum Office & VBA
0
testeur115 Messages postés 34 Date d'inscription jeudi 12 avril 2007 Statut Membre Dernière intervention 15 juin 2008
5 juin 2008 à 00:50
Ok :) je vais faire mes calcul en enlevant 8 a width et height :)
0
PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 47
5 juin 2008 à 16:35
salut,

pas forcément, çà peut dépendre du thème etc....

il faudrait tester :

'In general
section
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Const SM_CXSCREEN =  0 'X Size of screen
Const SM_CYSCREEN = 1 'Y Size of Screen

Const SM_CXBORDER = 5 'Width of no-sizable
borders
Const SM_CYBORDER = 6 'Height of non-sizable borders

Const SM_CXFULLSCREEN = 16 'Width of client area of maximized
window
Const SM_CYFULLSCREEN = 17 'Height of client area of maximized window

Private Sub Form_Load()
    Debug.Print "SM_CXSCREEN :
" & GetSystemMetrics(SM_CXSCREEN)
    Debug.Print "SM_CYSCREEN :
" & GetSystemMetrics(SM_CYSCREEN)
    
    Debug.Print "SM_CXBORDER :
" & GetSystemMetrics(SM_CXBORDER)
    Debug.Print "SM_CYBORDER :
" & GetSystemMetrics(SM_CYBORDER)
    
    Debug.Print "SM_CXFULLSCREEN :
" & GetSystemMetrics(SM_CXFULLSCREEN)
    Debug.Print "SM_CYFULLSCREEN :
" & GetSystemMetrics(SM_CYFULLSCREEN)
    
''   -----------
''  
TRACE
''   -----------
'SM_CXSCREEN : 1280
'SM_CYSCREEN :
1024
'SM_CXBORDER : 1
'SM_CYBORDER : 1
'SM_CXFULLSCREEN :
1280
'SM_CYFULLSCREEN : 954
End Sub

déclaration API pour DotNet :

Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Integer) As Integer

<hr size ="2" width="100%" />Prenez un instant pour répondre à [infomsg_SONDAGE-POP3-POUR-CS_769706.aspx ce sondage] svp
0
PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 47
5 juin 2008 à 17:18
'http://msdn.microsoft.com/en-us/library/ms724385(VS.85).aspx


Private Declare Function 
GetSystemMetrics
Lib
"user32" 
(
ByVal 
nIndex 
As Long

As Long




Const 
SM_CXMAXIMIZED = 
61 
'The default width, in pixels, of a maximized top-level window on
the primary display monitor.


Const 
SM_CYMAXIMIZED = 
62 
'The default height, in pixels, of a maximized top-level window on
the primary display monitor.








Private Sub 
Form_Load()

    Me.WindowState = vbMaximized
    Me.Show
    MsgBox "API :  " & GetSystemMetrics(SM_CXMAXIMIZED) & " * " & GetSystemMetrics(SM_CYMAXIMIZED) & vbCrLf &
_
           "Réel : " & Me.Width / Screen.TwipsPerPixelX & " * " & Me.Height / Screen.TwipsPerPixelY

Unload Me
End Sub

++
PCPT  [AFCK]
<hr size="2" width="100%" />Prenez un instant pour répondre à [infomsg_SONDAGE-POP3-POUR-CS_769706.aspx ce sondage] svp
0
Rejoignez-nous