//按下图标显示 void pb_MouseDown(object sender, MouseEventArgs e) { ucBusy pb = sender as ucBusy; pb.Image = Properties.Resources.银色_点击后1; pb.Brush = new SolidBrush(Color.Black); pb.Refresh(); this.lastCard = pb; }
void pbu_Click(object sender, EventArgs e) { ucBusy pb = sender as ucBusy; TBusinessModel busy = pb.Tag as TBusinessModel; selectBusy = busy; if (SelectedBusy != null) { SelectedBusy(); } }
public void CreateBusiness() { this.pnBusiness.ClearControl(); int rowCount = 6;//一行 int count = 0; //int sX = 25;//起始坐标 int sY = 25; //起始坐标 int height = 105; //一行高度 int width = 206; int currY = 0; int currX = 6; int yGAP = 19; //行间距 int xGAP = 81; //列间距 var list = bList.Skip(pageCount * cureentPage).Take(pageCount); this.pnBusiness.MouseUp += this.pb_MouseUp; foreach (var u in list) { ucBusy pb = new ucBusy(); pb.Name = "pb_b_" + count; pb.Tag = u; pb.MouseEnter += (s, e) => { this.Cursor = Cursors.Hand; }; pb.MouseLeave += (s, e) => { this.Cursor = Cursors.Default; }; pb.Image = Properties.Resources.蓝色_点击前1; pb.Rectangle.Size = new Size(width, height); pb.MouseClick += pbu_Click; pb.MouseDown += pb_MouseDown; pb.Rectangle.Location = new Point(currX, currY + sY); currX = currX + width + xGAP; if (count % rowCount == rowCount - 1) { currY += (sY + height + yGAP); currX = 6; } pnBusiness.AddControl(pb); count++; } pnBusiness.Draw(); }