Created
July 23, 2020 06:08
-
-
Save holgerschurig/d7358b623f874eb447d66511d9650b25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Drawing; | |
rmusing System.Drawing.Imaging; | |
using System.Windows.Forms; | |
namespace GraphicsTestApp | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private void button2_Click(object sender, EventArgs e) | |
{ | |
CreateOffScreenBitmap(); | |
} | |
private void CreateOffScreenBitmap() | |
{ | |
Console.WriteLine("Create bitmap: width={0} height={1}", Width, Height); | |
Bitmap offScreenBitmap = new Bitmap(Width, Height, PixelFormat.Format16bppRgb555); | |
Graphics graphics = Graphics.FromImage(offScreenBitmap); | |
Console.WriteLine("Done!"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace GraphicsTestApp | |
{ | |
partial class Form1 | |
{ | |
/// <summary> | |
/// Required designer variable. | |
/// </summary> | |
private System.ComponentModel.IContainer components = null; | |
/// <summary> | |
/// Clean up any resources being used. | |
/// </summary> | |
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |
protected override void Dispose(bool disposing) | |
{ | |
if (disposing && (components != null)) | |
{ | |
components.Dispose(); | |
} | |
base.Dispose(disposing); | |
} | |
#region Windows Form Designer generated code | |
/// <summary> | |
/// Required method for Designer support - do not modify | |
/// the contents of this method with the code editor. | |
/// </summary> | |
private void InitializeComponent() | |
{ | |
this.button2 = new System.Windows.Forms.Button(); | |
this.SuspendLayout(); | |
// | |
// button2 | |
// | |
this.button2.Location = new System.Drawing.Point(12, 12); | |
this.button2.Name = "button2"; | |
this.button2.Size = new System.Drawing.Size(75, 23); | |
this.button2.TabIndex = 1; | |
this.button2.Text = "start"; | |
this.button2.UseVisualStyleBackColor = true; | |
this.button2.Click += new System.EventHandler(this.button2_Click); | |
// | |
// Form1 | |
// | |
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); | |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |
this.ClientSize = new System.Drawing.Size(347, 159); | |
this.Controls.Add(this.button2); | |
this.Name = "Form1"; | |
this.Text = "Graphics Test App"; | |
this.ResumeLayout(false); | |
} | |
#endregion | |
private System.Windows.Forms.Button button2; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace GraphicsTestApp | |
{ | |
static class Program | |
{ | |
/// <summary> | |
/// The main entry point for the application. | |
/// </summary> | |
[STAThread] | |
static void Main() | |
{ | |
Application.EnableVisualStyles(); | |
Application.SetCompatibleTextRenderingDefault(false); | |
Application.Run(new Form1()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment