|
 |
|
ขอคำแนะนำครับ ผมจะ save ไฟล์รูปลง Desktop หรือลง ไดร์ C: D: ตอนที่บันทึกผมจะสามารถเก็บ พาสที่ผม save มาเก็บใว้ใน TextBox ยังไงครับ |
|
 |
|
|
 |
 |
|
จากโค้ด เป็นการ บันทึกรูป ไอ้ตอนบันทึกเสร็จผมอยากให้มัน เอา พาส ที่บันทึกไป เก็บใน TextBox ได้ไหมครับ
เพื่อที่ผมจะ บันทึกรูปลง DB
ปล. ผมคิดว่าผมน่าจะทำแบบนี้ แต่ถ้ามีข้อแนะนำแบบใหม่ที่ดีกว่าก็ ข้อคำแนะนำด้วยนะครับ ขอบคุณครับ
Code (C#)
//Class
public static bool SaveDIBAs( string picname, IntPtr bminfo, IntPtr pixdat ) // save
{
SaveFileDialog sd = new SaveFileDialog();
sd.FileName = picname;
sd.Title = "Save bitmap as...";
sd.Filter = "Bitmap file (*.bmp)|*.bmp|TIFF file (*.tif)|*.tif|JPEG file (*.jpg)|*.jpg|PNG file (*.png)|*.png|GIF file (*.gif)|*.gif|All files (*.*)|*.*";
sd.FilterIndex = 1;
if( sd.ShowDialog() != DialogResult.OK )
return false;
Guid clsid;
if( ! GetCodecClsid( sd.FileName, out clsid ) )
{
MessageBox.Show( "Unknown picture format for extension " + Path.GetExtension( sd.FileName ),
"Image Codec", MessageBoxButtons.OK, MessageBoxIcon.Information );
return false;
}
IntPtr img = IntPtr.Zero;
int st = GdipCreateBitmapFromGdiDib( bminfo, pixdat, ref img );
if( (st != 0) || (img == IntPtr.Zero) )
return false;
st = GdipSaveImageToFile( img, sd.FileName, ref clsid, IntPtr.Zero );
GdipDisposeImage( img );
return st == 0;
}
[DllImport("gdiplus.dll", ExactSpelling=true)]
internal static extern int GdipCreateBitmapFromGdiDib( IntPtr bminfo, IntPtr pixdat, ref IntPtr image );
[DllImport("gdiplus.dll", ExactSpelling=true, CharSet=CharSet.Unicode)]
internal static extern int GdipSaveImageToFile( IntPtr image, string filename, [In] ref Guid clsid, IntPtr encparams );
[DllImport("gdiplus.dll", ExactSpelling=true)]
internal static extern int GdipDisposeImage( IntPtr image );
Tag : Ms SQL Server 2008, Win (Windows App), C#

|
|
 |
 |
 |
 |
Date :
2013-07-18 00:08:49 |
By :
ธีระวุฒิ |
View :
903 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
-- ต่อจากด้านบน
คือ ผมสั่งเครื่อง แสกน ให้มัน แสกน แล้วพอ แสกนเสร็จผมก็ จะ เก็บลง Desktop หรือลง ไดร์ C: D: ครับ แต่ผมอยากจะเก็บลง DB ด้วย เลยอยากจะเก็บ พาส ที่เก็บรูป เอาไว้ใน TextBox เพื่อที่จะ บันทึกลง DB ครับ ขอคำแนะนำหน่อยนะครับ ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2013-07-18 00:15:17 |
By :
ธีระวุฒิ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|