Example #1
0
        private void addItem(object obj)
        {
            Panel pParent = new Panel();
            Panel p       = new Panel();

            p.AutoScroll = true;
            //p.BackgroundImage = Image.FromFile(@"../../Resources/images/houseBg.png");
            p.BackgroundImage = global::GovDocSearch.Properties.Resources.houseBg;
            p.Width           = 107;
            p.Height          = 32;
            p.Margin          = new Padding(0, 0, 0, 0);
            DataLabel label = new DataLabel();
            Dictionary <string, object> cg = (Dictionary <string, object>)obj;

            label.data = cg;
            //int type = Convert.ToInt32(label.getAttrType("type"));
            //   if (type == 1)
            //   {
            //       label.Text = "公共库-" + label.getAttr("name");
            //   }
            label.Text = label.getAttr("name");
            label.Text = label.Text;
            ToolTip toolTip = new ToolTip();

            toolTip.SetToolTip(label, label.Text); // 鼠标经过浮窗显示账户信息
            label.Dock       = DockStyle.Fill;
            label.Width      = 107;
            label.Height     = 32;
            label.AutoSize   = false;
            label.Font       = new Font("微软雅黑", 8, label.Font.Style);
            label.ForeColor  = Color.White;
            label.TextAlign  = System.Drawing.ContentAlignment.MiddleLeft;
            label.Padding    = new Padding(5, 0, 5, 0);
            label.BackColor  = Color.Transparent;
            label.AllowDrop  = true;
            label.DragEnter += new DragEventHandler(houseLabel_dragEnter);
            label.DragDrop  += new DragEventHandler(houseLabel_DragDrop);
            label.DragLeave += new EventHandler(houseLabel_dragLeave);
            //label.BorderStyle = BorderStyle.FixedSingle;
            p.Controls.Add(label);
            Controls.Add(p);
        }