void ReleaseDesignerOutlets() { if (BigLabel != null) { BigLabel.Dispose(); BigLabel = null; } if (MenuTableView != null) { MenuTableView.Dispose(); MenuTableView = null; } if (ProfileImage != null) { ProfileImage.Dispose(); ProfileImage = null; } if (SmallLabel != null) { SmallLabel.Dispose(); SmallLabel = null; } }
private void Editor_SizeChanged(object sender, EventArgs e) { System.Drawing.Font font = BigLabel.Font; String text = BigLabel.Text; using (System.Drawing.Graphics g = BigLabel.CreateGraphics()) { float textWidth = g.MeasureString(text, font).Width; if (textWidth == 0) { return; } float factor = BigLabel.Width / textWidth; if (factor == 0) { return; } BigLabel.Font = new System.Drawing.Font(font.Name, font.SizeInPoints * factor); } }