private static void Button_Click(PointerPoint point) { // START DEBUG Statics.DebugButtonClickCount++; // END DEBUG if (textbox.Text != null) { string text = textbox.Text.Trim(); if (text != string.Empty) { textblock.Append(Canvas.Device, text); } textbox.Text = string.Empty; ControlInFocus = textbox; textbox.GiveFocus(); } }
public static void Initialize(CanvasAnimatedControl sender) { Canvas = sender; Vector2 textboxPosition = new Vector2(20, (float)sender.Size.Height - 50); textbox = new win2d_Textbox(sender.Device, textboxPosition, 600); button = new win2d_Button(sender.Device, new Vector2(textboxPosition.X + textbox.Width + 20, textboxPosition.Y), 100, textbox.Height, "Test button!"); button.Click += Button_Click; textblock = new win2d_Textblock(new Vector2(20, 20), textbox.Width + 20 + button.Width, (int)sender.Size.Height - textbox.Height - 40, true); // START DEBUG for (int i = 100; i < 200; i++) { StringBuilder s = new StringBuilder(); s.Append(i.ToString()); for (int j = 0; j < 29; j++) { s.Append(" "); s.Append(i.ToString()); } textblock.Append(sender.Device, s.ToString()); } // END DEBUG scrollbar = new win2d_ScrollBar(new Vector2(textblock.Position.X + textblock.Width, textblock.Position.Y), 20, textblock.Height); scrollbar.ScrollUp += Scrollbar_ScrollUp; scrollbar.ScrollDown += Scrollbar_ScrollDown; scrollbar.ScrollToTop += Scrollbar_ScrollToTop; scrollbar.ScrollToBottom += Scrollbar_ScrollToBottom; Controls.Add(textbox); Controls.Add(button); Controls.Add(textblock); Controls.Add(scrollbar); }