c# winform 界面问题。在线等。。。 form中有一个button1.一个panel,panel里有个label我点击button1,下面的panel就全屏幕显示在电脑上。鼠标双击或者键盘按esc退出全屏。怎么实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://download.csdn.net/detail/jiayp004/3439634 只能是窗体全屏,设置窗体的topmost=true;和窗体的大小就行了panel和label自动申缩 Dock属性控制panel 如何填充form,WindowState = FormWindowState.Maximized窗体最大化双击退出全屏的话,有双击事件,esc退出全屏的话,PreviewKeyDown事件中,判断键盘的KEY值 貌似2L正解,你需要窗体全屏,然后Panel自动拉伸就好,按照百分比设置也行。其次3L提供的ESC退出也没有问题 貌似2L正解,你需要窗体全屏,然后Panel自动拉伸就好,按照百分比设置也行。其次3L提供的ESC退出也没有问题 貌似2L正解,你需要窗体全屏,然后Panel自动拉伸就好,按照百分比设置也行。其次3L提供的ESC退出也没有问题 private void button1_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Maximized; }然后把Panel的Anchor属性设置为TOP,LELF,RIGHT,BOTTON 全屏 [DllImport("user32.dll", SetLastError = true)] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); private void button1_Click(object sender, EventArgs e) { SetParent(panel1.Handle, IntPtr.Zero); panel1.Left = 0; panel1.Top = 0; panel1.Width = Screen.PrimaryScreen.Bounds.Width; panel1.Height = Screen.PrimaryScreen.Bounds.Height; } private void panel1_DoubleClick(object sender, EventArgs e) { SetParent(panel1.Handle, IntPtr.Zero); //看下开始时候panel1的属性 this.panel1.Location = new System.Drawing.Point(294, 119); this.panel1.Size = new System.Drawing.Size(111, 49); } [DllImport("user32.dll", SetLastError = true)] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); private void button1_Click(object sender, EventArgs e) { SetParent(panel1.Handle, IntPtr.Zero); panel1.Left = 0; panel1.Top = 0; panel1.Width = Screen.PrimaryScreen.Bounds.Width; panel1.Height = Screen.PrimaryScreen.Bounds.Height; } private void panel1_DoubleClick(object sender, EventArgs e) { //开始时候panel1的属性 panel1.Location = new System.Drawing.Point(294, 119); panel1.Size = new System.Drawing.Size(111, 49); } 测试通过,代码如下: private void button1_Click(object sender, EventArgs e) { Form test1 = new Form(); try { test1.ShowInTaskbar = false; test1.FormBorderStyle = FormBorderStyle.None; test1.WindowState = FormWindowState.Maximized; test1.Controls.Add(this.panel1); this.Controls.Remove(this.panel1); this.panel1.Dock = DockStyle.Fill; test1.KeyDown += new KeyEventHandler(test1_KeyDown); test1.ShowDialog(); } finally { this.panel1.Dock = DockStyle.None; this.Controls.Add(this.panel1); test1.Close(); } } private void test1_KeyDown(object sender, KeyEventArgs e) { if(e.KeyCode == Keys.Escape) { ((Form)sender).Close(); } } 颜色控制 bs控件注册问题 关于C# WindowsForm 实现添加,修改功能 如何做一个winform的浮出panel?类似于Calendar的那种。。。。。。。。。。。。。。。。。。。。。。 GridView页面不能显示 请教下网站文件file与图片pic分离的方法.. 修改GridControl控件中的值如何更新数据库中内容 运行结果问题 c#容器控件嵌套问题 C#里如何使用随机数? wpf请教 构造函数起什么作用,可以带参数吗?
panel和label自动申缩
WindowState = FormWindowState.Maximized窗体最大化
双击退出全屏的话,有双击事件,esc退出全屏的话,PreviewKeyDown事件中,判断键盘的KEY值
其次3L提供的ESC退出也没有问题
其次3L提供的ESC退出也没有问题
其次3L提供的ESC退出也没有问题
{
this.WindowState = FormWindowState.Maximized;
}
然后把Panel的Anchor属性设置为TOP,LELF,RIGHT,BOTTON
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
private void button1_Click(object sender, EventArgs e)
{
SetParent(panel1.Handle, IntPtr.Zero);
panel1.Left = 0;
panel1.Top = 0;
panel1.Width = Screen.PrimaryScreen.Bounds.Width;
panel1.Height = Screen.PrimaryScreen.Bounds.Height;
} private void panel1_DoubleClick(object sender, EventArgs e)
{
SetParent(panel1.Handle, IntPtr.Zero);
//看下开始时候panel1的属性
this.panel1.Location = new System.Drawing.Point(294, 119);
this.panel1.Size = new System.Drawing.Size(111, 49);
}
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
private void button1_Click(object sender, EventArgs e)
{
SetParent(panel1.Handle, IntPtr.Zero);
panel1.Left = 0;
panel1.Top = 0;
panel1.Width = Screen.PrimaryScreen.Bounds.Width;
panel1.Height = Screen.PrimaryScreen.Bounds.Height;
} private void panel1_DoubleClick(object sender, EventArgs e)
{
//开始时候panel1的属性
panel1.Location = new System.Drawing.Point(294, 119);
panel1.Size = new System.Drawing.Size(111, 49);
}
private void button1_Click(object sender, EventArgs e)
{
Form test1 = new Form();
try
{
test1.ShowInTaskbar = false;
test1.FormBorderStyle = FormBorderStyle.None;
test1.WindowState = FormWindowState.Maximized; test1.Controls.Add(this.panel1);
this.Controls.Remove(this.panel1);
this.panel1.Dock = DockStyle.Fill;
test1.KeyDown += new KeyEventHandler(test1_KeyDown);
test1.ShowDialog();
}
finally
{
this.panel1.Dock = DockStyle.None;
this.Controls.Add(this.panel1);
test1.Close();
}
}
private void test1_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Escape)
{
((Form)sender).Close();
}
}