if you want to solve this problem in vb.net please try this following
code Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer. 'Do not modify
it using the code editor.
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As
System.Windows.Forms.OpenFileDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.SuspendLayout()
'
'PictureBox1
'
Me.PictureBox1.Location = New System.Drawing.Point(24, 24)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(120, 152)
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(216, 56)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(160, 342)
Me.ListBox1.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(32, 232)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 56)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(568, 485)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.PictureBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim btmp As New Bitmap("C:\BMP IMAGE\170N001.bmp")
btmp.Save("C:\BMP IMAGE\170N001.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
End Class
Hope things will work smooth
-- Regards
Nasrul Saiyed
(e-mail address removed)
:
You may consider PocketPC JpegLib [1] and also see article "How to save a
bitmap into jpeg file" [2]. Due to the fact that WriteBitmapIntoJpegFile
uses CString as a parameter you should write a small wrapper over DLL
with similiar function that will be received wchar * instead of CString:
bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);
and then define P/Invoke for this method in your CF.NET application.
[1]
http://www.pocketpcdn.com/articles/jpeglib.html
[2]
http://www.pocketpcdn.com/articles/savejpeg.html
Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
David wrote:
Hello.
I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to
JPG file.
How can I do this?
Thank you.