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. [Machine Learning] Probabilistic Graphical Models:二、Bayes Network Fundamentals(1、Semantics & Factorization)

    一.How to construct the dependency? 1.首字母即随机变量名称 2.I->G是更加复杂的模型,但Bayes里不考虑,因为Bayes只是无环图. 3.CPD = c ...

  2. eclipse下使用Genymotion调试Android程序出现的问题

    一. The connection to adb is down, and a severe error has occured. You must restart adb and Eclipse. ...

  3. Gvim7.4简单配置

    今天下午小折腾了一会Gvim编辑器(7.4版,目前最新).看起来高端又没有代码提示,还能锻炼锻炼记忆. 修改了下默认启动配置<修改后如下图>: 打开编辑器: 编辑->启动设定-> ...

  4. phpmyadmin数据导入最大限制的解决方法

    mysql导入文件最大限制更改解决方法:phpmyadmin库导入出错:You probably tried to upload too large file. Please refer to doc ...

  5. linux建立信任关系

    (1).切换到需要建立信任关系的用户(2).执行命令:ssh-keygen  -d,然后一直回车.该命令会在用户home目录下生成一个隐藏的.ssh目录.目录里面有两个文件:id_dsa.id_dsa ...

  6. 配置公网的域名绑定IP

    1. 在万网.美橙申请了一个域名,当然付完费了.   2. 点击"管理",找到了域名解析   3. 点击"域名解析"   注意"记录值",这 ...

  7. css3:user-select属性

    一.user-select简介 这是在css3 UI规范中新增的一个功能,用来控制内容的可选择性 二.user-select:值 auto——默认值,用户可以选中元素中的内容 none——用户不能选择 ...

  8. GO语言中的指针

    http://www.tizgrape.com/?p=100 Go语言中的指针语法和C++一脉相承,都是用*作为符号,虽然语法上接近,但是实际差异不小. Go使用var定义变量: var v6 *in ...

  9. Flex时间操作

    小弟是Flex新手,最近一段时间领导要求使用Flex开发B/S的一些项目,需要用到时间上的一些操作.上网查询一番好多人都说不好操作,有的甚至非常麻烦.基于此,小弟整理了一些关于Flex时间操作的经验, ...

  10. 《agile java》First : 起步 + 章节练习题

    第一章节:起步 1.创建简单Java类2.创建测试类3.使用JUnit4.学习构造函数5.重构代码 涉及知识:TDD.UML TDD: Test Driven Development, 测试驱动开发. ...