private void timer_Tick(object sender, EventArgs e) { if (null == _components || i == _components.GetLength(0)) { timer.Stop(); return; } Image image; Guid guid; string name, description; Size size = new Size(cxButton, cyButton); try { Pic.Plugin.Tools tools = new Pic.Plugin.Tools(_components[i], new Pic.Plugin.ComponentSearchDirectory(_libraryPath)); tools.GenerateImage(size, out image); guid = _components[i].Guid; name = _components[i].Name; description = _components[i].Description; } catch (Exception exception) { _log.Error(exception.ToString()); ++i; return; } // create button and add to panel Button btn = new Button(); btn.Image = image; btn.Location = new Point(x, y) + (Size)AutoScrollPosition; btn.Size = new Size(cxButton, cyButton); btn.Tag = (object)guid; btn.Click += new EventHandler(btn_Click); Controls.Add(btn); // give button a tooltip tooltip.SetToolTip(btn, String.Format("{0}\n{1}", name, description)); // adjust i, x and y for next image AdjustXY(ref x, ref y); ++i; }
private void timer_Tick(object sender, EventArgs e) { if (null ==_components || i == _components.GetLength(0)) { timer.Stop(); return; } Image image; Guid guid; string name, description; Size size = new Size(cxButton, cyButton); try { Pic.Plugin.Tools tools = new Pic.Plugin.Tools(_components[i], new Pic.Plugin.ComponentSearchDirectory(_libraryPath)); tools.GenerateImage( size, out image ); guid = _components[i].Guid; name = _components[i].Name; description = _components[i].Description; } catch (Exception exception) { _log.Error(exception.ToString()); ++i; return; } // create button and add to panel Button btn = new Button(); btn.Image = image; btn.Location = new Point(x, y) + (Size)AutoScrollPosition; btn.Size = new Size(cxButton, cyButton); btn.Tag = (object)guid; btn.Click += new EventHandler(btn_Click); Controls.Add(btn); // give button a tooltip tooltip.SetToolTip(btn, String.Format("{0}\n{1}", name, description)); // adjust i, x and y for next image AdjustXY(ref x, ref y); ++i; }