public MainForm() { InitializeComponent(); settingsForm = new SettingsForm(this); settingsForm.ShowDialog(); promptsList = new List <string>(); autoForm = new AutocompletionForm(this, textBox); wordsPreviewForm = new WordsPreviewForm(); fileManager = new NoteManager(); View = new ViewFitter(autoForm, autoForm.GetListBox(), textBox); WordProcessor = new WordProcessor(); }
public ViewFitter(AutocompletionForm af, ListBox lb, TextBox tb) { Console.OutputEncoding = Encoding.UTF8; autoForm = af; listBox = lb; textBox = tb; textBoxCorner = textBox.Parent.PointToScreen(textBox.Location); using (Graphics g = textBox.CreateGraphics()) { lineHeight = Convert.ToInt32(g.MeasureString("A", textBox.Font).Height); fontWidth = Convert.ToInt32(g.MeasureString("A", textBox.Font).Width); spaceWidth = Convert.ToInt32(g.MeasureString(" ", textBox.Font).Width); } }