开发者

Form to always show when not maximised?

I am developing a C# form that is a countdown Timer. When the form is maximised it fills the whole screen fine. However when the maximise button is clicked i have configured it to be smaller. However is there a way I can set the Z order so that it will always show when it is in the smaller size version. (i.e - if a powerpoint slide is running (via F5) it would take up the whole screen but with my small countdown timer I want it to have the 0 z order so that it will still display and then run as a countdown to the powerpoint (note this is just one example of why I want it to always show in the smaller version.

I have hooked into the Size Change Event and then used the following:

if (WindowState == FormWindowState.Maximized)
{
.....

to do a number of things (i.开发者_Go百科e. change background image if in Maximised mode. In the else side of this I would then like to set the z order property if possible.

Does anyone know of the code that would help me acheive this?


See Form.TopMost.

A topmost form is a form that overlaps all the other (non-topmost) forms even if it is not the active or foreground form. Topmost forms are always displayed at the highest point in the z-order of the windows on the desktop.

Usage:

if (WindowState == FormWindowState.Maximized) {
    TopMost = true;
}
else {
    TopMost = false;
}

or

TopMost = (WindowState == FormWindowState.Maximized);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜