private void MainForm_Load(object sender, EventArgs e) { var patternTypes = PatternDescription.GetPatternDescription(); int i = 0; foreach (var type in patternTypes) { CreatePatternButton(type, i); i++; } }
private void CreatePatternToolTip(PatternDescription patternDesc, Button btnPattern) { if (string.IsNullOrEmpty(patternDesc.Description)) { return; } ToolTip toolTipPattern = new ToolTip(); toolTipPattern.ToolTipIcon = ToolTipIcon.Info; toolTipPattern.ToolTipTitle = btnPattern.Text; toolTipPattern.SetToolTip(btnPattern, GetToolTipWrapText(patternDesc.Description)); }
private void CreatePatternButton(PatternDescription patternDesc, int i) { Button btnPattern = new Button(); btnPattern.Image = patternDesc.Icon.ToBitmap(); btnPattern.TextAlign = ContentAlignment.BottomCenter; btnPattern.Text = patternDesc.DisplayName; //btnPattern.Font = new Font(FontFamily.g, ); btnPattern.Tag = patternDesc; btnPattern.Size = new Size(100, 100); btnPattern.Location = new Point(20 + 110 * (i % 5), 20 + 100 * (i / 5)); btnPattern.Click -= BtnPattern_Click; btnPattern.Click += BtnPattern_Click; CreatePatternToolTip(patternDesc, btnPattern); Controls.Add(btnPattern); }
public PatternForm(PatternDescription patternDesc) : this() { _patternDesc = patternDesc; }