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. PHP设计模式之:工厂模式

    工厂模式: 由工厂类根据参数来决定创建出哪一种产品类的实例: 工厂类是指包含了一个专门用来创建其他对象的方法的类.所谓按需分配,传入参数进行选择,返回具体的类.工厂模式的最主要作用就是对象创建的封装. ...

  2. 设计模式之 Singleton 单例模式

    先上两段代码,区别仅在于是否涉及线程安全. 首先是不涉及多线程的单例: public class Singleton { private final static Singleton INSTANCE ...

  3. 关于js的callback回调函数的理解

    回调函数的处理逻辑理解:所谓的回调函数处理逻辑,其实就是先将回调函数的代码 冻结(或者理解为闲置),接着将这个回调函数的代码放到回调函数管理器的队列里面. 待回调函数被触发调用的时候,对应的回调函数的 ...

  4. 在python 中有时候我们用数组

    在python 中有时候我们用数组操作数据可以极大的提升数据的处理效率, 类似于R的向量化操作,是的数据的操作趋于简单化,在python 中是使用numpy模块可以进行数组和矢量计算. 下面来看下简单 ...

  5. PYTHON开发--面向对象基础二

    一.成员修饰符 共有成员 私有成员, __字段名 - 无法直接访问,只能间接访问 1.     私有成员 1.1  普通方法种的私有成员 class Foo: def __init__(self, n ...

  6. [python]随机数

    import random()testlist = [1,3,4,5]a,b = 1,5random().random()() 生成0至1之间的随机浮点数,结果大于等于0.0,小于1.0random. ...

  7. bzoj 2741: 【FOTILE模拟赛】L 分塊+可持久化trie

    2741: [FOTILE模拟赛]L Time Limit: 15 Sec  Memory Limit: 162 MBSubmit: 1116  Solved: 292[Submit][Status] ...

  8. sequence使用

    SQL> create sequence seq1 minvalue 1 maxvalue 999999999999999999999999999 start with 0 increment ...

  9. IP分片和TCP分片 MTU和MSS(转)

    IP分片和TCP分片 MTU和MSS(转) 访问原文:http://blog.csdn.net/keyouan2008/article/details/5843388 1,MTU(Maximum Tr ...

  10. ORACLE软件下载地址

    Oracle Database 11g Release 2 Standard Edition and Enterprise Edition Software Downloads Oracle 数据库 ...