private void buttonImageSelect_Click(object sender, EventArgs e) { if (imgPopup == null) { // TODO: ImageList is null on initial installation and will throw a nullreference exception when creating a new session and trying to select an image. int n = buttonImageSelect.ImageList.Images.Count; int x = (int)Math.Floor(Math.Sqrt(n)) + 1; int cols = x; int rows = x; imgPopup = new ImageListPopup { BackgroundColor = Color.FromArgb(241, 241, 241), BackgroundOverColor = Color.FromArgb(102, 154, 204) }; imgPopup.Init(buttonImageSelect.ImageList, 8, 8, cols, rows); imgPopup.ItemClick += OnItemClicked; } Point pt = PointToScreen(new Point(buttonImageSelect.Left, buttonImageSelect.Bottom)); imgPopup.Show(pt.X + 2, pt.Y); }
private void buttonImageSelect_Click(object sender, EventArgs e) { if (this.imgPopup == null) { // TODO: ImageList is null on initial installation and will throw a nullreference exception when creating a new session and trying to select an image. int n = buttonImageSelect.ImageList.Images.Count; int x = (int) Math.Floor(Math.Sqrt(n)) + 1; int cols = x; int rows = x; imgPopup = new ImageListPopup(); imgPopup.BackgroundColor = Color.FromArgb(241, 241, 241); imgPopup.BackgroundOverColor = Color.FromArgb(102, 154, 204); imgPopup.Init(this.buttonImageSelect.ImageList, 8, 8, cols, rows); imgPopup.ItemClick += new ImageListPopupEventHandler(this.OnItemClicked); } Point pt = PointToScreen(new Point(buttonImageSelect.Left, buttonImageSelect.Bottom)); imgPopup.Show(pt.X + 2, pt.Y); }
private void buttonImageSelect_Click(object sender, EventArgs e) { if (this.imgPopup == null) { int n = buttonImageSelect.ImageList.Images.Count; int x = (int) Math.Floor(Math.Sqrt(n)) + 1; int cols = x; int rows = x; imgPopup = new ImageListPopup(); imgPopup.BackgroundColor = Color.FromArgb(241, 241, 241); imgPopup.BackgroundOverColor = Color.FromArgb(102, 154, 204); imgPopup.Init(this.buttonImageSelect.ImageList, 8, 8, cols, rows); imgPopup.ItemClick += new ImageListPopupEventHandler(this.OnItemClicked); } Point pt = PointToScreen(new Point(buttonImageSelect.Left, buttonImageSelect.Bottom)); imgPopup.Show(pt.X + 2, pt.Y); }