protected override void OnResizeEnd(EventArgs e) { base.OnResizeEnd(e); if (Width > maxSize.Width || Height > maxSize.Height) { Width = maxSize.Width; Height = maxSize.Height; } Rectangle fullRect = timeline.GetRealSize(); if (fullRect.Width <= 0 || fullRect.Height <= 0) { return; } UpdateNavBitmap(); }
public void SaveToPng(string filename) { Rectangle tlRect = timeline.GetRealSize(); int width = headingBitmap.Width; int height = timelineRect.Y + tlRect.Height; Bitmap bitmap = null; for (bitmap = null; bitmap == null;) { try { bitmap = new Bitmap(width, height); } catch (ArgumentException) { if (width > height) { width /= 2; } else { height /= 2; } } } Graphics g = Graphics.FromImage(bitmap); g.DrawImage(headingBitmap, new Rectangle(0, 0, width, headingBitmap.Height)); timeline.DrawToBitmapFull(bitmap, 0, timelineRect.Y); Stream stream = File.Open(filename, FileMode.Create); bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png); stream.Close(); }