private void ClearImage_Paint(object sender, PaintEventArgs e) { System.Drawing.Imaging.BitmapData bitmapData = _Bitmap.LockBits(new Rectangle(0, 0, _Bitmap.Width, _Bitmap.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); _Queue.Submit(new VkSubmitInfo[] { new VkSubmitInfo() { commandBuffers = new VkCommandBuffer[] { _CommandBuffer } } }, _Fence); if (_Fence.WaitForFence(1000)) { // If the submission completed we copy the image data into the bitmap data Copy(bitmapData.Scan0, _ImagePtr, (int)_Image.MemoryRequirements.size); } _Bitmap.UnlockBits(bitmapData); e.Graphics.DrawImage(_Bitmap, new Rectangle(0, 0, Width, Height)); }
private void Triangle_Paint(object sender, PaintEventArgs e) { System.Drawing.Imaging.BitmapData bitmapData = _Bitmap.LockBits(new Rectangle(0, 0, _Bitmap.Width, _Bitmap.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); _Queue.Submit(new VkSubmitInfo[] { new VkSubmitInfo() { commandBuffers = new VkCommandBuffer[] { _CommandBuffer } } }, _Fence); if (_Fence.WaitForFence(1000)) { // If the submission completed we copy the image data into the bitmap data _Framebuffer.BlitFramebufferToPointer(_Queue, bitmapData.Scan0); } else { this.Invalidate(); } _Bitmap.UnlockBits(bitmapData); e.Graphics.DrawImage(_Bitmap, new Rectangle(0, 0, Width, Height)); }