private void bindItem() { Common.GetFilebyte(Path.GetFullPath("facecheck.png")); Common.GetFilebyte(Path.GetFullPath("facecheck_click.png")); UcMenuItem itemface = new UcMenuItem(); itemface.Name = "facecheck"; itemface.EnterImage = ImgFaceCheck; itemface.LeaveImage = ImgFaceCheck_Click; itemface.Click += itemface_Click; UcMenuItem itemCom = new UcMenuItem(); itemCom.Name = "facecompar"; itemCom.EnterImage = ImgFaceCompar; itemCom.LeaveImage = ImgFaceCompar_Click; itemCom.Click += itemface_Click; UcMenuItem itemDynamic = new UcMenuItem(); itemDynamic.Name = "facedynamic"; itemDynamic.EnterImage = ImgDFaceCheck; itemDynamic.LeaveImage = ImgDFaceCheck_Click; itemDynamic.Click += itemface_Click; UcMenuItem itemDynamicCom = new UcMenuItem(); itemDynamicCom.Name = "facedynamiccom"; itemDynamicCom.EnterImage = ImgDFaceCompar; itemDynamicCom.LeaveImage = ImgDFaceCompar_Click; itemDynamicCom.Click += itemface_Click; UcMenuItem itemvideo = new UcMenuItem(); itemvideo.Name = "Video"; itemvideo.EnterImage = ImgOfflineHigh; itemvideo.LeaveImage = ImgOfflineHigh_Click; itemvideo.Click += itemface_Click; this.pnlLeftMenu.Controls.Add(itemface); this.pnlLeftMenu.Controls.Add(itemCom); this.pnlLeftMenu.Controls.Add(itemDynamic); this.pnlLeftMenu.Controls.Add(itemDynamicCom); this.pnlLeftMenu.Controls.Add(itemvideo); }
void itemface_Click(object sender) { UcMenuItem item = sender as UcMenuItem; switch (item.Name) { case "facecheck": //人脸检测 if (focusKey != item.Name) { if (pnlContent.Controls.Count > 0) { UserControl uc = (UserControl)pnlContent.Controls[0]; uc.Dispose(); } focusKey = item.Name; UcFaceCheck compar = new UcFaceCheck(); this.pnlContent.Controls.Add(compar); compar.Show(); } break; case "facecompar": //人脸比对 if (focusKey != item.Name) { if (this.pnlContent.Controls.Count > 0) { UserControl uc = (UserControl)pnlContent.Controls[0]; uc.Dispose(); } focusKey = item.Name; UcCompar compar = new UcCompar(); this.pnlContent.Controls.Add(compar); compar.Show(); } break; case "facedynamic": //对态人脸 if (focusKey != item.Name) { if (this.pnlContent.Controls.Count > 0) { UserControl uc = (UserControl)pnlContent.Controls[0]; uc.Dispose(); } focusKey = item.Name; UcDynamic compar = new UcDynamic(); this.pnlContent.Controls.Add(compar); compar.Show(); } break; case "facedynamiccom": //对态人脸 if (focusKey != item.Name) { if (this.pnlContent.Controls.Count > 0) { UserControl uc = (UserControl)pnlContent.Controls[0]; uc.Dispose(); } focusKey = item.Name; UcDynamicCom compar = new UcDynamicCom(); this.pnlContent.Controls.Add(compar); compar.Show(); } break; case "Video": MessageBox.Show("请和FaceCore取得联系,从而获得更佳的人脸识别技术体验~~~"); break; } }