English 中文(简体)
如何对属于制页的一组控制形成全面的筛选观点
原标题:How create a fullscreen view of a group of controls, that belongs to a tabpage
  • 时间:2011-01-07 00:26:51
  •  标签:
  • c#
  • winforms

i 她想知道,对制片控制形成完全筛选的正确方式是什么。 该网页有其他控制,控制有各种活动。 我正试图建立一个新的全面筛选表格,并将表格的所有控制复制到这一表格中,但这种做法需要重新提交相应的手稿。 如果只添加提及内容,则订阅仍然保留,但当完整筛选表已经关闭时,参考复制控制就会丢失。

最佳回答

顺便提一下的是,Winforms支持重新确立控制。 您可以将其移至显示完全筛选的临时形式。 所有正常活动处理人员仍然照常工作。 这里的样本实施是为了控制:

    public static void ShowFullScreen(Control ctl) {
        // Setup host form to be full screen
        var host = new Form();
        host.FormBorderStyle = FormBorderStyle.None;
        host.WindowState = FormWindowState.Maximized;
        host.ShowInTaskbar = false;
        // Save properties of control
        var loc = ctl.Location;
        var dock = ctl.Dock;
        var parent = ctl.Parent;
        var form = parent;
        while (!(form is Form)) form = form.Parent;
        // Move control to host
        ctl.Parent = host;
        ctl.Location = Point.Empty;
        ctl.Dock = DockStyle.Fill;
        // Setup event handler to restore control back to form
        host.FormClosing += delegate {
            ctl.Parent = parent;
            ctl.Dock = dock;
            ctl.Location = loc;
            form.Show();
        };
        // Exit full screen with escape key
        host.KeyPreview = true;
        host.KeyDown += (KeyEventHandler)((s, e) => {
            if (e.KeyCode == Keys.Escape) host.Close();
        });
        // And go full screen
        host.Show();
        form.Hide();
    }

样本使用:

    private void button1_Click(object sender, EventArgs e) {
        ShowFullScreen(tabControl1);
    }
问题回答

暂无回答




相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签