網站首頁 編程語言 正文
實踐過程
效果
代碼
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static int var_bar = 1;
private void barter(int n)
{
switch (n)
{
case 1:
{
this.Width = Properties.Resources.sy1_01.Width;
this.Height = Properties.Resources.sy1_01.Height + Properties.Resources.sy1_02.Height - 5;
panel_Title.BackgroundImage = Properties.Resources.sy1_01;
panel_ALL.BackgroundImage = Properties.Resources.sy1_02;
pictureBox_Min.Image = null;
pictureBox_Min.Image = Properties.Resources.sy1_04;
pictureBox_Max.Image = null;
pictureBox_Max.Image = Properties.Resources.sy1_05;
pictureBox_Close.Image = null;
pictureBox_Close.Image = Properties.Resources.sy1_03;
var_bar = 1;
break;
}
case 2:
{
this.Width = Properties.Resources.sy2_01.Width;
this.Height = Properties.Resources.sy2_01.Height + Properties.Resources.sy2_02.Height - 5;
panel_Title.BackgroundImage = Properties.Resources.sy2_01;
panel_ALL.BackgroundImage = Properties.Resources.sy2_02;
pictureBox_Min.Image = null;
pictureBox_Min.Image = Properties.Resources.sy2_04;
pictureBox_Max.Image = null;
pictureBox_Max.Image = Properties.Resources.sy2_05;
pictureBox_Close.Image = null;
pictureBox_Close.Image = Properties.Resources.sy2_03;
var_bar = 2;
break;
}
case 3:
{
this.Width = Properties.Resources.sy3_01.Width;
this.Height = Properties.Resources.sy3_01.Height + Properties.Resources.sy3_02.Height - 5;
panel_Title.BackgroundImage = Properties.Resources.sy3_01;
panel_ALL.BackgroundImage = Properties.Resources.sy3_02;
pictureBox_Min.Image = null;
pictureBox_Min.Image = Properties.Resources.sy3_04;
pictureBox_Max.Image = null;
pictureBox_Max.Image = Properties.Resources.sy3_05;
pictureBox_Close.Image = null;
pictureBox_Close.Image = Properties.Resources.sy3_03;
var_bar = 3;
break;
}
}
barterShow(n);
}
private void barterShow(int n)
{
ToolS_1.Checked = false;
ToolS_2.Checked = false;
ToolS_3.Checked = false;
switch (n)
{
case 1:
ToolS_1.Checked = true;
break;
case 2:
ToolS_2.Checked = true;
break;
case 3:
ToolS_3.Checked = true;
break;
}
}
private void Form1_Load(object sender, EventArgs e)
{
barter(1);
}
#region 設置窗體的最大化、最小化和關閉按鈕的單擊事件
/// <summary>
/// 設置窗體的最大化、最小化和關閉按鈕的單擊事件
/// </summary>
/// <param Frm_Tem="Form">窗體</param>
/// <param n="int">標識</param>
public void FrmClickMeans(Form Frm_Tem, int n)
{
switch (n)
{
case 0:
Frm_Tem.WindowState = FormWindowState.Minimized;
break;
case 1:
{
if (Frm_Tem.WindowState == FormWindowState.Maximized)
Frm_Tem.WindowState = FormWindowState.Normal;
else
Frm_Tem.WindowState = FormWindowState.Maximized;
break;
}
case 2:
Frm_Tem.Close();
break;
}
}
#endregion
#region 控制圖片的切換狀態
/// <summary>
/// 控制圖片的切換狀態
/// </summary>
/// <param Frm_Tem="Form">要改變圖片的對象</param>
/// <param n="int">標識</param>
/// <param ns="int">移出移入標識</param>
public static PictureBox Tem_PictB = new PictureBox();
public void ImageSwitch(object sender, int n, int ns)
{
Tem_PictB = (PictureBox) sender;
switch (n)
{
case 0:
{
Tem_PictB.Image = null;
if (ns == 0)
{
switch (var_bar)
{
case 1:
Tem_PictB.Image = Properties.Resources.sy1_04_1;
break;
case 2:
Tem_PictB.Image = Properties.Resources.sy2_04_1;
break;
case 3:
Tem_PictB.Image = Properties.Resources.sy3_04_1;
break;
}
}
if (ns == 1)
{
switch (var_bar)
{
case 1:
Tem_PictB.Image = Properties.Resources.sy1_04;
break;
case 2:
Tem_PictB.Image = Properties.Resources.sy2_04;
break;
case 3:
Tem_PictB.Image = Properties.Resources.sy3_04;
break;
}
}
break;
}
case 1:
{
Tem_PictB.Image = null;
if (ns == 0)
{
switch (var_bar)
{
case 1:
Tem_PictB.Image = Properties.Resources.sy1_05_1;
break;
case 2:
Tem_PictB.Image = Properties.Resources.sy2_05_1;
break;
case 3:
Tem_PictB.Image = Properties.Resources.sy3_05_1;
break;
}
}
if (ns == 1)
{
switch (var_bar)
{
case 1:
Tem_PictB.Image = Properties.Resources.sy1_05;
break;
case 2:
Tem_PictB.Image = Properties.Resources.sy2_05;
break;
case 3:
Tem_PictB.Image = Properties.Resources.sy3_05;
break;
}
}
break;
}
case 2:
{
Tem_PictB.Image = null;
if (ns == 0)
{
switch (var_bar)
{
case 1:
Tem_PictB.Image = Properties.Resources.sy1_03_1;
break;
case 2:
Tem_PictB.Image = Properties.Resources.sy2_03_1;
break;
case 3:
Tem_PictB.Image = Properties.Resources.sy3_03_1;
break;
}
}
if (ns == 1)
{
switch (var_bar)
{
case 1:
Tem_PictB.Image = Properties.Resources.sy1_03;
break;
case 2:
Tem_PictB.Image = Properties.Resources.sy2_03;
break;
case 3:
Tem_PictB.Image = Properties.Resources.sy3_03;
break;
}
}
break;
}
}
}
#endregion
private void pictureBox_Close_Click(object sender, EventArgs e)
{
FrmClickMeans(this, Convert.ToInt16(((PictureBox) sender).Tag.ToString()));
}
private void pictureBox_Close_MouseEnter(object sender, EventArgs e)
{
ImageSwitch(sender, Convert.ToInt16(((PictureBox) sender).Tag.ToString()), 0);
}
private void pictureBox_Close_MouseLeave(object sender, EventArgs e)
{
ImageSwitch(sender, Convert.ToInt16(((PictureBox) sender).Tag.ToString()), 1);
}
private void ToolS_1_Click(object sender, EventArgs e)
{
barter(Convert.ToInt32(((ToolStripMenuItem) sender).Tag));
}
}
原文鏈接:https://zhima.blog.csdn.net/article/details/128020328
相關推薦
- 2022-06-01 C#的通用DbHelper類(支持數據連接池)示例詳解_C#教程
- 2022-06-14 C#實現加密的幾種方法介紹_C#教程
- 2023-08-16 el-col內容過長導致出現疊字錯誤
- 2022-01-03 CSS字體屬性之復合屬性
- 2022-12-28 詳解Flink同步Kafka數據到ClickHouse分布式表_數據庫其它
- 2022-06-12 .Net?Core?3.1?Web?API基礎知識詳解(收藏)_實用技巧
- 2022-09-30 Docker容器搭建本地私有倉庫詳情_docker
- 2022-05-26 flutter底部彈出BottomSheet詳解_Android
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支