Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Default file image

Default file image

Scheduled Pinned Locked Moved C#
design
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gwithey
    wrote on last edited by
    #1

    Does anyone know if there is a way of getting the default image of a file to show in a file browser. ie .txt image will be notepad etc. Is there a way of finding this from "System.io.DirectoryInfo" or is there some other way i could retrieve this name. I can then display the correct type of image for the file in my browser )

    UI.Entry(Image.FromFile("FolderFull_125x125.png"

    Thanx George

    F I H 3 Replies Last reply
    0
    • G gwithey

      Does anyone know if there is a way of getting the default image of a file to show in a file browser. ie .txt image will be notepad etc. Is there a way of finding this from "System.io.DirectoryInfo" or is there some other way i could retrieve this name. I can then display the correct type of image for the file in my browser )

      UI.Entry(Image.FromFile("FolderFull_125x125.png"

      Thanx George

      I Offline
      I Offline
      Ian Shlasko
      wrote on last edited by
      #2

      First google link: Get Registered File Types and Their Associated Icons in C#[^]

      Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

      1 Reply Last reply
      0
      • G gwithey

        Does anyone know if there is a way of getting the default image of a file to show in a file browser. ie .txt image will be notepad etc. Is there a way of finding this from "System.io.DirectoryInfo" or is there some other way i could retrieve this name. I can then display the correct type of image for the file in my browser )

        UI.Entry(Image.FromFile("FolderFull_125x125.png"

        Thanx George

        F Offline
        F Offline
        freakyit
        wrote on last edited by
        #3

        hi, try to extract the icon from the file with

        System.Drawing.Icon.ExtractAssociatedIcon("log.txt").ToBitmap()

        you can save the image to file with bitmap.Save("log.txt.png").. hope i could help :)

        L G 2 Replies Last reply
        0
        • F freakyit

          hi, try to extract the icon from the file with

          System.Drawing.Icon.ExtractAssociatedIcon("log.txt").ToBitmap()

          you can save the image to file with bitmap.Save("log.txt.png").. hope i could help :)

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          I don't think so, the OP wants the icon associated with a file, not an icon from within the file. :)

          Luc Pattyn


          I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


          Local announcement (Antwerp region): Lange Wapper? Neen!


          1 Reply Last reply
          0
          • F freakyit

            hi, try to extract the icon from the file with

            System.Drawing.Icon.ExtractAssociatedIcon("log.txt").ToBitmap()

            you can save the image to file with bitmap.Save("log.txt.png").. hope i could help :)

            G Offline
            G Offline
            gwithey
            wrote on last edited by
            #5

            bm = System.Drawing.Icon.ExtractAssociatedIcon("@C:\WINDOWS\system32\notepad.exe").ToBitmap();

            This line does get the correct image thank you just dont know how to find all the others as the focused file is changed.

            1 Reply Last reply
            0
            • G gwithey

              Does anyone know if there is a way of getting the default image of a file to show in a file browser. ie .txt image will be notepad etc. Is there a way of finding this from "System.io.DirectoryInfo" or is there some other way i could retrieve this name. I can then display the correct type of image for the file in my browser )

              UI.Entry(Image.FromFile("FolderFull_125x125.png"

              Thanx George

              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #6

              http://www.codeproject.com/KB/cs/GetFileTypeAndIcon.aspx[^]

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups