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. gulp 之一 安装及简单CSS,JS文件合并压缩

    最近研究了一下gulp构建工具,发现使用起来比grunt顺手一些.(个人感受),以下是grunt和gulp构建方式和原理: grunt 基于文件方式构建,会把文件先写到临时目录下,然后进行读文件,修改 ...

  2. TensorFlow和最近发布的slim

    笔者将和大家分享一个结合了TensorFlow和最近发布的slim库的小应用,来实现图像分类.图像标注以及图像分割的任务,围绕着slim展开,包括其理论知识和应用场景. 之前自己尝试过许多其它的库,比 ...

  3. C#快递单号查询源码

    源码本人测试过,没有啥问题,能查询快递单号,支持的快递还挺多,圆通快递.申通快递.韵达快递的都支持单号查询的,程序是通过向爱快递(www.aikuaidi.cn)接口传输参数来查询快递单号,我直接把代 ...

  4. Linux运维需要掌握的技能 (转)

    本人是linux运维工程师,对这方面有点心得,现在我说说要掌握哪方面的工具吧说到工具,在行外可以说是技能,在行内我们一般称为工具,就是运维必须要掌握的工具.我就大概列出这几方面,这样入门就基本没问题了 ...

  5. 聊一聊c++中指针为空的三种写法 ----->NULL, 0, nullptr

    看到同事用了一下nullptr.不是很了解这方面东东,找个帖子学习学习 http://www.cppblog.com/airtrack/archive/2012/09/16/190828.aspx N ...

  6. Scut 上线后遇到的问题

    1. 上线后的大并发问题: var sem = new Semaphore(_accepts, _accepts); while (true) { sem.WaitOne(); #pragma war ...

  7. 【产品体验】ONE一个

    第二篇博客,加油加油~~本人产品新人,学习中,希望大家多多指教!  先来两张ONE的界面图镇楼——        ONE简介: “复杂世界里,一个就够了.”这是一款轻量级的文艺阅读应用,每日更新一张图 ...

  8. tyvj 1150 绳子围点 Pick定理 防溢出策略

    P1150 - 绳子围点 From 332404521    Normal (OI)总时限:10s    内存限制:128MB    代码长度限制:64KB 背景 Background 最近小小鱼在研 ...

  9. Energy Minimization

    zoj2539:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2539 题意:公式第一项只要当xi=0时才会有作用,第二项只 ...

  10. Jamie's Contact Groups

    poj2289:http://poj.org/problem?id=2289 题意:给定一个规模为n的名单,要将名单中的人归到m个组中,给出每个人可能的分组号,需要确定一种分配方案,是的最大规模的组最 ...