ImageKit.NET3: Frequently Asked Questions
Below are a few of the most frequently asked questions by users of the ImageKit.NET3. Click on the question number to jump to the answer.
No. | Question | Date |
Answer | ||
19 | Q. Without using Annotations, how can I draw text or shapes to the ImageKit control and to the image itself? | N/A |
Please refer to the following coding example: In VB.NET: In C#: 2. To draw text to the image In VB.NET: In C#: (* To draw something other than text, instead of using DrawString, replace that with one of the .NET Framework standard System.Drawing.Graphic class Draw*** methods.) |
||
18 | Q. Can I use an old ImageKit.NET2 project and just change the references from ImageKit.NET2 assemblies to ImageKit.NET3 assemblies then build the project? | N/A |
Yes, in most cases this is all that you will need to do. We have made every attempt to maintain backward compatibility with the older ImageKit.NET2. However, this is not true in every case, so you may need to make some coding changes. You will also need to check the information in the licenses.licx file. For an explanation of some of the differences, please refer to the "Differences from ImageKit.NET2" page in the help documentation. |
||
17 | Q. I am getting an error stating that my license isn't valid. I have logged onto my User Account, which has Administrator permissions, and I checked the ImageKit.NET3 activation tool which states that my license is activated. However, when I place an ImageKit control on my form in design time, there is an error telling me to confirm my license. | N/A |
In the ImageKit.NET3, both the license activation and the product installation write certain values into the registry. The problem occurs because a usual User Account, even with Administrator permissions, cannot write this information into the registry. To resolve this problem, you need to install the ImageKit.NET3 using the "Run As Administrator" option. Specifically, right click the setup.exe and choose "Run As Administrator" or, if you are running the ImageKitNet3.msi, then run it from the command line using the "Run As Administrator" option: msiexec /i ImageKitNET3.msi (* Your developer environment also needs to be running under administrator permissions) |
||
16 | Q. I cannot run the ImageKit.NET3 samples on my 64 bit operating system. I get an error!!! | N/A |
All ImageKit.NET3 sample projects are built using .NET Framework 2.0 using Visual Studio 2005. |
||
15 | Q. When the ImageKit Control on my form has focus, the form's KeyDown and KeyPress events do not fire. What can I do? | N/A |
A. This issue is not confined to the ImageKit Control. Other controls like Button Controls have a similar issue. In order to resolve the problem set the Form's KeyPreview property to True. Now even when a control has focus, the Form's KeyDown and KeyPress events will fire. However, the above will not work for the arrow, tab, page up, or page down keys. In order to get these keys to generate KeyDown and KeyPress events you will need to override the Form Class ProcessDialogKey method and add some code. Below is an example that displays a messagebox when the left arrow and tab keys are pressed. VB.NET: <System.Security.Permissions.UIPermission( _ System.Security.Permissions.SecurityAction.LinkDemand, _ Window:=System.Security.Permissions.UIPermissionWindow.AllWindows)> _ Protected Overrides Function ProcessDialogKey( ByVal keyData As Keys) As Boolean 'Check to see if the left arrow key is pressed If (keyData And Keys.KeyCode) = Keys.Left Then MessageBox.Show("Left Arrow Key Is Pressed") Return True 'Check to see if the Tab key is pressed ElseIf (keyData And Keys.KeyCode) = Keys.Tab Then MessageBox.Show("Tab Key Is Pressed") Return True End If Return MyBase.ProcessDialogKey(keyData) End Function C# : [System.Security.Permissions.UIPermission( System.Security.Permissions.SecurityAction.LinkDemand, Window = System.Security.Permissions.UIPermissionWindow.AllWindows)] protected override bool ProcessDialogKey(Keys keyData) { //Check to see if the left arrow key is pressed if ((keyData & Keys.KeyCode) == Keys.Left) { MessageBox.Show("Left Arrow Key Is Pressed"); return true; } //Check to see if the Tab key is pressed else if ((keyData & Keys.KeyCode) == Keys.Tab) { MessageBox.Show("Tab Key Is Pressed"); return true; } return base.ProcessDialogKey(keyData); } |
||
14 | Q. Why do I get an error on my 64 bit OS when I set Visual Studio's solution platform to (x64) and build my application? | N/A |
A. The error is related to the .NET Framework License Compiler (LC.exe). The ImageKit.NET3 assemblies work in both the 32bit and 64 bit environments but you must use the 32bit version of LC.exe. If you build your application with the 64bit LC.exe, you'll get a license compiler error. The 64bit LC.exe is used under the following conditions: your machine is a 64bit operating system; your development environment has .NET Framework 4.5 installed; you are using Visual Studio 2010 or 2012; and your building your application with a target platform of (x64). When all of these conditions are met, the 64bit version LC.exe will be used by default. To change this and use the 32bit LC.exe, you will need to open your .csproj file or your .vbproj file and under the <project group> headings, add the <DisableOutOfProcTaskHost> tag with a value of 1, which means "use the 32bit LC.exe". i.e. <PropertyGroup> <DisableOutOfProcTaskHost>1</DisableOutOfProcTaskHost> |
||
13 | Q. Is it possible to use code to retrieve information about an annotation object and to edit that annotation object? I can right click on an annotation object and select properties to bring up the dialog box with that information but I would like to do this with code. Is that possible? | N/A |
A. Yes, this is possible. It is possible to retrieve information about an annotation object by selecting that object and checking the appropriate ImageKit.Edit.SelectedObject*** properties. The object can be edited by using these properties. The following code example shows you how to select an object, retrieve its information, then change the object properties: VB.NET: For i As Integer = 1 To imageKit1.Edit.NumberOfObjects imageKit1.Edit.SelectObject(i) If imageKit1.Edit.SelectedObjectKind = Newtone.ImageKit.Win.KindOfEdit.Line Then imageKit1.Edit.SelectedObjectForeColor = Color.Blue End If imageKit1.Edit.DeselectObjects() Next C#: for (int i = 1; i < = imageKit1.Edit.NumberOfObjects; i++) { imageKit1.Edit.SelectObject(i); if (imageKit1.Edit.SelectedObjectKind == KindOfEdit.Line) imageKit1.Edit.SelectedObjectForeColor = Color.Blue; imageKit1.Edit.DeselectObjects(); } |
||
12 | Q. When I try to run an application containing the ImageKit.NET3 on
an environment that is not connected to the internet, it can take a long time
for the application to start up. Why? Is there anything I can do about it? |
N/A |
A. The ImageKit.NET3 assemblies are digitally signed. To validate an application using a digitally signed assembly, a PC may try to download the CRL (certificate revocation list). If the PC is not connected to the internet, the application will not start up until after the attempt to download the CRL has timed out. To avoid this problem you can set the PC (that is not connected to the internet)
so that it will not download the CRL in the following way: Another way to avoid this problem for PCs (that are not connected to the internet) and have .NET Framework 2.0 Service Pack 1 or above, you can set the following in the application's exe.config:
<configuration> The ImageKit.NET3 ships with unsigned dll assemblies. Use these unsigned assemblies when running in an environment that is not connected to the internet. |
||
11 | Q. How do I convert an image's height or width from pixels to inches or centimeters | N/A |
A. Please refer to the following example. When using an image set in the Image property: In VB.NET: In C#: |
||
10 | Q. Can an application that uses TWAIN run on a 64 bit OS? | N/A |
A. Yes, if the application is built with a target platform of (x64) or
(Any CPU) and a 64 bit Twain scan driver is being used. |
||
9 | Q. When I run my program in Visual Studio in debug mode, the ImageKit.NET Effect or Scan functions are much much slower than they are when running the EXE outside of Visual Studio. What can I do to make my program run faster when I am debugging? | N/A |
A. You will need to disable your Managed Debug Assistant (MDA). For details,
please refer to: |
||
8 | Q. How do I create a mirror image or flip an image? | N/A |
A. Use the Effect interface's Rotate method and set the angle parameter to 0.
To create a mirror image, set the TurnX parameter to True. To flip the image,
set the TurnY parameter to True. |
||
7 | Q. In a new project, I placed the controls on the form but when I build the project, I get an error!! | N/A |
A. In your project, please make sure that all of the necessary ImageKit.NET3 assemblies are properly referenced. Listed below is the control name and the assemblies that must be referenced. WinForm WebForm The ImageKit.NET3 assemblies can be found under the directory where you installed
the ImageKit.NET3 in the folder called "System" |
||
6 | Q. How do I change the resolution property value of a raster image? | N/A |
A. The following code will change the resolution property value of
the image set in the Image property to 300 dpi In VB.NET: Dim bmp As System.Drawing.Bitmap = ImageKit1.Image bmp.SetResolution(300, 300) ImageKit1.Image = bmp bmp.Dispose() In C#: System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)imageKit1.Image; bmp.SetResolution(300, 300); imageKit1.Image = bmp; bmp.Dispose(); The above code will merely set the value in the resolution property of the image. In order to actually save the image at the new resolution value you will need to do this.... In VB.NET: Dim bmp As New System.Drawing.Bitmap(ImageKit1.Image.Width, ImageKit1.Image.Height) bmp.SetResolution(300, 300) Dim g As System.Drawing.Graphics = Graphics.FromImage(bmp) g.DrawImage(imageKit1.Image, 0, 0, ImageKit1.Image.Width, ImageKit1.Image.Height) g.Dispose() ImageKit1.Image = bmp ImageKit1.File.FileName = ・・・ ImageKit1.File.SaveImageToFile(SaveFileType....., Nothing) bmp.Dispose() In C#: System.Drawing.Bitmap bmp = new Bitmap(imageKit1.Image.Width, imageKit1.Image.Height); bmp.SetResolution(300, 300); Graphics g = System.Drawing.Graphics.FromImage(bmp); g.DrawImage(imageKit1.Image, 0, 0, imageKit1.Image.Width, imageKit1.Image.Height); g.Dispose(); imageKit1.Image = bmp imageKit1.File.FileName = ・・・; imageKit1.File.SaveImageToFile(SaveFileType....., null); bmp.Dispose(); |
||
5 | Q. How do I create a multipage tiff image using the ImageKit.NET3? | N/A |
A. Please refer to the following examples: 1. To save images retrieved from scanners or digital cameras... In VB.NET: Dim Ret As Boolean ImageKit1.File.FileName = "abc.tif" ImageKit1.Scan.Transfer = Newtone.ImageKit.ScanTransfer.Memory 'or Newtone.ImageKit.ScanTransfer.Native Ret = ImageKit1.Scan.Execute() 'execute the scan 'In the AfterScan event: Private Sub ImageKit1_AfterScan(ByVal sender As Object, ByVal e As Newtone.ImageKit.AfterScanEventArgs) Handles ImageKit1.AfterScan 'This will append each scanned image to the end of the tiff file ImageKit1.File.AppendTiffImage(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, e.Bitmap1) 'To insert the scanned image as the third page... ImageKit1.File.InsertPageIntoMultipageTiff (Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, e.Bitmap1, 3) End Sub In C#: bool Ret; imageKit1.File.FileName = "abc.tif"; imageKit1.Scan.Transfer = Newtone.ImageKit.ScanTransfer.Memory //or Newtone.ImageKit.ScanTransfer.Native Ret = imageKit1.Scan.Execute(); //execute the scan //In the AfterScan event: private void imageKit1_AfterScan(object sender, Newtone.ImageKit.AfterScanEventArgs e) { 'this will append the scanned image to the end of the tiff file imageKit1.File.AppendTiffImage(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, e.Bitmap1); 'this will insert the scanned image as the third page... imageKit1.File.InsertPageIntoMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, e.Bitmap1, 3); } 2. To save mulitple image files into one multipage file... In VB.NET: Dim I As Integer ImageKit2.File.FileName = "abc.tif" ImageKit1.LayerNumber = -1 ImageKit1.File.LoadPage = 0 'load and save images 001.jpg ... 005.jpg into one file For I = 1 To 5 ImageKit1.File.FileName = I.ToString("d03") + ".jpg" 'set the file name ImageKit1.File.LoadImageFromFile(Newtone.ImageKit.LoadFileType.Load) ImageKit2.File.AppendTiffImage(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, e.Bitmap1) Next I In C#: int i; imageKit2.File.FileName = "abc.tif"; imageKit1.LayerNumber = -1; imageKit1.File.LoadPage = 0; //load and save images 001.jpg ... 005.jpg into one file for (i = 1; i < = 5; i++) { imageKit1.File.FileName = i.ToString("d03") + ".jpg"; //set the file name imageKit1.File.LoadImageFromFile(Newtone.ImageKit.LoadFileType.Load); imageKit2.File.AppendTiffImage(Newtone.ImageKit.SaveFileType.SaveTIFFNoncompressed, e.Bitmap1); } |
||
4 | Q. How is the size of one thumbnail image in the Thumbnail control (WinForm) determined? | N/A |
A. The total display area of the Thumbnail control is divided by the
number of rows and number of columns to get size of an individual thumbnail cell
(minus border width, cell spacing, etc). The display area within this thumbnail
cell will have a width of 80% of the thumbnail cell's width and a height of 80%
of the thumbnail cell's height. The thumbnail image will be scaled to fit within
this display area and centered within the thumbnail cell. This is the maximum
size of the thumbnail image. To adjust the thumbnail image size (up to this
maximum size), use the ImageSize property. |
||
3 | Q. When I use drag and drop in the Thumbnail control (WinForm), how do I retrieve the file name of the dropped file? | N/A |
A. You can do that within the Thumbnail control's DragDrop event.
See the following C# and VB.NET code examples:
VB.NET:
Sub Thumbnail1_DragDrop(ByVal sender As Object, ByVal e As
private void thumbnail1_Private Sub Thumbnail1_DragDrop(object sender, |
||
2 | Q. I want to use effect and scan functions but not as a component. Is it possible to use the classes for these functions? | N/A |
A. Yes, of course. These functions are exposed in classes. See the ImageKit.NET3 Class Library for details. | ||
1 | Q. I have been using the ImageKit.NET3 for about 2 weeks and it stopped working! What should I do? | N/A |
A. You need to check to see if your license has been activated. For
details about license activation, please check the folder called
"Tool\Activation" under the directory where you installed the ImageKit.NET3.
Details about license activation are explained in the "activation.pdf". |