Results 1 to 3 of 3

Thread: [2005] Thumbnails

  1. #1

    Thread Starter
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    [2005] Thumbnails

    Dear All,
    How to show a image from the Database as a Thumbnails.I am using this code
    to display the image from database.How to shrink the image to fit to the picturebox.
    VB Code:
    1. Private Function ShowImageandDetailsFromDB(ByVal iErrorID As Long)
    2.         Dim imagecmd As OleDbCommand = New OleDbCommand("Select Top 1 Error_Description,Error_Image from photos where Error_ID='" & iErrorID & "'", con)
    3.         Dim imagereader As OleDbDataReader
    4.         imagereader = imagecmd.ExecuteReader
    5.         imagereader.Read()
    6.         Dim b(imagereader.GetBytes(1, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte
    7.         imagereader.GetBytes(1, 0, b, 0, b.Length)
    8.         imagereader.Close()
    9.         Dim ms As New System.IO.MemoryStream(b)
    10.         picError.Image = Image.FromStream(ms) 'PicError it the Picturebox
    11.  
    12.     End Function
    I want to show the image as Thumbnail

    Dana
    Please mark you thread resolved using the Thread Tools as shown

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [2005] Thumbnails

    You could create a new bitmap at the size you need, and then draw the image onto it. This question has been asked several times before, if you would search for "create thumbnails" or something to that extent. There is even an example in the codebank if you look there.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Thumbnails

    Search the forums (vb.net and vb.net codebank) for MrPolite's threads on thumbnails. He has done allot in this area.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width