在代码的WinForms标题栏中交换最大化和还原图标 [英] Swapping the Maximize and Restore icons in a WinForms title bar in code

查看:233
本文介绍了在代码的WinForms标题栏中交换最大化和还原图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我们有一个表单,该表单以4 x 1或2 x 2配置托管用户控件的集合.因此,表单沿这些方向出现了一些东西

We have a form that hosts a collection of user controls in either a 4 by 1 or 2 by 2 configuration. So the form appears something along these lines

4 by 1
XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX

4 by 1
XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX

2 x 2
XXXXXXXXXXX XXXXXXXXXXX
XXXXXXXXXXX XXXXXXXXXXX

2 by 2
XXXXXXXXXXX XXXXXXXXXXX
XXXXXXXXXXX XXXXXXXXXXX

表单的MaximumSize属性设置为4 by 1配置,第二个替代的MaximumSize属性存储在容器标记属性中.现在,有2个单选按钮控制表单的显示方式(例如4 x 1或2 x 2).

The form MaximumSize property is set to the 4 by 1 configuration and a second alternate MaximumSize property is stored in the container tag property. Right now there are 2 radio buttons controlling how the form is displayed (eg 4 by 1 or 2 by 2).

由于所选配置将表单大小固定为一个或其他大小,因此我想使用表单的最大化"和还原"事件来处理此问题,而不要使用单选按钮.因此,当活动配置为"4 by 1"时,我需要"Restore"图标 而不是最大化图标显示在窗体的标题栏中.有人可以给我一些有关如何完成此操作的想法吗?预先感谢您的任何想法和/或建议.

Because the form size is fixed as one or the other sizes by the selected configuration, I would like to use the form's Maximize and Restore events to handle this instead of radio buttons. So when the active configuration is 4 by 1, I need the Restore icon to be displayed in the form's title bar instead of the Maximize icon. Can someone give me some ideas about how to accomplish this? Thanks in advance for any ideas and/or suggestions.

推荐答案

我没有确定是否可以,但另一种选择是在标题栏上绘制自己的按钮.下面的链接可能有帮助

Im not sure if that possible but another option is to draw your own button on the title bar. The link below may help

  http://www.codeproject.com/KB/vb/transmenuandtitlebuttons.aspx

kaymaf


这篇关于在代码的WinForms标题栏中交换最大化和还原图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆