Jump to content
  • Advertisement
Sign in to follow this  
Quat

[.net] forms: control init

This topic is 3736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a custom control that needs to do some initialization work. I don't want to put it in the constructor however. Is there an Init method or OnCreate method I can override to put my init code?

Share this post


Link to post
Share on other sites
Advertisement
Perhaps the OnCreateControl method is what you're looking for? You should be able to override the method in a Control or UserControl based class.

Share this post


Link to post
Share on other sites
You can override InitLayout, but that is really for custom layout due to the container holding the control.

I would create a InitControl method with all of the stuff you want to do and then just add a InitControl() call in the constructor.

theTroll

Share this post


Link to post
Share on other sites
Do you need the control handle for the initialization to work? If yes, override OnHandleCreated. Otherwise, TheTroll's suggestion should work (OnCreateControl).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!