- #WINDOWS XP BACKGROUND PAINTING HOW TO#
- #WINDOWS XP BACKGROUND PAINTING CODE#
- #WINDOWS XP BACKGROUND PAINTING LICENSE#
- #WINDOWS XP BACKGROUND PAINTING WINDOWS#
#WINDOWS XP BACKGROUND PAINTING LICENSE#
This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves.
#WINDOWS XP BACKGROUND PAINTING CODE#
All implementation of button control is pulled out in a separate ButtonBase class which allows easily to reuse the code and implement your own stylish button.Changed the name of namespace from to PinkieControls.Deleted effect of slow painting of button while loading form for the first time (white rectangle in place of button).Source code and demo project downloads updated.Pens and brushes are wrapped in separate class.Painting for the focused button (the focus rectangle around the button) by Wes Haggard (AKA puzzlehacker).Implemented IButtonControl interface by Wes Haggard (AKA puzzlehacker).Access key implementation by Wes Haggard (AKA puzzlehacker).Thanks all for the comments and critique. Interval of timer is set by default in such little value that our eyes don't notice that form fades in, while loading. The form contains timer which is used to load the form with the fade effect.
#WINDOWS XP BACKGROUND PAINTING HOW TO#
How to Delete Effect of Slow Painting While Form Is Loadingĭerive your form from PinkieControls.FormEx. We can run the command associated with the buttonExit by pressing ALT + X.
#WINDOWS XP BACKGROUND PAINTING WINDOWS#
If we'd like a button painted in current Windows XP color scheme, it's enough only to set the boolean property DefaultScheme, to true (by default it's false). } Setting Default Color Scheme for Windows XP Private void buttonXP3Click( object sender, System.EventArgs e) System.EventHandler( this.buttonXP3Click) This.buttonXP3._Image = GetImage( " _Save") If to add lines below in InitializeComponent() // we'll see the button at the design time // (doing so, don't forget to set _Image // and Image properties in null this.buttonXP3 = new PinkieControls.ButtonXP() Rm = new ResourceManager( " TestApp.Images", Private PinkieControls.ButtonXP buttonXP3
NotifyDefault method is called by a parent form to make a control the default button: We'll declare a boolean variable isDefault, to know whenever the button is default. What we are missing now is to trace and paint button in normal state, but when it is a default button (blue rectangle inside the borders, for Blue and Silver color schemes and green rectangle inside the borders, for Olive Green color scheme). If ((e.Button & MouseButtons.Left) = MouseButtons.Left) button receives an imput focus this.Focus( do nothing if pressed not the left button of mouse if ((e.Button & MouseButtons.Left) != MouseButtons.Left) return Protected override void OnMouseLeave(System.EventArgs e) So, we'll create such a region (the interior of a graphics shape) for our button.Ĭopy Code protected override void OnMouseEnter The graphic shape of the button looks like this: Setting the Control RegionĮverybody who used Windows XP has most probably noticed that buttons have rounded corners. When setting the ToolTip string, removes string currently associated with the control. Gets or sets a value that is returned to the parent form when the button is clicked, if the parent form is displayed through the ShowDialog method. If true, uses the default Windows XP color scheme (applies for Windows XP only, ignored for earlier versions of Windows). Setting DefaultScheme property to false allows you to show buttons with any of the three visual styles-Blue, Olive Green and Silver - on one form.