I have been going round and round in circles all afternoon...
-
...all I want to do is create a base class form, and derive a bunch of others from it - the idea being to have a base which has the "general layout" and a bunch of buttons that will be on all forms. And the first problem is that you can't use a static ImageList for all the buttons. And an Imagelist is the only way to use my .ICO file as button images. After going round that for a while (including a perfect looking article here: Sharing and inheriting ImageLists across multiple forms and controls[^] which sounds perfect but doesn't work with VS2019 and I'd had enough of trying by then) I relent and find an online resource that extracts PNG images form Icons. Except they are all too big at 256x256 and the ICO files don't have the right 64x64 images, just 256x256 and 48x48 and smaller. :sigh: OK ... Corel Paintshop Pro has a batch mode ... finally get that working, import the PNG files, apply, presto! Base form is working. Derive a new form. try to view it in the designer ... "Object reference not set to an instance". Find the reason, add the necessary "if design mode", try again. "System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType" :doh: Finally fix it: change the derived form type to "Form", build, view in the designer. Hurrah! No error (or buttons but hey!). Change it back to Base Form. Build. View in the designer. And it works. Sodding Visual Studio. And it's only Tuesday. I am sooooo glad I didn't make the base form abstract ... I'll do that when its' all working. Deriving a concrete class from an abstract UserControl[^] applies to Forms as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
Not meaning to pick nits, but doesn't 'going round and round' imply circles :-O :laugh:
Thar's only two possibilities: Thar is life out there in the universe which is smarter than we are, or we're the most intelligent life in the universe. Either way, it's a mighty sobering thought. (Porkypine - via Walt Kelly)
-
...all I want to do is create a base class form, and derive a bunch of others from it - the idea being to have a base which has the "general layout" and a bunch of buttons that will be on all forms. And the first problem is that you can't use a static ImageList for all the buttons. And an Imagelist is the only way to use my .ICO file as button images. After going round that for a while (including a perfect looking article here: Sharing and inheriting ImageLists across multiple forms and controls[^] which sounds perfect but doesn't work with VS2019 and I'd had enough of trying by then) I relent and find an online resource that extracts PNG images form Icons. Except they are all too big at 256x256 and the ICO files don't have the right 64x64 images, just 256x256 and 48x48 and smaller. :sigh: OK ... Corel Paintshop Pro has a batch mode ... finally get that working, import the PNG files, apply, presto! Base form is working. Derive a new form. try to view it in the designer ... "Object reference not set to an instance". Find the reason, add the necessary "if design mode", try again. "System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType" :doh: Finally fix it: change the derived form type to "Form", build, view in the designer. Hurrah! No error (or buttons but hey!). Change it back to Base Form. Build. View in the designer. And it works. Sodding Visual Studio. And it's only Tuesday. I am sooooo glad I didn't make the base form abstract ... I'll do that when its' all working. Deriving a concrete class from an abstract UserControl[^] applies to Forms as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
May I recommend Axialis Icon Workshop. It can convert icons to all of the different graphics formats in all of the different sizes. I have no connection to the company.
The difficult we do right away... ...the impossible takes slightly longer.
-
...all I want to do is create a base class form, and derive a bunch of others from it - the idea being to have a base which has the "general layout" and a bunch of buttons that will be on all forms. And the first problem is that you can't use a static ImageList for all the buttons. And an Imagelist is the only way to use my .ICO file as button images. After going round that for a while (including a perfect looking article here: Sharing and inheriting ImageLists across multiple forms and controls[^] which sounds perfect but doesn't work with VS2019 and I'd had enough of trying by then) I relent and find an online resource that extracts PNG images form Icons. Except they are all too big at 256x256 and the ICO files don't have the right 64x64 images, just 256x256 and 48x48 and smaller. :sigh: OK ... Corel Paintshop Pro has a batch mode ... finally get that working, import the PNG files, apply, presto! Base form is working. Derive a new form. try to view it in the designer ... "Object reference not set to an instance". Find the reason, add the necessary "if design mode", try again. "System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType" :doh: Finally fix it: change the derived form type to "Form", build, view in the designer. Hurrah! No error (or buttons but hey!). Change it back to Base Form. Build. View in the designer. And it works. Sodding Visual Studio. And it's only Tuesday. I am sooooo glad I didn't make the base form abstract ... I'll do that when its' all working. Deriving a concrete class from an abstract UserControl[^] applies to Forms as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
Some fitting music: Sugababes - Round Round - YouTube[^] :-\
-
...all I want to do is create a base class form, and derive a bunch of others from it - the idea being to have a base which has the "general layout" and a bunch of buttons that will be on all forms. And the first problem is that you can't use a static ImageList for all the buttons. And an Imagelist is the only way to use my .ICO file as button images. After going round that for a while (including a perfect looking article here: Sharing and inheriting ImageLists across multiple forms and controls[^] which sounds perfect but doesn't work with VS2019 and I'd had enough of trying by then) I relent and find an online resource that extracts PNG images form Icons. Except they are all too big at 256x256 and the ICO files don't have the right 64x64 images, just 256x256 and 48x48 and smaller. :sigh: OK ... Corel Paintshop Pro has a batch mode ... finally get that working, import the PNG files, apply, presto! Base form is working. Derive a new form. try to view it in the designer ... "Object reference not set to an instance". Find the reason, add the necessary "if design mode", try again. "System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType" :doh: Finally fix it: change the derived form type to "Form", build, view in the designer. Hurrah! No error (or buttons but hey!). Change it back to Base Form. Build. View in the designer. And it works. Sodding Visual Studio. And it's only Tuesday. I am sooooo glad I didn't make the base form abstract ... I'll do that when its' all working. Deriving a concrete class from an abstract UserControl[^] applies to Forms as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
More fitting music, RATT - Round And Round[^]. :)
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
-
...all I want to do is create a base class form, and derive a bunch of others from it - the idea being to have a base which has the "general layout" and a bunch of buttons that will be on all forms. And the first problem is that you can't use a static ImageList for all the buttons. And an Imagelist is the only way to use my .ICO file as button images. After going round that for a while (including a perfect looking article here: Sharing and inheriting ImageLists across multiple forms and controls[^] which sounds perfect but doesn't work with VS2019 and I'd had enough of trying by then) I relent and find an online resource that extracts PNG images form Icons. Except they are all too big at 256x256 and the ICO files don't have the right 64x64 images, just 256x256 and 48x48 and smaller. :sigh: OK ... Corel Paintshop Pro has a batch mode ... finally get that working, import the PNG files, apply, presto! Base form is working. Derive a new form. try to view it in the designer ... "Object reference not set to an instance". Find the reason, add the necessary "if design mode", try again. "System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType" :doh: Finally fix it: change the derived form type to "Form", build, view in the designer. Hurrah! No error (or buttons but hey!). Change it back to Base Form. Build. View in the designer. And it works. Sodding Visual Studio. And it's only Tuesday. I am sooooo glad I didn't make the base form abstract ... I'll do that when its' all working. Deriving a concrete class from an abstract UserControl[^] applies to Forms as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
OriginalGriff wrote:
extracts PNG images form Icons
... or just use Paint, Resize, SaveAs .png
All 93 of them ... I did consider it, but I wanted an "automated" solution to prevent RSI :laugh:
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
...all I want to do is create a base class form, and derive a bunch of others from it - the idea being to have a base which has the "general layout" and a bunch of buttons that will be on all forms. And the first problem is that you can't use a static ImageList for all the buttons. And an Imagelist is the only way to use my .ICO file as button images. After going round that for a while (including a perfect looking article here: Sharing and inheriting ImageLists across multiple forms and controls[^] which sounds perfect but doesn't work with VS2019 and I'd had enough of trying by then) I relent and find an online resource that extracts PNG images form Icons. Except they are all too big at 256x256 and the ICO files don't have the right 64x64 images, just 256x256 and 48x48 and smaller. :sigh: OK ... Corel Paintshop Pro has a batch mode ... finally get that working, import the PNG files, apply, presto! Base form is working. Derive a new form. try to view it in the designer ... "Object reference not set to an instance". Find the reason, add the necessary "if design mode", try again. "System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType" :doh: Finally fix it: change the derived form type to "Form", build, view in the designer. Hurrah! No error (or buttons but hey!). Change it back to Base Form. Build. View in the designer. And it works. Sodding Visual Studio. And it's only Tuesday. I am sooooo glad I didn't make the base form abstract ... I'll do that when its' all working. Deriving a concrete class from an abstract UserControl[^] applies to Forms as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
Too much time to waste in images/icons! :laugh:
-
Not meaning to pick nits, but doesn't 'going round and round' imply circles :-O :laugh:
Thar's only two possibilities: Thar is life out there in the universe which is smarter than we are, or we're the most intelligent life in the universe. Either way, it's a mighty sobering thought. (Porkypine - via Walt Kelly)
Not meaning to nit pick, but the Earth goes round and round in an elliptical orbit ;P
// TODO: Insert something here
Top ten reasons why I'm lazy 1.
-
...all I want to do is create a base class form, and derive a bunch of others from it - the idea being to have a base which has the "general layout" and a bunch of buttons that will be on all forms. And the first problem is that you can't use a static ImageList for all the buttons. And an Imagelist is the only way to use my .ICO file as button images. After going round that for a while (including a perfect looking article here: Sharing and inheriting ImageLists across multiple forms and controls[^] which sounds perfect but doesn't work with VS2019 and I'd had enough of trying by then) I relent and find an online resource that extracts PNG images form Icons. Except they are all too big at 256x256 and the ICO files don't have the right 64x64 images, just 256x256 and 48x48 and smaller. :sigh: OK ... Corel Paintshop Pro has a batch mode ... finally get that working, import the PNG files, apply, presto! Base form is working. Derive a new form. try to view it in the designer ... "Object reference not set to an instance". Find the reason, add the necessary "if design mode", try again. "System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType" :doh: Finally fix it: change the derived form type to "Form", build, view in the designer. Hurrah! No error (or buttons but hey!). Change it back to Base Form. Build. View in the designer. And it works. Sodding Visual Studio. And it's only Tuesday. I am sooooo glad I didn't make the base form abstract ... I'll do that when its' all working. Deriving a concrete class from an abstract UserControl[^] applies to Forms as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
What framework version are you using? The .NET Core / 5 WinForms designer doesn’t work correctly with custom control designers. You’ll need to multitarget to a regular framework version (e.g. 4.8) for the designers to work.
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
All 93 of them ... I did consider it, but I wanted an "automated" solution to prevent RSI :laugh:
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
...all I want to do is create a base class form, and derive a bunch of others from it - the idea being to have a base which has the "general layout" and a bunch of buttons that will be on all forms. And the first problem is that you can't use a static ImageList for all the buttons. And an Imagelist is the only way to use my .ICO file as button images. After going round that for a while (including a perfect looking article here: Sharing and inheriting ImageLists across multiple forms and controls[^] which sounds perfect but doesn't work with VS2019 and I'd had enough of trying by then) I relent and find an online resource that extracts PNG images form Icons. Except they are all too big at 256x256 and the ICO files don't have the right 64x64 images, just 256x256 and 48x48 and smaller. :sigh: OK ... Corel Paintshop Pro has a batch mode ... finally get that working, import the PNG files, apply, presto! Base form is working. Derive a new form. try to view it in the designer ... "Object reference not set to an instance". Find the reason, add the necessary "if design mode", try again. "System.Windows.Forms.Design.IEventHandlerService already exists in the service container. Parameter name: serviceType" :doh: Finally fix it: change the derived form type to "Form", build, view in the designer. Hurrah! No error (or buttons but hey!). Change it back to Base Form. Build. View in the designer. And it works. Sodding Visual Studio. And it's only Tuesday. I am sooooo glad I didn't make the base form abstract ... I'll do that when its' all working. Deriving a concrete class from an abstract UserControl[^] applies to Forms as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
I would have done it like this: Create panels or usercontrols containing common elements. Drag those onto each form. It's not perfect, but in my experience doing what you're doing using form inheritance causes more problems than it solves. Just my take on things. *hides*
Real programmers use butterflies