特殊類型表單製作: 實作類別似 Windows XP 的程式介面

來源:互聯網
上載者:User

思路:  2到3個 pictureBox 控制項, 控制是否顯示並確定顯示的座標.

: 上傳較慢, 效果類似於 windows XP 左側導航介面

如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsXP
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void pictureBox5_Click(object sender, EventArgs e)
        {
            int i ;
            i=80;
            pictureBox5.Visible = false;
            pictureBox4.Visible = false;
            label2.Visible = false;
            label3.Visible = false;
            pictureBox6.Top -= i;
            pictureBox8.Top -= i;
            label4.Top -= i;
            label5.Top -= i;
            label6.Top -= i;
            label10.Top -= i;
            label7.Top -= i;
            label8.Top -= i;
            label9.Top -= i;
            pictureBox9.Top -= i;
            pictureBox11.Top -= i;
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            if (pictureBox5.Visible == false)
            {
                int i;
                i = 80;
                pictureBox5.Visible = true;
                pictureBox4.Visible = true;
                label2.Visible = true;
                label3.Visible = true;
                pictureBox6.Top += i;
                pictureBox8.Top += i;
                label4.Top += i;
                label5.Top += i;
                label6.Top += i;
                label10.Top += i;
                label7.Top += i;
                label8.Top += i;
                label9.Top += i;
                pictureBox9.Top += i;
                pictureBox11.Top += i;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor,true);
        }

    }
}

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.