質問

I need create one item in my ToolStripMenuItem with this feature: if I check it, in application is turn on "stay on top" property.

I tryed this code:

private void alwaysOnTopToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
    {
        if (alwaysOnTopToolStripMenuItem.Checked)
            fForm1.TopMost = true;
        else
        {
            fForm1.TopMost = false;
        }
    }

but I get this error in Visual Studio 2010 (Windows Form)

enter image description here

I dont know how I can solve this strage issue. Thanks in advance.

役に立ちましたか?

解決

assuming the click handler lives in the form:

this.TopMost = alwaysOnTopToolStripMenuItem.Checked;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top