Here's the scenario: I am coding a program that will display data from a database in a variety of fields. Some of the fields need to be read-only. Should have been simple just to set all those controls to read-only, except some of them are checkboxes, radio buttons and date pickers, which do not support a read-only setting. I could mark them disabled, but that changes the color on the controls, and overriding the colors is more complicated than I want to do. So the solution that I'm trying to implement is to cause an empty label (or other control) to be transparent, so it can sit on top of the read-only controls and prevent interaction. I found the following article (http://msdn.microsoft.com/en-us/library/wk5b13s4.aspx) which says you can do this with just two lines in the control's constructor:
SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.BackColor = Color.Transparent;
Seems simple enough, but I don't know where to put this. I haven't messed with constructors in C#.NET, and when I did them in C++ it was quite some time ago (and not visual). My Google searches so far have yielded only info about custom class constructors, not modifying a control. Any help here would be great. I'm hoping it will just be a quick "the constructors are here" kind of answer. If you've tried this and know that what I'm trying to accomplish won't work, that's OK too (I have a couple "plan B" options, I just don't like them). I'm also totally open to completely different methods of making the controls read-only, if you have any.
I'm pretty new to C# and this is my first post here, so please be nice. :)