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