private void onTimerTick(object sender, EventArgs e) { if (_index == _layerList.Count) { _timer.Stop(); return; } Layer2D layer = _layerList[_index]; // create button and add to panel Button btn = new Button(); btn.Image = LayerToImage.Draw(_layerList[_index], _bProperties, _contHeight, szButtons, false);//bitmap; btn.Location = new Point(_x, _y) + (Size)AutoScrollPosition; btn.Size = szButtons; btn.Tag = new LayerItem(layer, false); btn.Click += onLayerSelected; Controls.Add(btn); // give button a tooltip tooltip.SetToolTip(btn , String.Format("{0} * {1} = {2}\n {3} | {4}" , layer.BoxCount , layer.NoLayers(_contHeight) , layer.CountInHeight(_contHeight) , HalfAxis.ToString(layer.AxisOrtho) , layer.PatternName)); // 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; }
private void onLayerSelected(object sender, EventArgs e) { Button bn = sender as Button; LayerItem lItem = bn.Tag as LayerItem; bool selected = !lItem.Selected; bn.Image = LayerToImage.Draw(lItem.Layer, _bProperties, _contHeight, szButtons, selected); bn.Tag = new LayerItem(lItem.Layer, selected); LayerSelected(this, e); }
public static Bitmap DrawEx(ILayer2D layer, Packable packable, double height, Size size, bool selected, EGraphMode eMode, bool annotate) { try { return(LayerToImage.Draw(layer, packable, height, size, selected, eMode, annotate)); } catch (Exception ex) { _log.Error(ex.ToString()); return(Properties.Resources.QuestionMark); } }
private void onLayerSelected(object sender, EventArgs e) { Button bnSender = sender as Button; // *** single selection if (SingleSelection) { // -> unselect other buttons foreach (Control ctrl in Controls) { Button bt = ctrl as Button; if (bt != bnSender) { LayerItem btItem = bt.Tag as LayerItem; if (btItem.Selected) { btItem.Selected = false; bt.Image = LayerToImage.Draw( btItem.Layer, _packable, _contHeight, szButtons, btItem.Selected , Show3D ? LayerToImage.eGraphMode.GRAPH_3D : LayerToImage.eGraphMode.GRAPH_2D); } } } } // *** LayerItem lItem = bnSender.Tag as LayerItem; bool selected = !lItem.Selected; bnSender.Image = LayerToImage.Draw( lItem.Layer, _packable, _contHeight, szButtons, selected , Show3D ? LayerToImage.eGraphMode.GRAPH_3D : LayerToImage.eGraphMode.GRAPH_2D); bnSender.Tag = new LayerItem(lItem.Layer, selected); if (null != LayerSelected) { LayerSelected(this, e); } }