找传奇、传世资源到传世资源站!

C# 仿window xp 左侧折叠式菜单 源码下载

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

xp 左侧 折叠式菜单
C# 仿window xp 左侧折叠式菜单 源码下载 C#图形和图像处理-第1张using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace MainUI{ public partial class MainFrm : Form { public MainFrm() { InitializeComponent(); } private void MainFrm_Load(object sender, EventArgs e) { CreateOutlookList(); } private void CreateCarList() { listView1.Items.Clear(); listView1.LargeImageList = imageListCars; listView1.Items.Add("Sports", 0); listView1.Items.Add("Beetle", 1); listView1.Items.Add("Vintage", 2); } private void CreateOutlookList() { listView1.Items.Clear(); listView1.LargeImageList = imageListOutlook; listView1.Items.Add("Outlook Today", 0); listView1.Items.Add("Inbox", 1); listView1.Items.Add("Calendar", 2); listView1.Items.Add("Contacts", 3); listView1.Items.Add("Tasks", 4); listView1.Items.Add("Deleted Items", 5); } private void CreateZipList() { listView1.Items.Clear(); listView1.LargeImageList = imageListZip; listView1.Items.Add("Word Docs", 0); listView1.Items.Add("Holiday Pics", 0); listView1.Items.Add("C# programs", 0); listView1.Items.Add("Samba Install", 0); } void ButtonClick(object sender, System.EventArgs e) { // Get the clicked button... Button clickedButton = (Button)sender; // ... and it's tabindex int clickedButtonTabIndex = clickedButton.TabIndex; // Send each button to top or bottom as appropriate foreach (Control ctl in panel1.Controls) { if (ctl is Button) { Button btn = (Button)ctl; if (btn.TabIndex > clickedButtonTabIndex) { if (btn.Dock != DockStyle.Bottom) { btn.Dock = DockStyle.Bottom; // This is vital to preserve the correct order btn.BringToFront(); } } else { if (btn.Dock != DockStyle.Top) { btn.Dock = DockStyle.Top; // This is vital to preserve the correct order btn.BringToFront(); } } } } // Determine which button was clicked. switch (clickedButton.Text) { case "Cars": CreateCarList(); break; case "Outlook Shortcuts": CreateOutlookList(); break; case "Zip Files": CreateZipList(); break; } listView1.BringToFront(); // Without this, the buttons will hide the items. } private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listView1.SelectedIndices.Count > 0) { MessageBox.Show(this.listView1.SelectedItems[0].Text); } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复