//everything below here is the set up for our custom text boxes
 public void SetupTextBoxes()
 {
     TextBoxStyle.TextBoxEmpty(txtUsername, "username");
     TextBoxStyle.TextBoxEmpty(txtPassword, "password");
     TextBoxStyle.TextBoxEmpty(txtPassword2, "password2");
     TextBoxStyle.TextBoxEmpty(txtStaffId, "staffId");
 }
示例#2
0
        public static Style CreateStyle()
        {
            var style = TextBoxStyle.CreateTextBoxStyle();

            style.TargetType = typeof(TextBoxEx);
            return(style);
        }
示例#3
0
 //setup all text boxes to our custom look where the input requirements shows up on empty text boxes
 public void SetupTextBoxes()
 {
     txtUsername.Clear();
     txtPassword.Clear();
     TextBoxStyle.TextBoxEmpty(txtUsername, "username");
     TextBoxStyle.TextBoxEmpty(txtPassword, "password");
 }
示例#4
0
    private void EnableTextBox(TextBoxStyle style)
    {
        //This Function should disable all activated TextBoxes and enable the one we triggered
        DisableAllTextboxs();

        switch (style)
        {
        case TextBoxStyle.Regular:
            EnableRegularTextbox();
            Time.timeScale = 0;
            Debug.Log("RegularTextBoxEnabled");
            break;

        case TextBoxStyle.Npc:
            EnableNpcTextbox();
            Time.timeScale = 0;
            Debug.Log("NPCTextBoxEnabled");
            break;

        case TextBoxStyle.OneLine:
            Debug.Log("OneLineTextBoxEnabled");
            EnableOneLineTextbox();
            //Should remove a one line text after 3 seconds.
            StartCoroutine(DialogueDisplayTime(3));
            break;

        default:
            Debug.Log("No textbox to enable");
            break;
        }
    }
 public void SetupTextBoxes()
 {
     TextBoxStyle.TextBoxEmpty(txtMonth, "month");
     TextBoxStyle.TextBoxEmpty(txtDay, "day");
     TextBoxStyle.TextBoxEmpty(txtYear, "year");
     TextBoxStyle.TextBoxEmpty(txtBreakStart, "startBreak");
     TextBoxStyle.TextBoxEmpty(txtBreakEnd, "endBreak");
 }
示例#6
0
        public void SetupTextBoxes()
        {
            txtMonth.Clear();
            txtDay.Clear();
            txtYear.Clear();

            TextBoxStyle.TextBoxEmpty(txtMonth, "month");
            TextBoxStyle.TextBoxEmpty(txtDay, "day");
            TextBoxStyle.TextBoxEmpty(txtYear, "year");
        }
        public void RegisterHtmlHeadContents(HtmlHeadAppender htmlHeadAppender, TextBoxStyle textBoxStyle)
        {
            ArgumentUtility.CheckNotNull("htmlHeadAppender", htmlHeadAppender);

            textBoxStyle.RegisterJavaScriptInclude(ResourceUrlFactory, htmlHeadAppender);

            string styleKey  = typeof(BocTextValueRenderer).FullName + "_Style";
            var    styleFile = ResourceUrlFactory.CreateThemedResourceUrl(typeof(BocTextValueRenderer), ResourceType.Html, "BocTextValue.css");

            htmlHeadAppender.RegisterStylesheetLink(styleKey, styleFile, HtmlHeadAppender.Priority.Library);
        }
示例#8
0
        public void RegisterHtmlHeadContents(HtmlHeadAppender htmlHeadAppender, TextBoxStyle textBoxStyle)
        {
            ArgumentUtility.CheckNotNull("htmlHeadAppender", htmlHeadAppender);

            textBoxStyle.RegisterJavaScriptInclude(SafeServiceLocator.Current.GetInstance <IResourceUrlFactory>(), htmlHeadAppender);

            string styleKey = typeof(BocMultilineTextValueQuirksModeRenderer).FullName + "_Style";

            var styleUrl = ResourceUrlFactory.CreateResourceUrl(typeof(BocMultilineTextValueQuirksModeRenderer), ResourceType.Html, "BocMultilineTextValue.css");

            htmlHeadAppender.RegisterStylesheetLink(styleKey, styleUrl, HtmlHeadAppender.Priority.Library);
        }
示例#9
0
        //if register link is clicked, reset any information input my user and show the registration form
        private void linkRegister_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Hide();
            CenterToScreen();
            txtUsername.Clear();
            txtPassword.Clear();
            TextBoxStyle.TextBoxEmpty(txtUsername, "username");
            TextBoxStyle.TextBoxEmpty(txtPassword, "password");

            var registrationForm = new RegistrationForm(this);

            registrationForm.ShowDialog();
        }
示例#10
0
文件: TextBox.cs 项目: xvwvx/Myra
        public void ApplyTextBoxStyle(TextBoxStyle style)
        {
            ApplyWidgetStyle(style);

            TextColor         = style.TextColor;
            DisabledTextColor = style.DisabledTextColor;
            FocusedTextColor  = style.FocusedTextColor;

            Cursor    = style.Cursor;
            Selection = style.Selection;

            Font = style.Font;
        }
示例#11
0
        //ensure username is only a number or alphabetic letter, with at least 3 characters
        public bool ValidateUsername(string username)
        {
            bool  valid = false;
            Regex reg   = new Regex(@"^[a-zA-Z0-9]*$");

            string phrase = TextBoxStyle.CheckWhichTextBox("username");

            if (reg.IsMatch(username) && username != phrase && username.Length >= 3)
            {
                valid = true;
            }

            return(valid);
        }
示例#12
0
 public TextBox(TextBoxStyle style, string text)
 {
     TextBoxStyle = style;
     btTexture    = new ButtonTexture(@"Content\Textures\Resources\Start\TextBox-" + TextBoxStyle.ToString(), "TextBox-" + TextBoxStyle.ToString(), null)
     {
         FireEventWhenUnEnable = true
     };
     Cursor    = TextBoxStyle.ToString();
     MouseOver = false; Visible = true; Enable = true;
     Text      = text;
     ViewText  = Text.WordsSubString(8);
     //if (Setting.Current.Language == "传统" && !String.IsNullOrEmpty(ViewText))
     //{
     //    ViewText = ViewText.TranslationWords(false, true);
     //}
 }
 public void SetupTextBoxes()
 {
     TextBoxStyle.TextBoxEmpty(txtMondayStart, "startTime");
     TextBoxStyle.TextBoxEmpty(txtMondayEnd, "endTime");
     TextBoxStyle.TextBoxEmpty(txtTuesdayStart, "startTime");
     TextBoxStyle.TextBoxEmpty(txtTuesdayEnd, "endTime");
     TextBoxStyle.TextBoxEmpty(txtWednesdayStart, "startTime");
     TextBoxStyle.TextBoxEmpty(txtWednesdayEnd, "endTime");
     TextBoxStyle.TextBoxEmpty(txtThursdayStart, "startTime");
     TextBoxStyle.TextBoxEmpty(txtThursdayEnd, "endTime");
     TextBoxStyle.TextBoxEmpty(txtFridayStart, "startTime");
     TextBoxStyle.TextBoxEmpty(txtFridayEnd, "endTime");
     TextBoxStyle.TextBoxEmpty(txtSaturdayStart, "startTime");
     TextBoxStyle.TextBoxEmpty(txtSaturdayEnd, "endTime");
     TextBoxStyle.TextBoxEmpty(txtSundayStart, "startTime");
     TextBoxStyle.TextBoxEmpty(txtSundayEnd, "endTime");
 }
示例#14
0
        public int PickCharTextField(Rectangle rect, string text, Font font, TextBoxStyle style, Point pickLoc, int scroll = 0)
        {
            if (style == TextBoxStyle.Plain)
            {
                rect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
            }
            else if (style == TextBoxStyle.Flat)
            {
                rect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
            }
            else if (style == TextBoxStyle.Sunken)
            {
                rect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
            }

            pickLoc.X  += scroll;
            rect.Width += scroll;
            return(PickCharStringLine(text, font, rect, pickLoc));
        }
示例#15
0
        public int GetCharPosTextField(Rectangle rect, string text, Font font, TextBoxStyle style, int index, int scroll = 0)
        {
            if (style == TextBoxStyle.Plain)
            {
                rect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
            }
            else if (style == TextBoxStyle.Flat)
            {
                rect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
            }
            else if (style == TextBoxStyle.Sunken)
            {
                rect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
            }

            Rectangle rectScrolled = new Rectangle(
                rect.X - scroll,
                rect.Y,
                rect.Width + scroll + 10000000,
                rect.Height);

            if (index == 0)
            {
                return(rectScrolled.Left);
            }

            using (var image = new Bitmap(1, 1)) { using (var g = Graphics.FromImage(image)) {
                                                       StringFormat nameLabelFormat = StringFormat.GenericDefault;
                                                       nameLabelFormat.Alignment     = StringAlignment.Near;
                                                       nameLabelFormat.LineAlignment = StringAlignment.Center;
                                                       nameLabelFormat.Trimming      = StringTrimming.Character;
                                                       nameLabelFormat.FormatFlags  |= StringFormatFlags.NoWrap | StringFormatFlags.MeasureTrailingSpaces;
                                                       nameLabelFormat.SetMeasurableCharacterRanges(new [] { new CharacterRange(0, index) });

                                                       Region[]   measured = g.MeasureCharacterRanges(text, font, rectScrolled, nameLabelFormat);
                                                       RectangleF bound    = measured[0].GetBounds(g);
                                                       return((int)bound.Right);
                                                   } }
        }
 private void txtDay_KeyUp(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxEmpty(txtDay, "day");
 }
 private void txtBreakEnd_KeyDown(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxNotEmpty(txtBreakEnd, "endBreak", e);
 }
 private void txtBreakStart_KeyDown(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxNotEmpty(txtBreakStart, "startBreak", e);
 }
 private void txtYear_KeyDown(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxNotEmpty(txtYear, "year", e);
 }
示例#20
0
    private void AppendTextBoxStyle(XmlWriter writer, TextBoxStyle style)
    {
        writer.WriteStartElement(STYLE_ELEMENT); //<Style>
        if (style.BorderWidth > 0)
        {
            writer.WriteStartElement(BORDER_ELEMENT); //<Border>
            //AppendString(writer, COLOR_ELEMENT, style.BorderColor); //<Color/>
            AppendString(writer, STYLE_ELEMENT, "Solid"); //<Style/>
            AppendString(writer, WIDTH_ELEMENT, string.Format("{0}pt", style.BorderWidth)); //<Style/>
            writer.WriteEndElement(); //</Border>

            if (!style.TopBorder)
            {
                writer.WriteStartElement(TOPBORDER_ELEMENT); //<TopBorder>
                AppendString(writer, STYLE_ELEMENT, "None"); //<Style/>
                writer.WriteEndElement(); //</TopBorder>
            }
            if (!style.LeftBorder)
            {
                writer.WriteStartElement(LEFTBORDER_ELEMENT); //<LeftBorder>
                AppendString(writer, STYLE_ELEMENT, "None"); //<Style/>
                writer.WriteEndElement(); //</LeftBorder>
            }
            if (!style.RightBorder)
            {
                writer.WriteStartElement(RIGHTBORDER_ELEMENT); //<RightBorder>
                AppendString(writer, STYLE_ELEMENT, "None"); //<Style/>
                writer.WriteEndElement(); //</RightBorder>
            }
            if (!style.BottomBorder)
            {
                writer.WriteStartElement(BOTTOMBORDER_ELEMENT); //<BottomBorder>
                AppendString(writer, STYLE_ELEMENT, "None"); //<Style/>
                writer.WriteEndElement(); //</BottomBorder>
            }
        }

        if (!string.IsNullOrEmpty(style.BackgroudColor))
        {
            AppendString(writer, BACKGROUNDCOLOR_ELEMENT, style.BackgroudColor); //<BackgroundColor/>
        }

        //if (!string.IsNullOrEmpty(style.VerticalAlign))
        //{
        //    WriteString(writer, VERTICALALIGN_ELEMENT, style.VerticalAlign);//<VerticalAlign/>
        //}

        AppendString(writer, PADDINGLEFT_ELEMENT, style.Padding); //<PaddingLeft/>
        AppendString(writer, PADDINGRIGHT_ELEMENT, style.Padding); //<PaddingRight/>
        AppendString(writer, PADDINGTOP_ELEMENT, style.Padding); //<PaddingTop/>
        AppendString(writer, PADDINGBOTTOM_ELEMENT, style.Padding); //<PaddingBottom/>

        writer.WriteEndElement(); //</Style>
    }
示例#21
0
 private void txtPassword_KeyDown(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxNotEmpty(txtPassword, "password", e);
 }
示例#22
0
 private void txtPassword_KeyUp(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxEmpty(txtPassword, "password");
 }
		public int PickCharTextField(Rectangle rect, string text, Font font, TextBoxStyle style, Point pickLoc, int scroll = 0)
		{

			if (style == TextBoxStyle.Plain)
				rect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
			else if (style == TextBoxStyle.Flat)
				rect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
			else if (style == TextBoxStyle.Sunken)
				rect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);

			pickLoc.X += scroll;
			rect.Width += scroll;
			return PickCharStringLine(text, font, rect, pickLoc);

		}
		public Rectangle DrawTextBoxBorder(Graphics g, Rectangle rect, TextBoxState state, TextBoxStyle style, Color backColor)
		{
			if (rect.Width < 4 || rect.Height < 4) return rect;
			Rectangle clientRect = rect;

			Color borderColor = this.ColorDarkBackground.ScaleBrightness(1.2f);
			Color borderColorDark = this.ColorDarkBackground.ScaleBrightness(0.85f);

			if (style == TextBoxStyle.Plain)
			{
				clientRect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);

				Pen innerPen;
				if (state == TextBoxState.Normal)
				{
					innerPen = new Pen(Color.Transparent);
				}
				else if (state == TextBoxState.Hot)
				{
					innerPen = new Pen(Color.FromArgb(32, this.ColorHightlight));
				}
				else if (state == TextBoxState.Focus)
				{
					innerPen = new Pen(Color.FromArgb(64, this.ColorHightlight));
				}
				else //if (state == TextBoxState.Disabled)
				{
					innerPen = new Pen(Color.Transparent);
				}

				g.FillRectangle(new SolidBrush(backColor), rect);
				g.DrawRectangle(innerPen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
			}
			else if (style == TextBoxStyle.Flat)
			{
				clientRect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);

				Pen borderPen;
				Pen innerPen;
				if (state == TextBoxState.Normal)
				{
					borderPen = new Pen(borderColorDark);
					innerPen = new Pen(Color.Transparent);
				}
				else if (state == TextBoxState.Hot)
				{
					borderPen = new Pen(borderColorDark.MixWith(this.ColorHightlight, 0.25f, true));
					innerPen = new Pen(Color.FromArgb(32, this.ColorHightlight));
				}
				else if (state == TextBoxState.Focus)
				{
					borderPen = new Pen(borderColorDark.MixWith(this.ColorHightlight, 0.5f, true));
					innerPen = new Pen(Color.FromArgb(48, this.ColorHightlight));
				}
				else //if (state == TextBoxState.Disabled)
				{
					borderPen = new Pen(Color.FromArgb(128, borderColorDark));
					innerPen = new Pen(Color.Transparent);
				}

				g.FillRectangle(new SolidBrush(backColor), rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);

				g.DrawRectangle(borderPen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
				g.DrawRectangle(innerPen, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3);
			}
			else if (style == TextBoxStyle.Sunken)
			{
				clientRect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);

				Pen borderPenDark;
				Pen borderPen;
				Pen innerPen;
				if (state == TextBoxState.Normal)
				{
					borderPenDark = new Pen(borderColorDark);
					borderPen = new Pen(borderColor);
					innerPen = new Pen(Color.Transparent);
				}
				else if (state == TextBoxState.Hot)
				{
					borderPenDark = new Pen(borderColorDark.MixWith(this.ColorHightlight, 0.25f, true));
					borderPen = new Pen(borderColor.MixWith(this.ColorHightlight, 0.25f, true));
					innerPen = new Pen(Color.FromArgb(32, this.ColorHightlight));
				}
				else if (state == TextBoxState.Focus)
				{
					borderPenDark = new Pen(borderColorDark.MixWith(this.ColorHightlight, 0.5f, true));
					borderPen = new Pen(borderColor.MixWith(this.ColorHightlight, 0.5f, true));
					innerPen = new Pen(Color.FromArgb(48, this.ColorHightlight));
				}
				else //if (state == TextBoxState.Disabled)
				{
					borderPenDark = new Pen(Color.FromArgb(128, borderColorDark));
					borderPen = new Pen(Color.FromArgb(128, borderColor));
					innerPen = new Pen(Color.Transparent);
				}

				g.FillRectangle(new SolidBrush(backColor), rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);

				g.DrawLine(borderPenDark, rect.X + 1, rect.Y, rect.Right - 2, rect.Y);
				g.DrawLine(borderPen, rect.X, rect.Y + 1, rect.X, rect.Bottom - 2);
				g.DrawLine(borderPen, rect.Right - 1, rect.Y + 1, rect.Right - 1, rect.Bottom - 2);
				g.DrawLine(borderPen, rect.X + 1, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1);
				g.DrawRectangle(innerPen, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3);
			}

			return clientRect;
		}
 private void txtMonth_KeyUp(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxEmpty(txtMonth, "month");
 }
示例#26
0
    private void AppendTextRunStyle(XmlWriter writer, TextBoxStyle style)
    {
        writer.WriteStartElement(STYLE_ELEMENT); //<Style>

        AppendString(writer, FONTFAMILY_ELEMENT, style.FontName); //<FontFamily/>
        AppendString(writer, FONTSIZE_ELEMENT, style.FontSize); //<FontSize/>
        if (!string.IsNullOrEmpty(style.Format))
        {
            AppendString(writer, FORMAT_ELEMENT, style.Format); //<FontWeight/>
        }
        if (!string.IsNullOrEmpty(style.FontWeight))
        {
            AppendString(writer, FONTWEIGHT_ELEMENT, style.FontWeight); //<FontWeight/>
        }
        if (!string.IsNullOrEmpty(style.FontStyle))
        {
            AppendString(writer, FONTSTYLE_ELEMENT, style.FontStyle); //<FontStyle/>
        }
        if (!string.IsNullOrEmpty(style.TextDecoration))
        {
            AppendString(writer, TEXTDECORATION_ELEMENT, style.TextDecoration); //<TextDecoration/>
        }
        AppendString(writer, COLOR_ELEMENT, style.Color); //<Color/>

        writer.WriteEndElement(); //</Style>
    }
        //21/07/05 LL - TIR0200 added overloaded ReportingServicesStyle constructor
        //for text alignment
        /// <summary>
        /// Creates a new ReportingServicesStyle for textboxes with Text Alignment.
        /// </summary>
        /// <param name="style">Which textbox type this is a style for (use the
        /// TextBoxStyle enum.</param>
        /// <param name="textAlign">Indicate Text Alignment.</param>
        public ReportingServicesStyle(TextBoxStyle style, string textAlign)
        {
            //set Text Alignment
            if (textAlign != null)
            {
                _textAlign = textAlign;
            }
            else
            {
                //set default value
                _textAlign = "";
            }

            // Initialise the properties correctly.
            switch (style)
            {
            case TextBoxStyle.TabularReport10pt:
                SetupTabularReport10ptTextBox();
                break;

            case TextBoxStyle.TabularReport14pt:
                SetupTabularReport14ptTextBox();
                break;

            case TextBoxStyle.TableHeaderTextBox:
                SetupTableHeaderTextBox();
                break;

            case TextBoxStyle.TableGroupTextBox:
                SetupTableGroupTextBox();
                break;

            case TextBoxStyle.TableDetailsTextBox:
                SetupTableDetailsTextBox();
                break;

            case TextBoxStyle.MatrixReport:
                SetupMatrixReportTextBox();
                break;

            case TextBoxStyle.MatrixReportCorner:
                SetupMatrixReportCornerTextBox();
                break;

            case TextBoxStyle.MatrixDynamic:
                SetupMatrixDynamicTextBox();
                break;

            case TextBoxStyle.MatrixRow:
                SetupMatrixRow();
                break;

            case TextBoxStyle.BoldBordered:
                SetupBoldBordered();
                break;

            case TextBoxStyle.PlainBordered:
                SetupPlainBordered();
                break;
            }
        }
示例#28
0
    private void AppendParagraphStyle(XmlWriter writer, TextBoxStyle style)
    {
        writer.WriteStartElement(STYLE_ELEMENT);//<Style>
        if (!string.IsNullOrEmpty(style.TextAlign))
        {
            AppendString(writer, TEXTALIGN_ELEMENT, style.TextAlign); //<TextAlign/>
        }

        writer.WriteEndElement();//</Style>
    }
		public void DrawTextField(Graphics g, Rectangle rect, string text, Font font, Color textColor, Color backColor, TextBoxState state, TextBoxStyle style, int scroll = 0, int cursorPos = -1, int selLength = 0)
		{
			if (rect.Width < 4 || rect.Height < 4) return;
			GraphicsState oldState = g.Save();

			// Draw Background
			Rectangle textRect = DrawTextBoxBorder(g, rect, state, style, backColor);
			Rectangle textRectScrolled = new Rectangle(
				textRect.X - scroll,
				textRect.Y,
				textRect.Width + scroll,
				textRect.Height);
			if (text == null) return;
			
			RectangleF clipRect = g.ClipBounds;
			clipRect = textRect;
			g.SetClip(clipRect);

			// Draw Selection
			if ((state & TextBoxState.Focus) == TextBoxState.Focus && cursorPos >= 0 && selLength != 0)
			{
				int selPos = Math.Min(cursorPos + selLength, cursorPos);
				CharacterRange[] charRanges = new [] { new CharacterRange(selPos, Math.Abs(selLength)) };
				Region[] charRegions = MeasureStringLine(g, text, charRanges, font, textRectScrolled);
				RectangleF selectionRect = charRegions.Length > 0 ? charRegions[0].GetBounds(g) : RectangleF.Empty;
				selectionRect.Inflate(0, 2);
				selectionRect.Y += GetFontYOffset(font);
				if (selPos == 0)
				{
					selectionRect.X -= 2;
					selectionRect.Width += 2;
				}
				if (selPos + Math.Abs(selLength) == text.Length)
				{
					selectionRect.Width += 2;
				}

				if ((state & TextBoxState.ReadOnlyFlag) == TextBoxState.ReadOnlyFlag)
					g.FillRectangle(new SolidBrush(Color.FromArgb(128, this.ColorGrayText)), selectionRect);
				else
					g.FillRectangle(new SolidBrush(Color.FromArgb(128, this.ColorHightlight)), selectionRect);
			}

			// Draw Text
			if ((state & TextBoxState.Disabled) == TextBoxState.Disabled ||
				(state & TextBoxState.ReadOnlyFlag) == TextBoxState.ReadOnlyFlag)
				textColor = Color.FromArgb(128, textColor);
			DrawStringLine(g, text, font, textRectScrolled, textColor);

			// Draw Cursor
			if ((state & TextBoxState.ReadOnlyFlag) != TextBoxState.ReadOnlyFlag && cursorPos >= 0 && selLength == 0)
			{
				CharacterRange[] charRanges = new [] { new CharacterRange(0, cursorPos) };
				Region[] charRegions = MeasureStringLine(g, text, charRanges, font, textRectScrolled);
				RectangleF textRectUntilCursor = charRegions.Length > 0 ? charRegions[0].GetBounds(g) : RectangleF.Empty;
				int curPixelPos = textRectScrolled.X + (int)textRectUntilCursor.Width + 2;
				DrawCursor(g, new Rectangle(curPixelPos, textRectScrolled.Top + 1, 1, textRectScrolled.Height - 2));
			}

			g.Restore(oldState);
		}
 private void txtBreakStart_KeyUp(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxEmpty(txtBreakStart, "startBreak");
 }
		public int GetCharPosTextField(Rectangle rect, string text, Font font, TextBoxStyle style, int index, int scroll = 0)
		{
			if (style == TextBoxStyle.Plain)
				rect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
			else if (style == TextBoxStyle.Flat)
				rect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
			else if (style == TextBoxStyle.Sunken)
				rect = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
			
			Rectangle rectScrolled = new Rectangle(
				rect.X - scroll,
				rect.Y,
				rect.Width + scroll + 10000000,
				rect.Height);
			if (index == 0) return rectScrolled.Left;

			using (var image = new Bitmap(1, 1)) { using (var g = Graphics.FromImage(image)) {
				StringFormat nameLabelFormat = StringFormat.GenericDefault;
				nameLabelFormat.Alignment = StringAlignment.Near;
				nameLabelFormat.LineAlignment = StringAlignment.Center;
				nameLabelFormat.Trimming = StringTrimming.Character;
				nameLabelFormat.FormatFlags |= StringFormatFlags.NoWrap | StringFormatFlags.MeasureTrailingSpaces;
				nameLabelFormat.SetMeasurableCharacterRanges(new [] {new CharacterRange(0, index)});

				Region[] measured = g.MeasureCharacterRanges(text, font, rectScrolled, nameLabelFormat);
				RectangleF bound = measured[0].GetBounds(g);
				return (int)bound.Right;
			}}
		}
 private void txtBreakEnd_KeyUp(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxEmpty(txtBreakEnd, "endBreak");
 }
示例#33
0
 private void txtUsername_KeyUp(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxEmpty(txtUsername, "username");
 }
 private void txtMonth_KeyDown(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxNotEmpty(txtMonth, "month", e);
 }
示例#35
0
 private void txtUsername_KeyDown(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxNotEmpty(txtUsername, "username", e);
 }
 private void txtDay_KeyDown(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxNotEmpty(txtDay, "day", e);
 }
 private void txtYear_KeyUp(object sender, KeyEventArgs e)
 {
     TextBoxStyle.TextBoxEmpty(txtYear, "year");
 }
示例#38
0
    private void AppendTextBox(XmlWriter writer, string name, string expression, TextBoxStyle style, ItemRectangle rectangle)
    {
        writer.WriteStartElement(TEXTBOX_ELEMENT); //<Textbox>
        writer.WriteAttributeString(NAME_PROPERTY, name);

        AppendString(writer, CANGROW_ELEMENT, bool.TrueString.ToLower()); //<CanGrow/>
        AppendString(writer, KEEPTOGETHER_ELEMENT, bool.TrueString.ToLower()); //<KeepTogether/>

        writer.WriteStartElement(PARAGRAPHS_ELEMENT); //<Paragraphs>
        writer.WriteStartElement(PARAGRAPH_ELEMENT); //<Paragraph>
        writer.WriteStartElement(TEXTRUNS_ELEMENT); //<TextRuns>
        writer.WriteStartElement(TEXTRUN_ELEMENT); //<TextRun>

        AppendString(writer, VALUE_ELEMENT, expression); //<Value/>

        AppendTextRunStyle(writer, style);

        writer.WriteEndElement(); //</TextRun>
        writer.WriteEndElement(); //</TextRuns>

        AppendParagraphStyle(writer, style);

        writer.WriteEndElement(); //</Paragraph>
        writer.WriteEndElement(); //</Paragraphs>

        if (rectangle != null)
        {
            AppendString(writer, TOP_ELEMENT, string.Format("{0}cm", rectangle.Top)); //<Top/>
            AppendString(writer, LEFT_ELEMENT, string.Format("{0}cm", rectangle.Left)); //<Left/>
            AppendString(writer, WIDTH_ELEMENT, string.Format("{0}cm", rectangle.Width)); //<Width/>
            AppendString(writer, HEIGHT_ELEMENT, string.Format("{0}cm", rectangle.Height)); //<Height/>
        }

        AppendString(writer, RD_PREFIX, DEFAULT_NAME, RD_URI, name); //<rd:DefaultName/>

        AppendTextBoxStyle(writer, style);

        writer.WriteEndElement(); //</Textbox>
    }