程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> 關於C語言 >> C#特殊類型窗體制作:實現類似QQ的程序界面

C#特殊類型窗體制作:實現類似QQ的程序界面

編輯:關於C語言

原理: n個 listView控件, n個button控件, 然後控制 listVIEw和 button控件的 Dock 屬性

如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace QQ
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }
    private void button1_Click(object sender, EventArgs e)
    {
      listVIEw1.Dock = DockStyle.None;
      button1.Dock = DockStyle.Top;
      button2.Dock = DockStyle.Bottom;
      button3.SendToBack();
      button3.Dock = DockStyle.Bottom;
      listVIEw1.BringToFront();
      listVIEw1.Dock = DockStyle.Bottom;
      listVIEw1.Clear();
      listVIEw1.Items.Add("小豬", "小豬", 0);
      listVIEw1.Items.Add("小狗", "小狗", 1);
      listVIEw1.Items.Add("嬌嬌", "嬌嬌", 2);
    }
    private void Form1_Load(object sender, EventArgs e)
    {
      listVIEw1.Clear();
      listVIEw1.LargeImageList = imageList1;
      listVIEw1.Items.Add("小豬", "小豬", 0);
      listVIEw1.Items.Add("小狗", "小狗", 1);
      listVIEw1.Items.Add("嬌嬌", "嬌嬌", 2);
    }
    private void button2_Click(object sender, EventArgs e)
    {
      listVIEw1.Dock = DockStyle.None;
      button2.Dock = DockStyle.Top;
      button1.SendToBack();
      button1.Dock = DockStyle.Top;
      button3.Dock = DockStyle.Bottom;
      listVIEw1.Dock = DockStyle.Bottom;
      listVIEw1.Clear();
      listVIEw1.Items.Add("北風", "北風", 3);
    }
    private void button3_Click(object sender, EventArgs e)
    {
      listVIEw1.Dock = DockStyle.None;
      button3.SendToBack();
      button3.Dock = DockStyle.Top;
      button2.SendToBack();
      button2.Dock = DockStyle.Top;
      button1.SendToBack();
      button1.Dock = DockStyle.Top;
      listVIEw1.Dock = DockStyle.Bottom;
      listVIEw1.Clear();
      listVIEw1.Items.Add("冰雨", "冰雨", 5);
    }
  }
}

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved