private void OnTimerTick(object sender, EventArgs e) { if (_index == _layerList.Count) { _timer.Stop(); RefreshFinished?.Invoke(this, null); return; } bool selected = (0 == Controls.Count) ? _firstLayerSelected : false; ILayer2D layer = _layerList[_index]; // create button and add to panel Button btn = new Button { Image = TryGenerateLayerImage(_layerList[_index], szButtons, selected), Location = new Point(_x, _y) + (Size)AutoScrollPosition, Size = new Size(szButtons.Width, szButtons.Height), Tag = new LayerItem(layer, selected) }; btn.Click += OnLayerSelected; Controls.Add(btn); // give button a tooltip tooltip.SetToolTip(btn, layer.Tooltip(_contHeight)); // adjust i, x and y for next image AdjustXY(ref _x, ref _y); ++_index; }
private void onTimerTick(object sender, EventArgs e) { if (_index == _layerList.Count) { _timer.Stop(); if (null != RefreshFinished) { RefreshFinished(this, null); } return; } bool selected = (0 == Controls.Count) ? _firstLayerSelected : false; ILayer2D layer = _layerList[_index]; // create button and add to panel Button btn = new Button(); btn.Image = LayerToImage.Draw( _layerList[_index], _packable, _contHeight, szButtons, selected , Show3D ? LayerToImage.eGraphMode.GRAPH_3D : LayerToImage.eGraphMode.GRAPH_2D); btn.Location = new Point(_x, _y) + (Size)AutoScrollPosition; btn.Size = new Size(szButtons.Width, szButtons.Height); btn.Tag = new LayerItem(layer, selected); btn.Click += onLayerSelected; Controls.Add(btn); // give button a tooltip tooltip.SetToolTip(btn, layer.Tooltip(_contHeight)); // adjust i, x and y for next image AdjustXY(ref _x, ref _y); ++_index; }