Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > บทความจากสมาชิก > VB.NET ลดขนาดรูปภาพให้ได้สัดส่วนเผื่อเป็นประโยชน์ลองใช้งานแล้ว Work



 
Clound SSD Virtual Server

VB.NET ลดขนาดรูปภาพให้ได้สัดส่วนเผื่อเป็นประโยชน์ลองใช้งานแล้ว Work

VB.NET ลดขนาดรูปภาพให้ได้สัดส่วนเผื่อเป็นประโยชน์ ลองใช้งานแล้ว work โค้ดลดขนาดรูปภาพ สามารถSave ไปยังserver ผ่านLANได้

วิธีลดขนาดไฟล์ภาพให้เล็กลง เพื่อเก็บไปยังServer ในวงแลน หรือในฟร์เดอร์ที่ต้องการ

Code (VB.NET)
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picNo.Click
        With ofDlg
            .Title = "เลือกรูปภาพ"
            .Filter = "Image File(*.jpg; *.Jpeg;)|*.jpg; *.Jpeg"
           
            .FileName = ""
            .Multiselect = False
            .FilterIndex = 0
            If .ShowDialog() = Windows.Forms.DialogResult.OK Then
                txtPicPath.Text = .FileName
                picNo.ImageLocation = txtPicPath.Text
                'btBW.Image = Image.FromFile(tmpPicFileName)
            End If
            picNo.Image = picNo.ErrorImage
        End With
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim dateString As String
        Dim dateSc As String
        Dim ReIma As String
        Dim path As String
        dateString = Format$(Now.Date, "ddMMyy")
        dateSc = Format$(Now.Hour) & (Now.Minute) & (Now.Second)
        ReIma = "Q" & dateString & dateSc
        path = "\\192.168.1.78\New folder\" & ReIma & ".jpg" 'ที่จะเก็บไฟล์รูป กรณีในวงแลน
        Dim bm As New Bitmap(txtPicPath.Text) 'ที่อยู่ Part และชื่อไฟล์ที่จะ ลดขนาด
        Dim width As Integer = 90 '-ขนาดที่ต้องการจะลด
        Dim height As Integer = (90 * bm.Height) / bm.Width  'image height
        Dim thumb As New Bitmap(width, height)
        Dim g As Graphics = Graphics.FromImage(thumb)
        g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
        g.DrawImage(bm, New Rectangle(0, 0, width, height), New Rectangle(0, 0, bm.Width, _
        bm.Height), GraphicsUnit.Pixel)
        g.Dispose()
        bm.Dispose()
        thumb.Save(path, _
       System.Drawing.Imaging.ImageFormat.Jpeg) 'can use any image format
        thumb.Dispose()
    End Sub


คลิป



Reference : http://https://www.youtube.com/watch?v=2Ey2EOlZlcE





   
Share
Bookmark.   

  By : DUL
  Article : บทความเป็นการเขียนโดยสมาชิก หากมีปัญหาเรื่องลิขสิทธิ์ กรุณาแจ้งให้ทาง webmaster ทราบด้วยครับ
  Score Rating :
  Create Date : 2017-02-08
  Download : No files
Sponsored Links
ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่