private void MainForm_Load(object sender, EventArgs e) { //***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey methods must be called to distribute the runtime*** //imagXpress1.Licensing.SetSolutionName("YourSolutionName"); //imagXpress1.Licensing.SetSolutionKey(12345,12345,12345,12345); //imagXpress1.Licensing.SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation�"); // Because in this sample the ImageX object is always located in the ImageXView // tell the ImageXView component to dispose of the ImageX object when itself is // disposed. Otherwise, we would have to dispose of the ImageX object in the Form's // Dispose method before the components.Dispose() section. imageXView1.AutoImageDispose = true; lo = new Accusoft.ImagXpressSdk.LoadOptions(); filePath = Path.GetFullPath(Application.StartupPath + "..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\Common\\Images\\CadImage.dwg"); commonDir = System.IO.Path.Combine(Application.StartupPath, @"..\..\..\..\..\..\..\..\..\..\Common\Images\"); if (System.IO.Directory.Exists(commonDir)) { System.IO.Directory.SetCurrentDirectory(commonDir); } loadButton_Click(this, new EventArgs()); }
private void mnuFileOpen_Click(object sender, System.EventArgs e) { System.String strTmp = AccusoftOpenFile(); if (strTmp.Length != 0) { try { Accusoft.ImagXpressSdk.LoadOptions lo = new Accusoft.ImagXpressSdk.LoadOptions(); lo.CameraRawEnabled = true; lo.LoadMode = Accusoft.ImagXpressSdk.LoadMode.Normal; strImageFile = strTmp; imageXView1.Image = Accusoft.ImagXpressSdk.ImageX.FromFile(imagXpress1, strImageFile, lo); // clear out the error in case there was an error from a previous operation lblError.Text = ""; } catch (Accusoft.ImagXpressSdk.ImagXpressException ex) { AccusoftError(ex, lblError); } catch (System.IO.IOException ex) { AccusoftError(ex, lblError); } } }
private void formMain_Load(object sender, System.EventArgs e) { //***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey methods must be called to distribute the runtime*** //imagXpress1.Licensing.SetSolutionName("YourSolutionName"); //imagXpress1.Licensing.SetSolutionKey(12345,12345,12345,12345); //imagXpress1.Licensing.SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation�"); // Because in this sample the ImageX object is always located in the ImageXView // tell the ImageXView component to dispose of the ImageX object when itself is // disposed. Otherwise, we would have to dispose of the ImageX object in the Form's // Dispose method before the components.Dispose() section. imageXView1.AutoImageDispose = true; //Create a new load options object so we can recieve events from the images we load loLoadOptions = new Accusoft.ImagXpressSdk.LoadOptions(); //here we set the current directory and image so that the file open dialog box works well String strCurrentDir = System.IO.Path.Combine(Application.StartupPath, @"..\..\..\..\..\..\..\..\..\..\Common\Images\"); if (System.IO.Directory.Exists(strCurrentDir)) { System.IO.Directory.SetCurrentDirectory(strCurrentDir); } strCurrentDir = System.IO.Directory.GetCurrentDirectory(); strCurrentImage = System.IO.Path.Combine(strCurrentDir, "window.jpg"); if (System.IO.File.Exists(strCurrentImage)) { try { imageXView1.Image = Accusoft.ImagXpressSdk.ImageX.FromFile(imagXpress1, strCurrentImage, loLoadOptions); } catch (Accusoft.ImagXpressSdk.ImagXpressException eX) { AccusoftError(eX, labelError); } } isDrawingWithPen = false; LastDrawPoint = new System.Drawing.Point(); }
private void frmMain_Load(object sender, System.EventArgs e) { //***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey methods must be called to distribute the runtime*** //imagXpress1.Licensing.SetSolutionName("YourSolutionName"); //imagXpress1.Licensing.SetSolutionKey(12345,12345,12345,12345); //imagXpress1.Licensing.SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation�"); // Because in this sample the ImageX object is always located in the ImageXView // tell the ImageXView component to dispose of the ImageX object when itself is // disposed. Otherwise, we would have to dispose of the ImageX object in the Form's // Dispose method before the components.Dispose() section. imageXView1.AutoImageDispose = true; loLoadOptions = new Accusoft.ImagXpressSdk.LoadOptions(); cmbMethod.SelectedIndex = 0; cmbSave.SelectedIndex = 0; // Set the current directory to the Common\Images directory String strCurrentDir = System.IO.Path.Combine(Application.StartupPath, @"..\..\..\..\..\..\..\..\..\..\Common\Images\"); if (System.IO.Directory.Exists(strCurrentDir)) { System.IO.Directory.SetCurrentDirectory(strCurrentDir); } strCurrentDir = System.IO.Directory.GetCurrentDirectory(); strImageFile = "pic1.bmp"; if (System.IO.File.Exists(strImageFile)) { cmdLoad_Click(sender, e); } imagXpress1.ProgressEvent += new Accusoft.ImagXpressSdk.ImagXpress.ProgressEventHandler(imagXpress1_ProgressEvent); imagXpress1.ImageStatusEvent += new Accusoft.ImagXpressSdk.ImagXpress.ImageStatusEventHandler(imagXpress1_ImageStatusEvent); }
public Form1() { InitializeComponent(); m_loadOptions = new Accusoft.ImagXpressSdk.LoadOptions(); imagXpress1.ProgressEvent += new Accusoft.ImagXpressSdk.ImagXpress.ProgressEventHandler(imagXpress1_ProgressEvent); }
// Set the current directory to the Common\Images directory private void frmMain_Load(object sender, System.EventArgs e) { //***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey methods must be called to distribute the runtime*** //imagXpress1.Licensing.SetSolutionName("YourSolutionName"); //imagXpress1.Licensing.SetSolutionKey(12345,12345,12345,12345); //imagXpress1.Licensing.SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation�"); // Because in this sample the ImageX object is always located in the ImageXView // tell the ImageXView component to dispose of the ImageX object when itself is // disposed. Otherwise, we would have to dispose of the ImageX object in the Form's // Dispose method before the components.Dispose() section. imageXView1.AutoImageDispose = true; imageXView1.AutoResize = Accusoft.ImagXpressSdk.AutoResizeType.BestFit; String strCurrentDir = System.IO.Path.Combine(Application.StartupPath, @"..\..\..\..\..\..\..\..\..\..\Common\Images\"); if (System.IO.Directory.Exists(strCurrentDir)) { System.IO.Directory.SetCurrentDirectory(strCurrentDir); } strCurrentDir = System.IO.Directory.GetCurrentDirectory(); //Create a new load options object so we can recieve events from the images we load loLoadOptions = new Accusoft.ImagXpressSdk.LoadOptions(); //here we set the current directory and image so that the file open dialog box works well strCurrentImage = System.IO.Path.Combine(strCurrentDir, "window.jpg"); //we open a default image to view if (System.IO.File.Exists(strCurrentImage)) { imageXView1.Image = Accusoft.ImagXpressSdk.ImageX.FromFile(imagXpress1, strCurrentImage, loLoadOptions); } widthStart = imageXView1.Image.ImageXData.Width; heightStart = imageXView1.Image.ImageXData.Height; scrCropLeft.Maximum = widthStart; scrCropTop.Maximum = heightStart; scrCropRight.Maximum = widthStart; scrCropBottom.Maximum = heightStart; numericUpDownResizeWidth.Value = 100; numericUpDownResizeHeight.Value = 100; chkResizeAspect.Checked = true; scrCropLeft.Value = 30; scrCropTop.Value = 30; scrCropRight.Value = 100; scrCropBottom.Value = 100; lblCropLeftVal.Text = "30"; lblCropTopVal.Text = "30"; lblCropRightVal.Text = "100"; lblCropBottomVal.Text = "100"; //Now we reset our options controls to enabled or disabled. chkCrop_CheckedChanged(sender, e); chkResize_CheckedChanged(sender, e); chkRotate_CheckedChanged(sender, e); cmbRotate.SelectedIndex = 1; }
private void Form1_Load(object sender, System.EventArgs e) { //***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey methods must be called to distribute the runtime*** //imagXpress1.Licensing.SetSolutionName("YourSolutionName"); //imagXpress1.Licensing.SetSolutionKey(12345,12345,12345,12345); //imagXpress1.Licensing.SetOEMLicenseKey("1.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation�"); // Because in this sample the ImageX object is always located in the ImageXView // tell the ImageXView component to dispose of the ImageX object when itself is // disposed. Otherwise, we would have to dispose of the ImageX object in the Form's // Dispose method before the components.Dispose() section. imageXView1.AutoImageDispose = true; int bufferSize = 16777216; byte[] outByte = new byte[bufferSize - 1]; string stringConnection = (strProvider + strDataSource); string stringSQL = "SELECT * FROM [tblImages]"; try { //Create a new load options object so we can recieve events from the images we load loLoadOptions = new Accusoft.ImagXpressSdk.LoadOptions(); } catch (Accusoft.ImagXpressSdk.ImagXpressException ex) { AccusoftError(ex, lblError); } // Note that this database does not support 64-bit so the target platform // for this project must be set to x86 strCurrentDatabase = Application.StartupPath + "..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\Common\\Images\\DatabaseInteraction.mdb"; String strCurrentDir = System.IO.Path.Combine(Application.StartupPath, @"..\..\..\..\..\..\..\..\..\..\Common\Images\"); if (System.IO.Directory.Exists(strCurrentDir)) { System.IO.Directory.SetCurrentDirectory(strCurrentDir); } strCurrentDir = System.IO.Directory.GetCurrentDirectory(); strDataSource = "Data Source=" + strCurrentDatabase; stringSQL = "SELECT * FROM [tblImages]"; imageXView1.AutoScroll = true; dbConnection = new OleDbConnection(); dbInsertCommand = new System.Data.OleDb.OleDbCommand(); dbInsertCommand.CommandText = "INSERT INTO tblImages([Image], ImageName) VALUES (?, ?)"; dbInsertCommand.Connection = dbConnection; dbInsertCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("Image", System.Data.OleDb.OleDbType.VarBinary, 0, "Image")); dbInsertCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("ImageName", System.Data.OleDb.OleDbType.VarWChar, 255, "ImageName")); dbDeleteCommand = new System.Data.OleDb.OleDbCommand(); dbUpdateCommand = new System.Data.OleDb.OleDbCommand(); dbDeleteCommand.CommandText = "DELETE FROM tblImages WHERE (ID = ?) AND (ImageName = ? OR ? IS NULL AND ImageName IS NULL)"; dbDeleteCommand.Connection = dbConnection; dbDeleteCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ID", System.Data.DataRowVersion.Original, null)); dbDeleteCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ImageName", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ImageName", System.Data.DataRowVersion.Original, null)); dbDeleteCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ImageName1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "ImageName", System.Data.DataRowVersion.Original, null)); dbConnection.ConnectionString = strProvider + strDataSource; dbConnection.Open(); System.Data.OleDb.OleDbCommand dbCommandGet = new OleDbCommand(stringSQL, dbConnection); System.Data.OleDb.OleDbDataReader dbReader = dbCommandGet.ExecuteReader(CommandBehavior.Default); int i = 0; while (dbReader.Read()) { CmbBxImages.Items.Add(dbReader["ImageName"].ToString()); if ((i == 0)) { CmbBxImages.Text = dbReader["ImageName"].ToString(); } i = (i + 1); } dbReader.Close(); dbConnection.Close(); // Load the first Image in the List GetDBImage(0, imageXView1); bFormLoadComplete = true; }