1:窗体首次加载时最大化

(1):主窗体

this.WindowState = FormWindowState.Maximized;

//窗体显示中间部分,不显示窗体名称和最小化、最大化、关闭按钮

            this.FormBorderStyle = FormBorderStyle.None;

this.WindowState = FormWindowState.Maximized;

(2):子窗体

设置父窗体的属性:IsMdiContainer=True

Form f = new Form();

            f.MdiParent = this;

f.WindowState = FormWindowState.Maximized;



[转]窗体最大化的时候,如何指定窗体的位置、大小(C#)

using System; 

using System.Collections.Generic; 

using System.ComponentModel; 

using System.Data; 

using System.Drawing; 

using System.Text; 

using System.Windows.Forms; 

namespace WindowsApplication1 



public partial class FormRegion : Form. 



private const long WM_GETMINMAXINFO = 0x24; 

public struct POINTAPI 



public int x; 

public int y; 



public struct MINMAXINFO 



public POINTAPI ptReserved; 

public POINTAPI ptMaxSize; 

public POINTAPI ptMaxPosition; 

public POINTAPI ptMinTrackSize; 

public POINTAPI ptMaxTrackSize; 



public FormRegion() 



InitializeComponent(); 

this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); 



protected override void WndProc(ref System.Windows.Forms.Message m) 



base.WndProc(ref m); 

if (m.Msg == WM_GETMINMAXINFO) 



MINMAXINFO mmi = (MINMAXINFO)m.GetLParam(typeof(MINMAXINFO)); 

mmi.ptMinTrackSize.x = this.MinimumSize.Width; 

mmi.ptMinTrackSize.y = this.MinimumSize.Height; 

if (this.MaximumSize.Width != 0 || this.MaximumSize.Height != 0) 



mmi.ptMaxTrackSize.x = this.MaximumSize.Width; 

mmi.ptMaxTrackSize.y = this.MaximumSize.Height; 



mmi.ptMaxPosition.x = 1; 

mmi.ptMaxPosition.y = 1; 

System.Runtime.InteropServices.Marshal.StructureToPtr(mmi, m.LParam, true); 







}

MessageBox.Show("当前窗体标题栏高度"+(this.Height
- this.ClientRectangle.Height).ToString());//获得当前窗体标题栏高度 

ClientRectangle//获取表示控件的工作区的矩形 

MessageBox.Show(SystemInformation.PrimaryMonitorSize.ToString()); //获取主显示器屏幕的尺寸(像素) 

//获取主显示器当前当前视频模式的尺寸(以象素为单位) 

MessageBox.Show("菜单栏高度"+SystemInformation.MenuHeight.ToString());
//获取标准菜单栏的高度 

MessageBox.Show("标题栏高度"+SystemInformation.CaptionHeight.ToString());
//获取标准标题栏的高度 

MenuHeight//获取一个菜单行的高度(以象素为单位) 

CaptionHeight//获取窗口的标准标题栏区域的高度(以象素为单位)

当前的屏幕除任务栏外的工作域大小

    this.Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;

    this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;



当前的屏幕包括任务栏的工作域大小

this.Width=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;

this.Height=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;



任务栏大小

this.Width=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width-System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;

this.Height=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height-System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;



winform实现全屏显示

WinForm:

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.TopMost = true;  

版权声明:本文为博主原创文章,未经博主允许不得转载。

winform 窗体最大化 分类: WinForm 2014-07-17 15:57 215人阅读 评论(0) 收藏的更多相关文章

  1. PIE(二分) 分类: 二分查找 2015-06-07 15:46 9人阅读 评论(0) 收藏

    Pie Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submissio ...

  2. hdu 1041 (OO approach, private constructor to prevent instantiation, sprintf) 分类: hdoj 2015-06-17 15:57 25人阅读 评论(0) 收藏

    a problem where OO seems more natural to me, implementing a utility class not instantiable. how to p ...

  3. Find The Multiple 分类: 搜索 POJ 2015-08-09 15:19 3人阅读 评论(0) 收藏

    Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 21851 Accepted: 8984 Sp ...

  4. 周赛-DZY Loves Chessboard 分类: 比赛 搜索 2015-08-08 15:48 4人阅读 评论(0) 收藏

    DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. The Happy Worm 分类: POJ 排序 2015-08-03 18:57 5人阅读 评论(0) 收藏

    The Happy Worm Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 4698 Accepted: 1047 Descr ...

  6. Ultra-QuickSort 分类: POJ 排序 2015-08-03 15:39 2人阅读 评论(0) 收藏

    Ultra-QuickSort Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 48111   Accepted: 17549 ...

  7. Drainage Ditches 分类: POJ 图论 2015-07-29 15:01 7人阅读 评论(0) 收藏

    Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 62016 Accepted: 23808 De ...

  8. cf 61E. Enemy is weak 树状数组求逆序数(WA) 分类: Brush Mode 2014-10-19 15:16 104人阅读 评论(0) 收藏

    #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> ...

  9. 二分图匹配 分类: ACM TYPE 2014-10-01 19:57 94人阅读 评论(0) 收藏

    #include<cstdio> #include<cstring> using namespace std; bool map[505][505]; int n, k; bo ...

随机推荐

  1. Problem 1010 - 素数环问题

    #include<iostream> #include<string> #include<algorithm> #include<vector> #in ...

  2. asp.net treeview控件无刷新选择和删除节点的ajax方法

    转载 http://blog.csdn.net/luq885/article/details/1621681 如果节点被选择的话,节点所在的td的class属性就会被设置为TreeView1_1.   ...

  3. QTableWidget中添加按钮

    添加按钮 void QTableWidget::setCellWidget ( int row, int column, QWidget * widget ) widget可以是自己定义的按钮 cla ...

  4. Webstorm6的汉化以及主题设置

    Webstorm6.0.2界面截图: webstorm作为一款前端开发软件,被业内称为神器,下面是下载地址. 需要的人太多,邮件不过来,传到这边方便大家下载 汉化包 http://www.jetbra ...

  5. 【转】oracle数据库NUMBER数据类型

    原文:http://www.jb51.net/article/37633.htm NUMBER ( precision, scale)a)  precision表示数字中的有效位;如果没有指定prec ...

  6. php多行字符串输出

      $content_header =<<<CONTENT_HEADER <section class="content-header"> <h ...

  7. 求LR(0)文法的规范族集和ACTION表、GOTO表的构造算法

    原理 数据结构 // GO private static Map<Map<Integer,String>,Integer> GO = new HashMap<Map< ...

  8. Hdu 3177 Crixalis's Equipment

    Crixalis's Equipment Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  9. EasyPHP的Apache报错

    今天安装了最新版本的软件:EasyPHP-DevServer-14.1VC11-install.exe 启动报错: 打开Cport软件: 可见80端口被系统占用,导致Apache不能启动. (1)手动 ...

  10. uva 10130 SuperSale

    一个01背包问题: 刚刚开始把题目看错了,以为物品的数目是有限的,然后让你求一个家庭里最多能够拿多个价值的东西: 这样一来的话,这个题目就有点意思了: 但是后来发现竟然是个简单的01背包问题 =  = ...