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. How do tell if a Forms icon is set to the default Visual Studio Icon or my own icon

How do tell if a Forms icon is set to the default Visual Studio Icon or my own icon

Scheduled Pinned Locked Moved C#
visual-studiocsharphelptutorial
6 Posts 2 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.
  • M Offline
    M Offline
    MarkB123
    wrote on last edited by
    #1

    Hi, Can anyone advise me on how to tell if a Forms icon is set to the default Visual Studio Icon or my own icon. The reason I ask is that on opening it up into a tabbed document view, I only want to put the form's icon on the generated page tab is it's my own icon, not the VS one. I have everything working except the check to see if it's the default VS one. Any help most gratefully received. Thanks.

    L 1 Reply Last reply
    0
    • M MarkB123

      Hi, Can anyone advise me on how to tell if a Forms icon is set to the default Visual Studio Icon or my own icon. The reason I ask is that on opening it up into a tabbed document view, I only want to put the form's icon on the generated page tab is it's my own icon, not the VS one. I have everything working except the check to see if it's the default VS one. Any help most gratefully received. Thanks.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      ..correct me if I'm wrong, but you'll need to access the same property to "check" it as you'll need to "set" it. Wouldn't it be more logical to simply set it? How would you call/invoke the checking method? Where, what event, and how would the signature look? There's another problem; it's hard for the computer to compare pictures. As far as it's concerned, they're just a collection of bytes. You could generate a hash-value for the default VS-icon, and compare that to the hash-value generated from the current icon. If the hashes differ, then the icons differ. Still, it'd be easier to have a single base-form, set the icon in there once, and inherit from there.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      M 1 Reply Last reply
      0
      • L Lost User

        ..correct me if I'm wrong, but you'll need to access the same property to "check" it as you'll need to "set" it. Wouldn't it be more logical to simply set it? How would you call/invoke the checking method? Where, what event, and how would the signature look? There's another problem; it's hard for the computer to compare pictures. As far as it's concerned, they're just a collection of bytes. You could generate a hash-value for the default VS-icon, and compare that to the hash-value generated from the current icon. If the hashes differ, then the icons differ. Still, it'd be easier to have a single base-form, set the icon in there once, and inherit from there.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        M Offline
        M Offline
        MarkB123
        wrote on last edited by
        #3

        Hi Eddy, thanks for the response. event as follows... private void tabbedView1_DocumentAdded(object sender,DevExpress.XtraBars.Docking2010.Views.DocumentEventArgs e) { DevExpress.XtraBars.Docking2010.Views.BaseDocument bd = (DevExpress.XtraBars.Docking2010.Views.BaseDocument)e.Document; if (bd.Form.ShowIcon && bd.Form.Icon.Size == new Size(16, 16)) // Default VS icon is 32x32 // { e.Document.Image = bd.Form.Icon.ToBitmap(); } } I'm checking the size at the moment to get round the issue as the VS one is 32x32 and any icon I might set on one of my forms is currently 16x16. I can't really go through all my forms too easily to check if I forgot to turn off the VS icon as I have over 400 forms in my project (it's pretty large)... I only have a handful of forms at the moment where I might set my own icon to make them stand out. It would just be a bit cleaner if I was able to do something like bd.Form.Icon != default.icon etc...

        L 1 Reply Last reply
        0
        • M MarkB123

          Hi Eddy, thanks for the response. event as follows... private void tabbedView1_DocumentAdded(object sender,DevExpress.XtraBars.Docking2010.Views.DocumentEventArgs e) { DevExpress.XtraBars.Docking2010.Views.BaseDocument bd = (DevExpress.XtraBars.Docking2010.Views.BaseDocument)e.Document; if (bd.Form.ShowIcon && bd.Form.Icon.Size == new Size(16, 16)) // Default VS icon is 32x32 // { e.Document.Image = bd.Form.Icon.ToBitmap(); } } I'm checking the size at the moment to get round the issue as the VS one is 32x32 and any icon I might set on one of my forms is currently 16x16. I can't really go through all my forms too easily to check if I forgot to turn off the VS icon as I have over 400 forms in my project (it's pretty large)... I only have a handful of forms at the moment where I might set my own icon to make them stand out. It would just be a bit cleaner if I was able to do something like bd.Form.Icon != default.icon etc...

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          MarkB123 wrote:

          It would just be a bit cleaner if I was able to do something like bd.Form.Icon != default.icon etc...

          Start here[^] :)

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

          M 1 Reply Last reply
          0
          • L Lost User

            MarkB123 wrote:

            It would just be a bit cleaner if I was able to do something like bd.Form.Icon != default.icon etc...

            Start here[^] :)

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

            M Offline
            M Offline
            MarkB123
            wrote on last edited by
            #5

            Thanks Eddy, I'll give this a go :)

            L 1 Reply Last reply
            0
            • M MarkB123

              Thanks Eddy, I'll give this a go :)

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              You're welcome :)

              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