public virtual Size GetCharacterSize( Graphics g, Font font, CharacterCasing casing ) { const int MeasureCharCount = 10; Size charSize = new Size( 0, 0 ); for ( char c = '0'; c <= '9'; ++c ) { Size newSize = TextRenderer.MeasureText( g, new string( c, MeasureCharCount ), font, new Size( 0, 0 ), _textFormatFlags ); newSize.Width = (int)Math.Ceiling( (double)newSize.Width / (double)MeasureCharCount ); if ( newSize.Width > charSize.Width ) { charSize.Width = newSize.Width; } if ( newSize.Height > charSize.Height ) { charSize.Height = newSize.Height; } } return charSize; }
public VirtualFolderTreeView() { EventHandler handler = null; this.CanRaiseSelectEvents = true; this.FFolderNameCasing = CharacterCasing.Normal; this.FClearOnCollapse = true; this.FShowItemToolTips = true; this.ChangedFolders = new List<KeyValuePair<IVirtualFolder, WatcherChangeTypes>>(); if (!base.DesignMode) { this.ItemToolTipTimer = new Timer(); this.ItemToolTipTimer.Interval = OS.MouseHoverTime; this.ItemToolTipTimer.Tick += new EventHandler(this.ItemToolTipTimer_Tick); Settings.Default.PropertyChanged += new PropertyChangedEventHandler(this.SettingPropertyChanged); if (handler == null) { handler = delegate (object sender, EventArgs e) { this.ClearWatchFolders(); this.ItemNodeMap = null; Settings.Default.PropertyChanged -= new PropertyChangedEventHandler(this.SettingPropertyChanged); }; } base.Disposed += handler; base.FullRowSelect = OS.IsWin7; base.HotTracking = OS.IsWinXP; base.FadePlusMinus = OS.IsWinVista; base.ShowLines = !OS.IsWinVista; base.DrawMode = TreeViewDrawMode.OwnerDrawAll; } }
public CodeEditWindow(int codeLength, CharacterCasing casing, bool isEdit) { InitializeComponent(); this.txt_Code.MaxLength = codeLength; this.txt_Code.CharacterCasing = casing; this.txt_Code.ReadOnly = isEdit; }
/// <summary> /// Gets the input string with regular expression checking and character casing. /// </summary> /// <param name="_text">Prompt text to be shown on the dialog.</param> /// <param name="_caption">The caption of the dialog.</param> /// <param name="_regEx">The regular expression checking object.</param> /// <param name="_casing">The character casing.</param> /// <returns></returns> public static string GetInputString(string _text, string _caption, Regex _regEx, CharacterCasing _casing) { StringInputBox inputBox = new StringInputBox(); inputBox.lblPrompt.Text = _text; inputBox.Text = _caption; inputBox.regEx__ = _regEx; inputBox.textBox1.CharacterCasing = _casing; if (inputBox.ShowDialog() == DialogResult.OK) { return inputBox.textBox1.Text; } else { return string.Empty; } }
public static void SetContentCharacterCasing(UIElement element, CharacterCasing value) { element.SetValue(ControlsHelper.ContentCharacterCasingProperty, value); }
public CaseConverter() { Case = CharacterCasing.Upper; }
public static void SetCharacterCasing(DependencyObject element, CharacterCasing value) => element.SetValue(CharacterCasingProperty, value);
public StringCaseConverter() { Case = CharacterCasing.Normal; }
/// <summary> /// Sets the <see cref="CharacterCasing"/> value for this dependency object. /// </summary> public static void SetCharacterCasing(DependencyObject obj, CharacterCasing value) => obj.SetValue(CharacterCasingProperty, value);
/// <summary> /// Corrects the text character casing and optionally format phone fields simliar to Microsoft Outlook. /// </summary> /// <param name="strIn">String to be case corrected and optionally formatted.</param> /// <param name="characterCase">Character case and format.</param> /// <returns>String case corrected and optionally formatted.</returns> public static String ApplyCharacterCasing(String strIn, CharacterCasing characterCase) { strIn = strIn.Trim(); if (strIn.Length == 0) { return(strIn); } Int32 intX; switch (characterCase) { case CharacterCasing.None: return(strIn); case CharacterCasing.LowerCase: return(strIn.ToLower()); case CharacterCasing.UpperCase: return(strIn.ToUpper()); case CharacterCasing.OutlookPhoneNoProperName: return(FormatOutLookPhone(strIn)); case CharacterCasing.OutlookPhoneUpper: return(FormatOutLookPhone(strIn).ToUpper()); } strIn = strIn.ToLower(); String strPrevious = " "; String strPreviousTwo = " "; String strPreviousThree = " "; String strChar; for (intX = 0; intX < strIn.Length; intX++) { strChar = strIn.Substring(intX, 1); if (char.IsLetter(Convert.ToChar(strChar)) && strChar != strChar.ToUpper()) { if (strPrevious == " " || strPrevious == "." || strPrevious == "-" || strPrevious == "/" || strPreviousThree == " O'" || strPreviousTwo == "Mc") { strIn = strIn.Remove(intX, 1); strIn = strIn.Insert(intX, strChar.ToUpper()); strPrevious = strChar.ToUpper(); } else { strPrevious = strChar; } } else { strPrevious = strChar; } strPreviousTwo = strPreviousTwo.Substring(1, 1) + strPrevious; strPreviousThree = strPreviousThree.Substring(1, 1) + strPreviousThree.Substring(2, 1) + strPrevious; } intX = strIn.IndexOf("'"); if (intX == 1) { String strInsert = strIn.Substring(2, 1).ToUpper(); strIn = strIn.Remove(2, 1); strIn = strIn.Insert(2, strInsert); } try { intX = strIn.IndexOf("'", 3); if (intX > 3 && strIn.Substring(intX - 2, 1) == " ") { String strInsert = strIn.Substring(intX + 1, 1).ToUpper(); strIn = strIn.Remove(intX + 1, 1); strIn = strIn.Insert(intX + 1, strInsert); } // ReSharper disable EmptyGeneralCatchClause } catch { // ReSharper restore EmptyGeneralCatchClause } //never remove this code strIn += " "; foreach (CharacterCasingCheck check in CharacterCasingChecks.GetChecks()) { if (strIn.Contains(check.LookFor)) { Int32 intPosition = strIn.IndexOf(check.LookFor); if (intPosition > -1) { strIn = strIn.Remove(intPosition, check.LookFor.Length); strIn = strIn.Insert(intPosition, check.ReplaceWith); } } } if (characterCase == CharacterCasing.OutlookPhoneProperName) { strIn = FormatOutLookPhone(strIn); } return(strIn.Trim()); }
/// <summary> /// Sets the Character casing of the TextBox. /// </summary> public static void SetCharacterCasing(UIElement obj, CharacterCasing value) { obj.SetValue(CharacterCasingProperty, value); }
public static void SetCharacterCasing(ComboBox comboBox, CharacterCasing value) { comboBox.SetValue(CharacterCasingProperty, value); }
public virtual Size GetCharacterSize(Graphics g, Font font, CharacterCasing casing) { const int MeasureCharCount = 10; Size charSize = new Size(0, 0); if (casing == CharacterCasing.Lower) { for (char c = 'a'; c <= 'f'; ++c) { Size newSize = TextRenderer.MeasureText(g, new string( c, MeasureCharCount ), font, new Size(0, 0), _textFormatFlags); newSize.Width = (int)Math.Ceiling((double)newSize.Width / (double)MeasureCharCount); if (newSize.Width > charSize.Width) { charSize.Width = newSize.Width; } if (newSize.Height > charSize.Height) { charSize.Height = newSize.Height; } } } else { for (char c = 'A'; c <= 'F'; ++c) { Size newSize = TextRenderer.MeasureText(g, new string( c, MeasureCharCount ), font, new Size(0, 0), _textFormatFlags); newSize.Width = (int)Math.Ceiling((double)newSize.Width / (double)MeasureCharCount); if (newSize.Width > charSize.Width) { charSize.Width = newSize.Width; } if (newSize.Height > charSize.Height) { charSize.Height = newSize.Height; } } } for (char c = '0'; c <= '9'; ++c) { Size newSize = TextRenderer.MeasureText(g, new string( c, MeasureCharCount ), font, new Size(0, 0), _textFormatFlags); newSize.Width = (int)Math.Ceiling((double)newSize.Width / (double)MeasureCharCount); if (newSize.Width > charSize.Width) { charSize.Width = newSize.Width; } if (newSize.Height > charSize.Height) { charSize.Height = newSize.Height; } } return(charSize); }
/// <summary> /// Gets the input string without regular expression checking. /// </summary> /// <param name="_text">Prompt text to be shown on the dialog.</param> /// <param name="_caption">The caption of the dialog.</param> /// <param name="_casing">The character casing.</param> /// <returns>The input string.</returns> public static string GetInputString(string _text, string _caption, CharacterCasing _casing) { return GetInputString(_text, _caption, (Regex)null, _casing); }
public ToCase() { Casing = CharacterCasing.Upper; }
protected FtpContext(SerializationInfo info, StreamingContext context) { this.ContextId = (Guid) info.GetValue("ContextId", typeof(Guid)); base.UsePassive = info.GetBoolean("UsePassive"); this.UseCache = info.GetBoolean("UseCache"); this.UsePrefetch = info.GetBoolean("UsePrefetch"); this.StoreCredential = info.GetBoolean("StoreCredential"); this.UploadFileNameCasing = (CharacterCasing) info.GetInt32("UploadFileNameCasing"); string userName = null; string password = string.Empty; SerializationInfoEnumerator enumerator = info.GetEnumerator(); while (enumerator.MoveNext()) { SerializationEntry current = enumerator.Current; string name = current.Name; if (name != null) { if (!(name == "UserName")) { if (name == "Password") { goto Label_00E1; } if (name == "Encoding") { goto Label_00FA; } } else { userName = (string) current.Value; } } continue; Label_00E1: password = SimpleEncrypt.DecryptString((byte[]) current.Value, DES.Create()); continue; Label_00FA: base.ListEncoding = Encoding.GetEncoding(Convert.ToInt32(current.Value)); } if (userName != null) { base.Credentials = new NetworkCredential(userName, password); } this.FtpChangedHandler = new EventHandler<FtpChangedEventArg>(this.OnFtpChanged); FtpChanged += this.FtpChangedHandler; }
internal void InitializeContext(FtpSettings settings) { base.UsePassive = settings.UsePassive; this.UseCache = settings.UseCache; this.UsePrefetch = settings.UsePrefetch; this.StoreCredential = settings.StoreCredential; this.UploadFileNameCasing = settings.UploadFileNameCasing; if (!string.IsNullOrEmpty(settings.Encoding)) { base.ListEncoding = Encoding.GetEncoding(settings.Encoding); } else { base.ListEncoding = Encoding.Default; } }
/// <summary> /// Initializes a new instance of the CaseConverter class with the specified source and target casings. /// </summary> /// <param name="casing"> /// The source and target casings for the converter (see <see cref="Casing"/>). /// </param> public CaseConverter(CharacterCasing casing) { this.Casing = casing; }
/// <summary>Corrects the text character casing and optionally format phone fields similar to Microsoft Outlook.</summary> /// <param name="inputString">String to be case corrected and optionally formatted.</param> /// <param name="characterCase">Character case and format.</param> /// <param name="phoneExtension">The phone extension.</param> /// <returns>String case corrected and optionally formatted.</returns> /// <exception cref="InvalidEnumArgumentException">Thrown when enum value characterCase is not defined.</exception> /// <exception cref="InvalidEnumArgumentException">Thrown when enum value phoneExtension is not defined.</exception> public static String ApplyCharacterCasing(String inputString, CharacterCasing characterCase, PhoneExtension phoneExtension = PhoneExtension.Keep) { if (!Enum.IsDefined(typeof(CharacterCasing), characterCase)) { throw new InvalidEnumArgumentException(nameof(characterCase), (Int32)characterCase, typeof(CharacterCasing)); } if (!Enum.IsDefined(typeof(PhoneExtension), phoneExtension)) { throw new InvalidEnumArgumentException(nameof(phoneExtension), (Int32)phoneExtension, typeof(PhoneExtension)); } inputString = inputString.Trim(); if (inputString.Length == 0) { return(inputString); } Int32 intX; switch (characterCase) { case CharacterCasing.None: return(inputString); case CharacterCasing.LowerCase: return(inputString.ToLower()); case CharacterCasing.UpperCase: return(inputString.ToUpper()); case CharacterCasing.PhoneWithDashesNoProperName: case CharacterCasing.PhoneWithDotsNoProperName: case CharacterCasing.PhoneNoProperName: return(FormatOutLookPhone(inputString, characterCase, phoneExtension)); case CharacterCasing.PhoneWithDashesUpper: case CharacterCasing.PhoneWithDotsUpper: case CharacterCasing.PhoneUpper: return(FormatOutLookPhone(inputString, characterCase, phoneExtension).ToUpper()); } inputString = inputString.ToLower(); String previous = " "; String previousTwo = " "; String previousThree = " "; String charString; for (intX = 0; intX < inputString.Length; intX++) { charString = inputString.Substring(intX, 1); if (Char.IsLetter(Convert.ToChar(charString)) && charString != charString.ToUpper()) { if (previous == " " || previous == "." || previous == "-" || previous == "/" || previousThree == " O'" || previousTwo == "Mc") { inputString = inputString.Remove(intX, 1); inputString = inputString.Insert(intX, charString.ToUpper()); previous = charString.ToUpper(); } else { previous = charString; } } else { previous = charString; } previousTwo = previousTwo.Substring(1, 1) + previous; previousThree = previousThree.Substring(1, 1) + previousThree.Substring(2, 1) + previous; } intX = inputString.IndexOf("'", StringComparison.Ordinal); if (intX == 1) { String insertString = inputString.Substring(2, 1).ToUpper(); inputString = inputString.Remove(2, 1); inputString = inputString.Insert(2, insertString); } try { intX = inputString.IndexOf("'", 3, StringComparison.Ordinal); if (intX > 3 && inputString.Substring(intX - 2, 1) == " ") { String insertString = inputString.Substring(intX + 1, 1).ToUpper(); inputString = inputString.Remove(intX + 1, 1); inputString = inputString.Insert(intX + 1, insertString); } } catch { } //never remove this code inputString += " "; foreach (CharacterCasingCheck check in CharacterCasingChecks.GetChecks()) { if (inputString.Contains(check.LookFor)) { Int32 foundIndex = inputString.IndexOf(check.LookFor, StringComparison.Ordinal); if (foundIndex > -1) { inputString = inputString.Remove(foundIndex, check.LookFor.Length); inputString = inputString.Insert(foundIndex, check.ReplaceWith); } } } if (characterCase == CharacterCasing.PhoneProperName || characterCase == CharacterCasing.PhoneWithDashesProperName || characterCase == CharacterCasing.PhoneWithDotsProperName) { inputString = FormatOutLookPhone(inputString, characterCase, phoneExtension); } return(inputString.Trim()); }
/// <summary> /// Gets the input string with regular expression checking and character casing. /// </summary> /// <param name="_text">Prompt text to be shown on the dialog.</param> /// <param name="_caption">The caption of the dialog.</param> /// <param name="_pattern">The regular expression pattern string.</param> /// <param name="_casing">The character casing.</param> /// <returns>The input string.</returns> public static string GetInputString(string _text, string _caption, string _pattern, CharacterCasing _casing) { return GetInputString(_text, _caption, new Regex(_pattern), _casing); }
public virtual string ValueText( int value, CharacterCasing casing ) { return value.ToString( CultureInfo.InvariantCulture ); }
public TrainerText(string title, string main, int textBoxCharLength = 4, bool spaceOutString = false, CharacterCasing characterCasing = CharacterCasing.Normal, bool nerfSymbols = false) { InitializeComponent(); textBox.CharacterCasing = characterCasing; label_main.Text = main; Label_title.Text = title; this.maxLength = textBoxCharLength; textBox.MaxLength = textBoxCharLength; this.spaceOutString = spaceOutString; this.nerfSymbols = nerfSymbols; }
/// <summary> /// Sets the character casing of the control /// </summary> public static void SetContentCharacterCasing(UIElement element, CharacterCasing value) { element.SetValue(ContentCharacterCasingProperty, value); }
/// <summary> /// Gets the input string with regular expression checking and character casing. /// </summary> /// <param name="_text">Prompt text to be shown on the dialog.</param> /// <param name="_caption">The caption of the dialog.</param> /// <param name="_pattern">The regular expression pattern string.</param> /// <param name="_casing">The character casing.</param> /// <returns>The input string.</returns> public static string GetInputString(string _text, string _caption, string _pattern, CharacterCasing _casing) { return(GetInputString(_text, _caption, new Regex(_pattern), _casing)); }
public static void SetContentCharacterCasing(Button element, CharacterCasing value) { element.SetValue(ContentCharacterCasingProperty, value); }
/// <summary> /// Gets the input string without regular expression checking. /// </summary> /// <param name="_text">Prompt text to be shown on the dialog.</param> /// <param name="_caption">The caption of the dialog.</param> /// <param name="_casing">The character casing.</param> /// <returns>The input string.</returns> public static string GetInputString(string _text, string _caption, CharacterCasing _casing) { return(GetInputString(_text, _caption, (Regex)null, _casing)); }
public virtual string ValueText(int value, CharacterCasing casing) { return(value.ToString(CultureInfo.InvariantCulture)); }
/// <summary> /// Gets the input string with regular expression checking and character casing. /// </summary> /// <param name="_text">Prompt text to be shown on the dialog.</param> /// <param name="_caption">The caption of the dialog.</param> /// <param name="_regEx">The regular expression checking object.</param> /// <param name="_casing">The character casing.</param> /// <returns></returns> public static string GetInputString(string _text, string _caption, Regex _regEx, CharacterCasing _casing) { StringInputBox inputBox = new StringInputBox(); inputBox.lblPrompt.Text = _text; inputBox.Text = _caption; inputBox.regEx__ = _regEx; inputBox.textBox1.CharacterCasing = _casing; if (inputBox.ShowDialog() == DialogResult.OK) { return(inputBox.textBox1.Text); } else { return(string.Empty); } }
public CaseConverter() { Case = CharacterCasing.Upper; _culture = CultureInfo.CurrentCulture; }
/// <summary> /// Initializes a new instance of the <see cref="CharacterCasingFormattingAttribute"/> class. /// </summary> /// <param name="characterCasing">The character casing.</param> public CharacterCasingFormattingAttribute(CharacterCasing characterCasing) { this.CharacterCasing = characterCasing; }
/// <summary> /// Initializes a new instance of the CaseConverterExtension class with the specified <see cref="Casing"/>. /// </summary> /// <param name="casing"> /// The casing for the <see cref="CaseConverter"/>. /// </param> public CaseConverterExtension(CharacterCasing casing) { this.Casing = casing; }
public CaseConverter(CharacterCasing casing) { this.Casing = casing; }
/// <summary> /// Initializes a new instance of the CaseConverterExtension class with the specified source and target <see cref="Casing"/>. /// </summary> /// <param name="sourceCasing"> /// The source casing for the <see cref="CaseConverter"/>. /// </param> /// <param name="targetCasing"> /// The target casing for the <see cref="CaseConverter"/>. /// </param> public CaseConverterExtension(CharacterCasing sourceCasing, CharacterCasing targetCasing) { this.SourceCasing = sourceCasing; this.TargetCasing = targetCasing; }
/// <summary> /// Adds a CharacterCasing Formatting rule to the list of rules to be executed when the property is changed. /// </summary> public void AddRule(String propertyName, CharacterCasing characterCasing) { this.RulesDictionary.Add(propertyName, characterCasing); }
/// <summary> /// Initializes a new instance of the CaseConverter class with the specified source and target casings. /// </summary> /// <param name="sourceCasing"> /// The source casing for the converter (see <see cref="SourceCasing"/>). /// </param> /// <param name="targetCasing"> /// The target casing for the converter (see <see cref="TargetCasing"/>). /// </param> public CaseConverter(CharacterCasing sourceCasing, CharacterCasing targetCasing) { this.SourceCasing = sourceCasing; this.TargetCasing = targetCasing; }
/// <summary> /// Sets the character casing for every field in the control. /// </summary> /// <param name="casing"></param> public void SetCasing( CharacterCasing casing ) { foreach ( FieldControl fc in _fieldControls ) { fc.CharacterCasing = casing; fc.Size = fc.MinimumSize; } }
public virtual string ValueText( int value, CharacterCasing casing ) { if ( casing == CharacterCasing.Upper ) { return String.Format( CultureInfo.InvariantCulture, "{0:X}", value ); } return String.Format( CultureInfo.InvariantCulture, "{0:x}", value ); }
/// <summary> /// Sets the character casing for a specific field in the control. /// </summary> /// <param name="fieldIndex"></param> /// <param name="casing"></param> public void SetCasing( int fieldIndex, CharacterCasing casing ) { if ( IsValidFieldIndex( fieldIndex ) ) { _fieldControls[ fieldIndex ].CharacterCasing = casing; _fieldControls[ fieldIndex ].Size = _fieldControls[ fieldIndex ].MinimumSize; } }
// Constructor will go when complete, only for testing - pdb internal TextBoxBase () { alignment = HorizontalAlignment.Left; accepts_return = false; accepts_tab = false; auto_size = true; InternalBorderStyle = BorderStyle.Fixed3D; actual_border_style = BorderStyle.Fixed3D; character_casing = CharacterCasing.Normal; hide_selection = true; max_length = short.MaxValue; password_char = '\0'; read_only = false; word_wrap = true; richtext = false; show_selection = false; enable_links = false; list_links = new ArrayList (); current_link = null; show_caret_w_selection = (this is TextBox); document = new Document(this); document.WidthChanged += new EventHandler(document_WidthChanged); document.HeightChanged += new EventHandler(document_HeightChanged); //document.CaretMoved += new EventHandler(CaretMoved); document.Wrap = false; click_last = DateTime.Now; click_mode = CaretSelection.Position; MouseDown += new MouseEventHandler(TextBoxBase_MouseDown); MouseUp += new MouseEventHandler(TextBoxBase_MouseUp); MouseMove += new MouseEventHandler(TextBoxBase_MouseMove); SizeChanged += new EventHandler(TextBoxBase_SizeChanged); FontChanged += new EventHandler(TextBoxBase_FontOrColorChanged); ForeColorChanged += new EventHandler(TextBoxBase_FontOrColorChanged); MouseWheel += new MouseEventHandler(TextBoxBase_MouseWheel); RightToLeftChanged += new EventHandler (TextBoxBase_RightToLeftChanged); scrollbars = RichTextBoxScrollBars.None; hscroll = new ImplicitHScrollBar(); hscroll.ValueChanged += new EventHandler(hscroll_ValueChanged); hscroll.SetStyle (ControlStyles.Selectable, false); hscroll.Enabled = false; hscroll.Visible = false; hscroll.Maximum = Int32.MaxValue; vscroll = new ImplicitVScrollBar(); vscroll.ValueChanged += new EventHandler(vscroll_ValueChanged); vscroll.SetStyle (ControlStyles.Selectable, false); vscroll.Enabled = false; vscroll.Visible = false; vscroll.Maximum = Int32.MaxValue; SuspendLayout (); this.Controls.AddImplicit (hscroll); this.Controls.AddImplicit (vscroll); ResumeLayout (); SetStyle(ControlStyles.UserPaint | ControlStyles.StandardClick, false); #if NET_2_0 SetStyle(ControlStyles.UseTextForAccessibility, false); base.SetAutoSizeMode (AutoSizeMode.GrowAndShrink); #endif canvas_width = ClientSize.Width; canvas_height = ClientSize.Height; document.ViewPortWidth = canvas_width; document.ViewPortHeight = canvas_height; Cursor = Cursors.IBeam; }
public static CharacterCasing Unbox_CharacterCasing(IntPtr val) { CharacterCasing ret = (CharacterCasing)NoesisGUI_PINVOKE.Unbox_CharacterCasing(val); return(ret); }
public static IntPtr Box_CharacterCasing(CharacterCasing val) { IntPtr ret = NoesisGUI_PINVOKE.Box_CharacterCasing((int)val); return(ret); }