Question

J'ai une application MFC qui crée un CDialog. J'aimerais que ce CDialog n'apparaisse pas au milieu de l'écran, mais plutôt sur le côté de l'écran, de sorte qu'il soit à peine visible ou même réduit au minimum.

Comment puis-je faire cela?

Était-ce utile?

La solution

Utilisez SetWindowPos dans votre fonction OnInitDialog () , comme suit:

BOOL CDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    // (x,y) is the upper-left corner in screen coordinates
    SetWindowPos( NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER );
    return TRUE;
}

Autres conseils

Vous pouvez utiliser l'indicateur SW_SHOWMINIMIZED dans ShowWindow (SW_SHOWMINIMIZED) . (SW_SHOWMINIMIZED == > Ouvre la fenêtre dans son état réduit, la représentant sous forme de bouton dans la barre des tâches)

pDlg->Create(IDD_DLG_ID1,this);
pDlg->ShowWindow(SW_SHOWMINIMIZED);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top