Skip to content

Commit

Permalink
fix missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
zwcloud committed May 13, 2018
1 parent 14d2962 commit 116c3e3
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Demo/Windows/DrawPngInMemory/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Windows.Forms;
using Cairo;
using Color = Cairo.Color;
using Graphics = System.Drawing.Graphics;

namespace DrawPngInMemory
{
public partial class Form1 : Form
{
public Graphics Graphics1 { get; private set; }
public Context Context1 { get; set; }
public Win32Surface Surface1 { get; private set; }
byte[] pngData = System.IO.File.ReadAllBytes("1.png");

public Form1()
{
InitializeComponent();
}

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);

Graphics1 = e.Graphics;
Surface1 = new Win32Surface(Graphics1.GetHdc());
Context1 = new Context(Surface1);

using (ImageSurface pngImageSurface = new ImageSurface(pngData))
{
Context1.SetSource(pngImageSurface);
Context1.Paint();
}

Graphics1.Dispose();
Context1.Dispose();
Surface1.Dispose();
}
}
}
21 changes: 21 additions & 0 deletions Demo/Windows/DrawPngInMemory/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DrawPngInMemory
{
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());
}
}
}
49 changes: 49 additions & 0 deletions Demo/Windows/WinFormDemo/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Demo/Windows/WinFormDemo/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinFormDemo
{
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());
}
}
}

0 comments on commit 116c3e3

Please sign in to comment.