为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

C#仿WINDOWS可折叠导航栏

2018-07-24 4页 doc 15KB 128阅读

用户头像

is_215732

暂无简介

举报
C#仿WINDOWS可折叠导航栏C#仿WINDOWS可折叠导航栏 昨天晚上看见了个帖子,野比小王子在2楼留下下了版主的 ,今天下午没事做,自己也搞了一下,效果 不 怎么好(窗体中有5个panel控件,设置其中4个的DOCK属性为TOP,具体见源码)。 废话不多说,代码如下: C# code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System...
C#仿WINDOWS可折叠导航栏
C#仿WINDOWS可折叠导航栏 昨天晚上看见了个帖子,野比小王子在2楼留下下了版主的 ,今天下午没事做,自己也搞了一下,效果 不 怎么好(窗体中有5个panel控件,设置其中4个的DOCK属性为TOP,具体见源码)。 废话不多说,代码如下: C# code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private Font ft = new Font("黑体",12); private static Panel iPanel= new Panel(); private static PictureBox iPict =new PictureBox(); private void Form1_Load(object sender, EventArgs e) { pictureBox1.Image = global::WindowsFormsApplication2.Properties.Resources.朝上按钮; pictureBox1.Size = global::WindowsFormsApplication2.Properties.Resources.朝上按钮.Size; pictureBox2.Image = global::WindowsFormsApplication2.Properties.Resources.朝上按钮; pictureBox2.Size = global::WindowsFormsApplication2.Properties.Resources.朝上按钮.Size; ft = label1.Font; } private void label1_MouseEnter(object sender, EventArgs e) { ((Label)sender).ForeColor = Color.Red;//设置控件文字 字颜色 ((Label)sender).Font = new Font(ft, ft.Style | FontStyle.Underline);//设置控件字体 } private void label1_MouseLeave(object sender, EventArgs e) { ((Label)sender).ForeColor = Color.Black;//设置控件文 字颜色 ((Label)sender).Font = new Font(ft, ft.Style); //设 置控件字体 } private void pictureBox1_Click(object sender, EventArgs e) { int i = Convert.ToInt16(((PictureBox)sender).Tag.ToString()); switch (i) { case 1: iPanel = panel2_1; iPict = pictureBox1; break; case 2: iPanel = panel2_2; iPict = pictureBox2; break; } if (Convert.ToInt16(iPanel.Tag.ToString()) == 1) { iPanel.Tag = 2; iPict.Image = Properties.Resources.朝上按钮; iPanel.Visible = true; } else { iPanel.Tag = 1; iPict.Image = Properties.Resources.朝下按钮; iPanel.Visible = false; } } } }
/
本文档为【C#仿WINDOWS可折叠导航栏】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索