Skip to main content

Posts

Showing posts from September, 2017

Subscribe to Form.Show?

If you are trying to execute code when  Form.Show() is called, subscribing to Form.Shown() does not work. This is because Form.Shown() only gets executed once on the initial show. Instead you must subscribe to Form.VisibleChanged() 1 2 3 4 5 6 7 private void Form_VisibleChanged( object sender, EventArgs e) { if ( this .Visible) { //your code here } } You also cannot use Form_Load, or Form_Activated, as load does not occur on .Show, and activate occurs too many times.

Replacing SystemColors with Hex value

If you're in a similar situation as me, using SystemColors is not an option, and you would rather use the real hex values. The following is a chart of all of the colors and their respective hex value: #FFB4B4B4 : ActiveBorderColor #FF99B4D1 : ActiveCaptionColor #FF000000 : ActiveCaptionTextColor #FFABABAB : AppWorkspaceColor #FFF0F0F0 : ControlColor #FFA0A0A0 : ControlDarkColor #FF696969 : ControlDarkDarkColor #FFE3E3E3 : ControlLightColor #FFFFFFFF : ControlLightLightColor #FF000000 : ControlTextColor #FF000000 : DesktopColor #FFB9D1EA : GradientActiveCaptionColor #FFD7E4F2 : GradientInactiveCaptionColor #FF6D6D6D : GrayTextColor #FF3399FF : HighlightColor #FFFFFFFF : H...