Skip to content

Commit 116c3e3

Browse files
committed
fix missing files
1 parent 14d2962 commit 116c3e3

File tree

4 files changed

+130
-0
lines changed

4 files changed

+130
-0
lines changed

Demo/Windows/DrawPngInMemory/Form1.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Windows.Forms;
2+
using Cairo;
3+
using Color = Cairo.Color;
4+
using Graphics = System.Drawing.Graphics;
5+
6+
namespace DrawPngInMemory
7+
{
8+
public partial class Form1 : Form
9+
{
10+
public Graphics Graphics1 { get; private set; }
11+
public Context Context1 { get; set; }
12+
public Win32Surface Surface1 { get; private set; }
13+
byte[] pngData = System.IO.File.ReadAllBytes("1.png");
14+
15+
public Form1()
16+
{
17+
InitializeComponent();
18+
}
19+
20+
protected override void OnPaint(PaintEventArgs e)
21+
{
22+
base.OnPaint(e);
23+
24+
Graphics1 = e.Graphics;
25+
Surface1 = new Win32Surface(Graphics1.GetHdc());
26+
Context1 = new Context(Surface1);
27+
28+
using (ImageSurface pngImageSurface = new ImageSurface(pngData))
29+
{
30+
Context1.SetSource(pngImageSurface);
31+
Context1.Paint();
32+
}
33+
34+
Graphics1.Dispose();
35+
Context1.Dispose();
36+
Surface1.Dispose();
37+
}
38+
}
39+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
using System.Windows.Forms;
5+
6+
namespace DrawPngInMemory
7+
{
8+
static class Program
9+
{
10+
/// <summary>
11+
/// The main entry point for the application.
12+
/// </summary>
13+
[STAThread]
14+
static void Main()
15+
{
16+
Application.EnableVisualStyles();
17+
Application.SetCompatibleTextRenderingDefault(false);
18+
Application.Run(new Form1());
19+
}
20+
}
21+
}

Demo/Windows/WinFormDemo/Form1.Designer.cs

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/Windows/WinFormDemo/Program.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
using System.Windows.Forms;
5+
6+
namespace WinFormDemo
7+
{
8+
static class Program
9+
{
10+
/// <summary>
11+
/// The main entry point for the application.
12+
/// </summary>
13+
[STAThread]
14+
static void Main()
15+
{
16+
Application.EnableVisualStyles();
17+
Application.SetCompatibleTextRenderingDefault(false);
18+
Application.Run(new Form1());
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)