基本信息
源码名称:C# 拖拽控件实例源码
源码大小:0.31M
文件格式:.zip
开发语言:C#
更新时间:2016-12-27
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 3 元 
   源码介绍

需安装 DevComponents.DotNetBar2 


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 LTEClient
{
    public partial class MainForm : Form
    {
        List<zyInfo> Resources = new List<zyInfo>(); //资源列表
        List<zyInfo> ResourcesUsed = new List<zyInfo>();//已经使用的资源列表
      
        String[] ids = { "1", "2", "3", "4", "5" };
        String[] types = { "1", "2", "0", "1", "2" };
        String[] isuseds = { "1", "0", "1", "0", "1" };
        WS.ServiceHelloService ws = new WS.ServiceHelloService();
        Uerinfo user = new Uerinfo();
        public MainForm()
        {
            InitializeComponent();
            //label1.Text = getDate();
            label2.Text = Uerinfo.username;
            getList();
            label1.Text = this.groupBox1.Size.Width.ToString();
            for (int i = 0; i <= Resources.Count/4; i  )
            {
                for (int j = 0; j < 4; j  )
                {
                    if (i * 4   j < Resources.Count)
                    {
                        int num = 4 * i   j;
                        PictureBox pb = new PictureBox();
                        Label lb = new Label();

                        if(Resources[4 * i   j].type.Equals("0")){
                            pb.Image = global::LTEClient.Properties.Resources.service;
                            pb.Name = "service"   num;
                            lb.Name = "service"   num;
                            lb.Text = "服务器"   num;
                        }
                        else if(Resources[4 * i   j].type.Equals("1")){
                            pb.Image = global::LTEClient.Properties.Resources.base1;
                            pb.Name = "base"   num;
                            lb.Name = "lbase"   num;
                            lb.Text = "基站"   num;
                        }
                        else if(Resources[4 * i   j].type.Equals("2")){
                             pb.Image = global::LTEClient.Properties.Resources.terminal;
                             pb.Name = "terminal"   num;
                             lb.Name = "lbase"   num;
                             lb.Text = "终端"   num;
                        }
                     //   textBox1.Text =Resources[4 * i   j].type "---";
                        pb.Location = new System.Drawing.Point(20   100 * j, 25   120 * i);
                      
                        
                        pb.Size = new System.Drawing.Size(60, 80);
                        pb.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
                        pb.TabIndex = num;
                        pb.TabStop = false;
                        //pb.Click  = new System.EventHandler(btn_click);

                        // 
                        // label3
                        // 
                     
                        lb.AutoSize = true;
                        lb.Location = new System.Drawing.Point(20   100 * j, 126  110 * i);
                        
                        lb.Size = new System.Drawing.Size(60, 20);
                        lb.TabIndex = 1;

                       // MyControl myCon = new MyControl(pb, lb);

                        new MoveControl(pb);
                   
                        this.groupBox1.Controls.Add(pb);
                        this.groupBox1.Controls.Add(lb);
                    }
                }
              
            }
        
        }
        private void btn_click(object sender, System.EventArgs e)
        {
            PictureBox b1 = (PictureBox)sender;//将触发此事件的对象转换为该Button对象

            MessageBox.Show(""   b1.Name);
        }
        public String getDate()
        {
            String sss = "";
            try
            {
                sss = ws.getValue("孙洪波");
            }
            catch {
                MessageBox.Show("WebService接口连接异常!");
            }
    
            return sss;
        }
     

        public void getList() { 
            for(int i=0;i<ids.Length;i  )
            {
               zyInfo zs = new zyInfo();
               zs.id=ids[i];
               zs.type=types[i];
               zs.isused=isuseds[i];
               Resources.Add(zs);
        
            }

            Resources.Sort((zyInfo h1, zyInfo h2) =>
            {
                return h1.type.CompareTo(h2.type);
            }); 
         /*   for (int j = 0; j < Resources.Count; j  )
            {

                textBox1.Text  = Resources[j].id   "---"   Resources[j].isused   "---"   Resources[j].type   "\r\n";
            
            }*/
        }

        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {

        }

  

     

    }


  
}