public MgTextBox() : base() { #if !PocketPC base.RightToLeft = RightToLeft.No; #endif AutoSize = false; if (isJapanese()) { ImeReadStrBuilder = new StringBuilder(); ImeReadStrBuilder.Capacity = 128; } else { ImeReadStrBuilder = null; } TextAlign = ContentAlignment.TopLeft; TextBoxStrategy = new TextBoxNoHintStrategy(this); //We need to set the default border style here because in case of ShowBorder = true, we don't set the BorderStyle again. //So framework set its default borderstyle to Fixed3D. BorderStyle = ShouldDrawFlatTextBox ? BorderStyle.FixedSingle : BorderStyle.Fixed3D; FontDescription = new FontDescription(Font); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.FontChanged += MgTextBox_FontChanged; }
/// <summary> /// Set strategy to regular text box strategy /// </summary> /// <param name="hintText"></param> public void DisableHintStrategy() { if (!(TextBoxStrategy is TextBoxNoHintStrategy)) //If not disabled { TextBoxStrategy.UnregisterEvents(); Color oldHintcolor = TextBoxStrategy.HintFgColor; TextBoxStrategy = new TextBoxNoHintStrategy(this); Debug.Assert(TextBoxStrategy.HintText == null); TextBoxStrategy.HintFgColor = oldHintcolor; } }