protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); viewer.FrameMove(); viewer.FrameMoveDerived(); viewer.Render(); this.Invalidate(); }
private void SaveToPngEachFrame(int step) { timer1.Enabled = false; string dest_path = @"snapshots"; Directory.CreateDirectory(dest_path); int orig_frame_idx = viewer.FrameIndex; // backup int frame_len = viewer.GetMaxFrameLength(); for (int frame_idx = 0; frame_idx < frame_len; frame_idx += step) { viewer.FrameMove(frame_idx); viewer.Render(); viewer.SaveToPng(Path.Combine(dest_path, String.Format("{0:D3}.png", frame_idx))); } viewer.FrameIndex = orig_frame_idx; // restore timer1.Enabled = true; }