- Local time
- 12:14 AM
- Messages
- 374
Following is a very simple program, extracted from my 'real' program. that demonstrates the problem. (For those interested, the jpg file is of dimension 200x200 - any jpg will work.) When I run the program within Visual Studio it works just fine. However, when I run the program stand-alone, I get an InteropServices.ExternalException error. I have searched on this and have tried a variety of things, but I keep getting the error.
Here is the 'entire' program:
Please modify this program such that it works as stand-alone. Many thanks.
Here is the 'entire' program:
Code:
Imports System.Drawing.Imaging
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim imgLI As Image
imgLI = New Bitmap(Image.FromFile("C:\Users\Gerry\Desktop\SmileFace.jpg"), 150, 150)
Dim bmp As New Bitmap(250, 250)
Using bmp
Dim gr As Graphics = Graphics.FromImage(bmp)
gr.Clear(Color.WhiteSmoke)
gr.DrawImage(imgLI, 25, 25)
bmp.Save("C:\Users\Gerry\Desktop\foobar.jpg", ImageFormat.Jpeg)
gr.Dispose() ' this line before or after the above does not matter
End Using
Application.Exit()
End Sub
End Class
My Computer
- Computer type
- PC/Desktop
- OS
- Windows 7 x64 Pro
- CPU
- Core i7 860 @ 3.8 GHz
- Motherboard
- MSI P55-GD80
- Memory
- 16 GB F3-12800CL7D (DDR3 1600 7-7-7-24)
- Graphics Card(s)
- Sapphire Vapor-X 100283VXL Radeon HD 5770
- Monitor(s) Displays
- NEC LCD3090WQXi-BK