public void DoubleBufferTest () { DoubleBufferedForm f = new DoubleBufferedForm (); f.ShowInTaskbar = false; f.Show (); f.Refresh (); Assert.IsFalse (f.failed, "#01"); Assert.IsTrue (f.painted, "The control was never painted, so please check the test"); f.Close (); }
public static void Main(string[] args) { var f = new DoubleBufferedForm { FormBorderStyle = FormBorderStyle.FixedDialog, ClientSize = new Size( global::FlashPlasma.ActionScript.FlashPlasma.DefaultWidth, global::FlashPlasma.ActionScript.FlashPlasma.DefaultHeight ) }; Plasma.generatePlasma( global::FlashPlasma.ActionScript.FlashPlasma.DefaultWidth, global::FlashPlasma.ActionScript.FlashPlasma.DefaultHeight ); var shift = 0; var bitmap = new Bitmap( global::FlashPlasma.ActionScript.FlashPlasma.DefaultWidth, global::FlashPlasma.ActionScript.FlashPlasma.DefaultHeight ); f.Paint += (object sender, PaintEventArgs e) => { e.Graphics.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); }; var t = new Timer(); t.Interval = 1; t.Tick += delegate { shift++; Plasma.shiftPlasma(shift); var buffer = Plasma.newPlasma; var data = bitmap.LockBits( new Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); for (int i = 0; i < buffer.Length; i++) { Marshal.WriteInt32(data.Scan0, i * 4, unchecked ((int)(buffer[i] | 0xff000000))); } bitmap.UnlockBits(data); f.Invalidate(); }; t.Start(); Application.Run(f); }
public static void Main(string[] args) { var f = new DoubleBufferedForm { FormBorderStyle = FormBorderStyle.FixedDialog, ClientSize = new Size( global::FlashPlasma.ActionScript.FlashPlasma.DefaultWidth, global::FlashPlasma.ActionScript.FlashPlasma.DefaultHeight ) }; Plasma.generatePlasma( global::FlashPlasma.ActionScript.FlashPlasma.DefaultWidth, global::FlashPlasma.ActionScript.FlashPlasma.DefaultHeight ); var shift = 0; var bitmap = new Bitmap( global::FlashPlasma.ActionScript.FlashPlasma.DefaultWidth, global::FlashPlasma.ActionScript.FlashPlasma.DefaultHeight ); f.Paint += (object sender, PaintEventArgs e) => { e.Graphics.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); }; var t = new Timer(); t.Interval = 1; t.Tick += delegate { shift++; Plasma.shiftPlasma(shift); var buffer = Plasma.newPlasma; var data = bitmap.LockBits( new Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); for (int i = 0; i < buffer.Length; i++) { Marshal.WriteInt32(data.Scan0, i * 4, unchecked((int)(buffer[i] | 0xff000000))); } bitmap.UnlockBits(data); f.Invalidate(); }; t.Start(); Application.Run(f); }