private void CurrentImageHeightTrackBar_Scroll(object sender, EventArgs e) { SentenceGraphics sentence = (SentenceGraphics)sentencesListBox.SelectedItem; if (sentence == null) { return; } int imageHeight = CurrentImageHeightTrackBar.Value; if (sentence.GetImageSize().Height == imageHeight) { return; } sentence.SetImageSize(new Size(sentence.GetImageSize().Width, imageHeight)); CurrentImageHeightLabel.Text = imageHeight.ToString(); sentence.AutoReLine(); PreviewSentence(); }
private void CurrentFontSizeTrackBar_Scroll(object sender, EventArgs e) { SentenceGraphics sentence = (SentenceGraphics)sentencesListBox.SelectedItem; if (sentence == null) { return; } int fontSize = CurrentFontSizeTrackBar.Value; if (sentence.GetFont().Size == fontSize) { return; } sentence.SetFont(new Font(family: FontFamily.GenericSansSerif, fontSize, FontStyle.Regular)); CurrentFontSizeLabel.Text = fontSize.ToString(); sentence.AutoReLine(); PreviewSentence(); }
private void AddSensFileButton_Click(object sender, EventArgs e) { if (fileDialog.ShowDialog() == DialogResult.OK) { var reader = new StreamReader(fileDialog.FileName); Font font = new Font(family: FontFamily.GenericSansSerif, defaultFontSizeTrackBar.Value, FontStyle.Regular); Size size = new Size(DefaultImageWidthTrackBar.Value, DefaultImageHeightTrackBar.Value); Color backColor = DefaultBackColorBox.BackColor; VerticalAlignment vert = (VerticalAlignment)DefaultVertAlignComboBox.SelectedItem; HorizontalAlignment hori = (HorizontalAlignment)DefaultHoriAlignComboBox.SelectedItem; while (reader.EndOfStream == false) { var sentence = new SentenceGraphics(font, size, backColor, vert, hori, reader.ReadLine()); sentence.AutoReLine(); _sentences.Add(sentence); } reader.Close(); } RefreshSentencesListBox(); }