forked from ArtifexSoftware/Ghostscript.NET
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFMain.cs
More file actions
78 lines (63 loc) · 2.36 KB
/
FMain.cs
File metadata and controls
78 lines (63 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Ghostscript.NET;
using Ghostscript.NET.Viewer;
using Ghostscript.NET.Interpreter;
namespace Ghostscript.NET.DisplayTest
{
public partial class FMain : Form
{
private GhostscriptViewer _viewer;
private FPreview _preview = new FPreview();
private StdIOHandler _stdioHandler;
public FMain()
{
InitializeComponent();
_stdioHandler = new StdIOHandler(txtOutput);
}
private void FMain_Load(object sender, EventArgs e)
{
txtOutput.AppendText("Is64BitOperatingSystem: " + System.Environment.Is64BitOperatingSystem.ToString() + "\r\n");
txtOutput.AppendText("Is64BitProcess: " + System.Environment.Is64BitProcess.ToString() + "\r\n");
_preview.Show();
this.Show();
GhostscriptVersionInfo gvi = GhostscriptVersionInfo.GetLastInstalledVersion();
_viewer = new GhostscriptViewer();
_viewer.AttachStdIO(_stdioHandler);
_viewer.DisplaySize += new GhostscriptViewerViewEventHandler(_viewer_DisplaySize);
_viewer.DisplayUpdate += new GhostscriptViewerViewEventHandler(_viewer_DisplayUpdate);
_viewer.DisplayPage += new GhostscriptViewerViewEventHandler(_viewer_DisplayPage);
_viewer.Open(gvi, true);
}
void _viewer_DisplayPage(object sender, GhostscriptViewerViewEventArgs e)
{
_preview.pbDisplay.Invalidate();
_preview.pbDisplay.Update();
}
void _viewer_DisplayUpdate(object sender, GhostscriptViewerViewEventArgs e)
{
_preview.pbDisplay.Invalidate();
_preview.pbDisplay.Update();
}
void _viewer_DisplaySize(object sender, GhostscriptViewerViewEventArgs e)
{
_preview.pbDisplay.Image = e.Image;
}
private void btnRun_Click(object sender, EventArgs e)
{
_viewer.Interpreter.Run(txtPostscript.Text);
_preview.Activate();
}
private void FMain_FormClosed(object sender, FormClosedEventArgs e)
{
_viewer.Dispose();
_viewer = null;
}
}
}