mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-14 19:01:18 +08:00
175 lines
6.5 KiB
C#
175 lines
6.5 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
using System.Data;
|
|
|
|
namespace Test
|
|
{
|
|
/// <summary>
|
|
/// Summary description for Form1.
|
|
/// </summary>
|
|
public class Form1 : System.Windows.Forms.Form
|
|
{
|
|
private MenuStrip menuStrip1;
|
|
private ToolStripMenuItem fileToolStripMenuItem;
|
|
private ToolStripMenuItem openToolStripMenuItem;
|
|
private OpenFileDialog openFileDialog1;
|
|
/// <summary>
|
|
/// Required designer variable.
|
|
/// </summary>
|
|
private System.ComponentModel.Container components = null;
|
|
private AxAVSImageView5.AxImageView5 axImageView51;
|
|
|
|
private AVSVectorImage.Rasterizer m_oRasterizer = new AVSVectorImage.Rasterizer();
|
|
|
|
public Form1()
|
|
{
|
|
//
|
|
// Required for Windows Form Designer support
|
|
//
|
|
InitializeComponent();
|
|
|
|
//
|
|
// TODO: Add any constructor code after InitializeComponent call
|
|
//
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
protected override void Dispose( bool disposing )
|
|
{
|
|
if( disposing )
|
|
{
|
|
if (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()
|
|
{
|
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
|
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
|
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
|
this.axImageView51 = new AxAVSImageView5.AxImageView5();
|
|
this.menuStrip1.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.axImageView51)).BeginInit();
|
|
this.SuspendLayout();
|
|
//
|
|
// menuStrip1
|
|
//
|
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
this.fileToolStripMenuItem});
|
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
|
this.menuStrip1.Name = "menuStrip1";
|
|
this.menuStrip1.Size = new System.Drawing.Size(558, 24);
|
|
this.menuStrip1.TabIndex = 0;
|
|
this.menuStrip1.Text = "menuStrip1";
|
|
//
|
|
// fileToolStripMenuItem
|
|
//
|
|
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
this.openToolStripMenuItem});
|
|
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
|
this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
|
|
this.fileToolStripMenuItem.Text = "File";
|
|
//
|
|
// openToolStripMenuItem
|
|
//
|
|
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
|
|
this.openToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
|
this.openToolStripMenuItem.Text = "Open...";
|
|
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
|
|
//
|
|
// openFileDialog1
|
|
//
|
|
this.openFileDialog1.FileName = "openFileDialog1";
|
|
//
|
|
// axImageView51
|
|
//
|
|
this.axImageView51.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
| System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.axImageView51.Enabled = true;
|
|
this.axImageView51.Location = new System.Drawing.Point(0, 27);
|
|
this.axImageView51.Name = "axImageView51";
|
|
this.axImageView51.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axImageView51.OcxState")));
|
|
this.axImageView51.Size = new System.Drawing.Size(558, 461);
|
|
this.axImageView51.TabIndex = 1;
|
|
//
|
|
// Form1
|
|
//
|
|
this.ClientSize = new System.Drawing.Size(558, 487);
|
|
this.Controls.Add(this.axImageView51);
|
|
this.Controls.Add(this.menuStrip1);
|
|
this.MainMenuStrip = this.menuStrip1;
|
|
this.Name = "Form1";
|
|
this.Text = "Form1";
|
|
this.SizeChanged += new System.EventHandler(this.OnChangeSize);
|
|
this.menuStrip1.ResumeLayout(false);
|
|
this.menuStrip1.PerformLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.axImageView51)).EndInit();
|
|
this.ResumeLayout(false);
|
|
this.PerformLayout();
|
|
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
Application.Run(new Form1());
|
|
}
|
|
|
|
private void openToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
if (openFileDialog1.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
//if (m_oRasterizer.Open(openFileDialog1.FileName))
|
|
{
|
|
object oImageResult = m_oRasterizer.Rasterize(openFileDialog1.FileName,1, -1, -1);
|
|
|
|
//m_oRasterizer.GetResult(axImageView51.Width-50, axImageView51.Height-50, out oImageResult);
|
|
|
|
axImageView51.SetAdditionalParam("CustomizeScheme", (long)1);
|
|
axImageView51.SetAdditionalParam("MediaData", oImageResult);
|
|
axImageView51.ShrinkToFit();
|
|
|
|
|
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(oImageResult);
|
|
|
|
}
|
|
}
|
|
|
|
private void OnChangeSize(object sender, EventArgs e)
|
|
{
|
|
object oImageResult = null;
|
|
|
|
// m_oRasterizer.GetResult(axImageView51.Width - 50, axImageView51.Height - 50, out oImageResult);
|
|
|
|
axImageView51.SetAdditionalParam("CustomizeScheme", (long)1);
|
|
axImageView51.SetAdditionalParam("MediaData", oImageResult);
|
|
axImageView51.ShrinkToFit();
|
|
|
|
|
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(oImageResult);
|
|
}
|
|
}
|
|
}
|