On the DateBox, I want to set the default local to British (or whatever does a DD/MM/YYYY rather than MM/DD/YYYY)
On a textBox, I want to set a BackGround Colour when the control gets focus. This we have on VFP and it is very useful, particulalrly on a form with many controls, to give the user a visual clue as to where they are at.
(I am of the impression that there is now 'Visual' way to change a property in .net but maybe someone could confirm this)
public class DateBox : MicroFour.StrataFrame.UI.Windows.Forms.DateBox{// Code here to change Date format to british }
public class Textbox : MicroFour.StrataFrame.UI.Windows.Forms.Textbox{// VFP equivalent --> when enabled this.BackGroundColour = Rgb(255,0,0)}
There is one thing I could not do. Is there a VFP equivalent to RGB(). I have used the Color.AColour in this instance
protected override void OnEnter(EventArgs e){
//-- Run Base Class Codebase.OnEnter(e);
//-- Save away original background colorthis.originalBackgroudColour = this.BackColor;
//-- Define the background color for the control.. maybe extend this to use a property laterthis.BackColor = Color.Aqua;}
protected override void OnLeave(EventArgs e){
//-- Run the Base Code for the textboxbase.OnLeave(e);
//-- Reset back color to the defaultthis.BackColor = this.originalBackgroudColour;}} // End textBox
Put that in your Program.cs and it will affect the DateFormat of any StrataFrame DateBox that does not have the property explictely set.
For the TextBox, you'll want to inherit our textbox in your own, and override the OnEnter and OnLeave methods:
namespace WindowsApplication1{ public class MyTextBox : MicroFour.StrataFrame.UI.Windows.Forms.Textbox { protected override void OnEnter( EventArgs e ) { this.BackColor = System.Drawing.Color.Gray;
base.OnEnter( e ); }
protected override void OnLeave( EventArgs e ) { this.BackColor = System.Drawing.Color.White;
base.OnLeave( e ); } }}
Then if you use your own overriden control rather than our standard one, it will reflect your added functionality.