/// <summary> /// Do not instantiate any widgets directly. Use SdkTrayManager. /// </summary> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> public CheckBox(String name, String caption, Real width) { this.IsCursorOver = false; this.isFitToContents = width <= 0; element = OverlayManager.Instance.Elements.CreateElementFromTemplate("SdkTrays/CheckBox", "BorderPanel", name); var c = (OverlayElementContainer)element; this.textArea = (TextArea)c.Children[Name + "/CheckBoxCaption"]; this.square = (BorderPanel)c.Children[Name + "/CheckBoxSquare"]; this.x = this.square.Children[this.square.Name + "/CheckBoxX"]; this.x.Hide(); element.Width = width; Caption = caption; }
public FormMain() { InitializeComponent(); this.Text = string.Format("{0} uninstaller", AppInfo.Name); _config = new InstallConfig(); _navigator = new Navigator(this); _pages = new UserControl[3]; _pages[0] = new Pages.PageUninstall(panelMain, _config, _navigator); _currentNavBorderPanel = borderPanelStepOne; _currentPage = _pages[0]; FocusStep(borderPanelStepOne, _pages[0]); }
/// <summary> /// Do not instantiate any widgets directly. Use SdkTrayManager. /// </summary> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <param name="boxWidth"></param> /// <param name="maxItemsShown"></param> public SelectMenu(String name, String caption, Real width, Real boxWidth, int maxItemsShown) { this.items = new List <string>(); this.itemElements = new List <BorderPanel>(); this.sectionIndex = -1; this.isFitToContents = false; this.IsCursorOver = false; this.isExpanded = false; this.isDragging = false; this.maxItemsShown = maxItemsShown; this.itemsShown = 0; element = (BorderPanel) OverlayManager.Instance.Elements.CreateElementFromTemplate("SdkTrays/SelectMenu", "BorderPanel", name); this.textArea = (TextArea)((OverlayElementContainer)element).Children[name + "/MenuCaption"]; this.smallBox = (BorderPanel)((OverlayElementContainer)element).Children[name + "/MenuSmallBox"]; this.smallBox.Width = width - 10; this.smallTextArea = (TextArea)this.smallBox.Children[name + "/MenuSmallBox/MenuSmallText"]; element.Width = width; if (boxWidth > 0) // long style { if (width <= 0) { this.isFitToContents = true; } this.smallBox.Width = boxWidth; this.smallBox.Top = 2; this.smallBox.Left = width - boxWidth - 5; element.Height = this.smallBox.Height + 4; this.textArea.HorizontalAlignment = HorizontalAlignment.Left; this.textArea.TextAlign = HorizontalAlignment.Left; this.textArea.Left = 12; this.textArea.Top = 10; } this.expandedBox = (BorderPanel)((OverlayElementContainer)element).Children[name + "/MenuExpandedBox"]; this.expandedBox.Width = this.smallBox.Width + 10; this.expandedBox.Hide(); this.scrollTrack = (BorderPanel)this.expandedBox.Children[this.expandedBox.Name + "/MenuScrollTrack"]; this.scrollHandle = (Panel)this.scrollTrack.Children[this.scrollTrack.Name + "/MenuScrollHandle"]; Caption = caption; }
/// <summary> /// Creates a new instance of <see cref="Button" /> /// </summary> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <remarks> /// Do not instantiate any widgets directly. Use SdkTrayManager. /// </remarks> public Button(String name, String caption, Real width) { element = OverlayManager.Instance.Elements.CreateElementFromTemplate("SdkTrays/Button", "BorderPanel", name); this.BorderPanel = (BorderPanel)element; this.TextArea = (TextArea)this.BorderPanel.Children[this.BorderPanel.Name + "/ButtonCaption"]; this.TextArea.Top = -(this.TextArea.CharHeight / 2); // if (width > 0) { element.Width = width; this.isFitToContents = false; } else { this.isFitToContents = true; } Caption = caption; State = ButtonState.Up; }
/// <summary> /// Do not instantiate any widgets directly. Use SdkTrayManager. /// </summary> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <param name="trackWidth"></param> /// <param name="valueBoxWidth"></param> /// <param name="minValue"></param> /// <param name="maxValue"></param> /// <param name="snaps"></param> public Slider(String name, String caption, Real width, Real trackWidth, Real valueBoxWidth, Real minValue, Real maxValue, int snaps) { this.isDragging = false; this.isFitToContents = false; element = OverlayManager.Instance.Elements.CreateElementFromTemplate("SdkTrays/Slider", "BorderPanel", name); element.Width = width; var c = (OverlayElementContainer)element; this.textArea = (TextArea)c.Children[Name + "/SliderCaption"]; var valueBox = (OverlayElementContainer)c.Children[Name + "/SliderValueBox"]; valueBox.Width = valueBoxWidth; valueBox.Left = -(valueBoxWidth + 5); this.valueTextArea = (TextArea)valueBox.Children[valueBox.Name + "/SliderValueText"]; this.track = (BorderPanel)c.Children[Name + "/SliderTrack"]; this.handle = (Panel)this.track.Children[this.track.Name + "/SliderHandle"]; if (trackWidth <= 0) // tall style { this.track.Width = width - 16; } else // long style { if (width <= 0) { this.isFitToContents = true; } element.Height = 34; this.textArea.Top = 10; valueBox.Top = 2; this.track.Top = -23; this.track.Width = trackWidth; this.track.HorizontalAlignment = HorizontalAlignment.Right; this.track.Left = -(trackWidth + valueBoxWidth + 5); } Caption = caption; SetRange(minValue, maxValue, snaps, false); }
private void FocusUnfocusStep(BorderPanel panelNav, UserControl page) { if (page == _currentPage) { return; } panelMain.SuspendLayout(); flowLayoutPanelNav.SuspendLayout(); try { FocusStep(panelNav, page); UnfocusPreviousStep(); _currentNavBorderPanel = panelNav; _currentPage = page; } finally { panelMain.ResumeLayout(true); flowLayoutPanelNav.ResumeLayout(true); } }
/// <summary> /// Do not instantiate any widgets directly. Use SdkTrayManager. /// </summary> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <param name="height"></param> public TextBox(String name, String caption, Real width, Real height) { this.lines = new List <string>(); element = OverlayManager.Instance.Elements.CreateElementFromTemplate("SdkTrays/TextBox", "BorderPanel", name); element.Width = width; element.Height = height; var container = (OverlayElementContainer)element; this.textArea = (TextArea)container.Children[Name + "/TextBoxText"]; this.captionBar = (BorderPanel)container.Children[Name + "/TextBoxCaptionBar"]; this.captionBar.Width = width - 4; this.captionTextArea = (TextArea)this.captionBar.Children[this.captionBar.Name + "/TextBoxCaption"]; Caption = caption; this.scrollTrack = (BorderPanel)container.Children[Name + "/TextBoxScrollTrack"]; this.scrollHandle = (Panel)this.scrollTrack.Children[this.scrollTrack.Name + "/TextBoxScrollHandle"]; this.scrollHandle.Hide(); this.isDragging = false; this.scrollPercentage = 0; this.startingLine = 0; this.padding = 15; this.text = ""; RefitContents(); }
private void SetPanelStyle(VisualStyle style) { if (style != null) { if (style.Width != 0) { BorderPanel.Width = style.Width; } else { BorderPanel.ClearValue(WidthProperty); } if (style.Height != 0) { BorderPanel.Height = style.Height; } else { BorderPanel.ClearValue(HeightProperty); } BorderPanel.Background = new SolidColorBrush(style.BackColor); } }
void ScoreObject_OnPropertyChanged(object sender, PropertyChangedEventArgs e) { ScoreItem scoreItem = ScoreGroup; if (scoreItem != null) { VisualStyle style = scoreItem.TitleStyle; if (style != null) { LbTitle.Foreground = new SolidColorBrush(style.ForeColor); BorderTitle.Background = new SolidColorBrush(style.BackColor); if (style.FontFamily != null) { LbTitle.FontFamily = style.FontFamily; } if (style.FontSize != 0) { LbTitle.FontSize = style.FontSize; } LbTitle.FontWeight = style.FontWeight; } style = scoreItem.PanelStyle; if (style != null) { if (style.Width != 0) { BorderPanel.Width = style.Width; } else { BorderPanel.ClearValue(WidthProperty); } BorderPanel.Background = new SolidColorBrush(style.BackColor); } } }
private void FocusStep(BorderPanel panelNav, UserControl page) { page.Show(); panelNav.BorderColor = Color.FromArgb(51, 153, 255); panelNav.LeftBorderWidth = 5; }
public override void Initialize() { _menu = new Menu(); var menuButton1 = new MenuItemButton <object>() { Text = "Menu 1", }; menuButton1.AddChild(new MenuItemButton <object>() { Text = "Submenu 1.1" }); _menu.AddChild(menuButton1); var menuButton2 = new MenuItemButton <object>() { Text = "Menu 2", }; menuButton2.AddChild(new MenuItemButton <object>() { Text = "Submenu 2.1" }); menuButton2.AddChild(new MenuItemButton <object>() { Text = "Submenu 2.2" }); _menu.AddChild(menuButton2); Menu = _menu; _checkbox1 = new Checkbox { Location = new Point { Left = 3, Top = 5 }, Text = "Checkbox tentative" }; _checkbox1.CheckedChanged += checkbox1_CheckedChanged; RootPanel.AddChild(_checkbox1); _checkbox2 = new Checkbox { Location = new Point { Left = 3, Top = 7 }, IsChecked = true, Text = "Checkbox checked" }; RootPanel.AddChild(_checkbox2); _checkbox3 = new Checkbox { Location = new Point { Left = 3, Top = 9 }, IsChecked = false, Text = "Checkbox unchecked" }; RootPanel.AddChild(_checkbox3); _checkbox4 = new Checkbox { Location = new Point { Left = 3, Top = 11 }, IsChecked = false, Text = "Checkbox disabled", IsEnabled = false }; RootPanel.AddChild(_checkbox4); _label1 = new Label { Location = new Point { Left = 3, Top = 19 }, Text = "Label" }; RootPanel.AddChild(_label1); _radioButton1 = new RadioButton { Location = new Point { Left = 3, Top = 13 }, Text = "Radio unchecked" }; RootPanel.AddChild(_radioButton1); _radioButton2 = new RadioButton { Location = new Point { Left = 3, Top = 15 }, Text = "Radio checked", IsChecked = true }; RootPanel.AddChild(_radioButton2); _radioButton3 = new RadioButton { Location = new Point { Left = 3, Top = 17 }, Text = "Radio checked", IsChecked = true, IsEnabled = false }; RootPanel.AddChild(_radioButton3); _textBox1 = new TextBox { Location = new Point { Left = 29, Top = 16 } }; _textBox1.TextChanged += textBox1_TextChanged; RootPanel.AddChild(_textBox1); _dateTimeBox1 = new DateTimeBox() { Location = new Point { Left = 29, Top = 18 } }; RootPanel.AddChild(_dateTimeBox1); _numericBox1 = new NumericBox() { Location = new Point { Left = 29, Top = 20 } }; RootPanel.AddChild(_numericBox1); _button1 = new Button { Location = new Point { Left = 3, Top = 22 }, Width = 10 }; _button1.Pressed += button1_Pressed; RootPanel.AddChild(_button1); _button2 = new Button { Location = new Point { Left = 16, Top = 22 }, Width = 10, IsEnabled = false, Text = "Disabled button" }; _button2.Pressed += button2_Pressed; RootPanel.AddChild(_button2); _progressBar1 = new ProgressBar { Location = new Point { Left = 3, Top = 3 }, Width = 74, TextAligment = TitleAligment.Left }; RootPanel.AddChild(_progressBar1); _bnext1 = new Button { Location = new Point { Left = 40, Top = 22 }, Width = 10, Text = "Next 1", Tag = 1 }; _bnext1.Pressed += bNextPressed; RootPanel.AddChild(_bnext1); _bnext2 = new Button { Location = new Point { Left = 51, Top = 22 }, Width = 10, Text = "Next 2", Tag = 2 }; _bnext2.Pressed += bNextPressed; RootPanel.AddChild(_bnext2); _bnext3 = new Button { Location = new Point { Left = 62, Top = 22 }, Width = 10, Text = "Next 3", Tag = 3 }; _bnext3.Pressed += bNextPressed; RootPanel.AddChild(_bnext3); _panel1 = new BorderPanel { Location = new Point { Left = 28, Top = 4 }, Size = new Size { Height = 7, Width = 25 } }; RootPanel.AddChild(_panel1); var subRadiobuton1 = new RadioButton { Location = new Point { Left = 1, Top = 1 } }; _panel1.AddChild(subRadiobuton1); var subRadiobuton2 = new RadioButton { Location = new Point { Left = 1, Top = 3 } }; _panel1.AddChild(subRadiobuton2); var subRadiobuton3 = new RadioButton { Location = new Point { Left = 1, Top = 5 } }; _panel1.AddChild(subRadiobuton3); _comboBox1 = new ComboBox { Location = new Point { Left = 29, Top = 12 }, VisibleItemsCount = 7 }; _comboBox1.Items.AddRange(new[] { new ComboBoxItem() { Key = 1, Text = "EntityFX" }, new ComboBoxItem() { Key = 2, Text = "Green.Dragon" }, new ComboBoxItem() { Key = 3, Text = "Guzalianna" }, new ComboBoxItem() { Key = 4, Text = "Prozz" }, new ComboBoxItem() { Key = 5, Text = "Aik2029" }, new ComboBoxItem() { Key = 6, Text = "Zombie" }, new ComboBoxItem() { Key = 7, Text = "Wesker" }, new ComboBoxItem() { Key = 8, Text = "Perez" }, new ComboBoxItem() { Key = 9, Text = "Chuvak" }, new ComboBoxItem() { Key = 10, Text = "Magistr" }, new ComboBoxItem() { Key = 11, Text = "Mad" }, new ComboBoxItem() { Key = 12, Text = "XOBAH" } }); RootPanel.AddChild(_comboBox1); RootPanel.AddChild(new Checkbox { Location = new Point { Left = 29, Top = 14 }, Text = "Checkbox for overlapp" }); _image = Image.FromString( @"───▄▄▄ ─▄▀░▄░▀▄ ─█░█▄▀░█ ─█░▀▄▄▀█▄█▄▀ ▄▄█▄▄▄▄███▀ "); _image.Location = new Point() { Left = 55, Top = 4 }; RootPanel.AddChild(_image); _plotChart = new PlotChart() { Size = new Size() { Height = 10, Width = 30 }, Location = new Point() { Left = 48, Top = 11 }, PlotSymbol = ':' }; _plotChart.Points = GenerateSinChartPoints(_plotChart.Size, 7); RootPanel.AddChild(_plotChart); StatusStrip = new StatusStrip(); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 1" }); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 2" }); _timeStripItem = new StatusStripLabel { Text = "Item 3", ItemLocation = ItemLocationEnum.Right }; StatusStrip.AddChild(_timeStripItem); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 4", ItemLocation = ItemLocationEnum.Right }); StatusStrip.AddChild(new StatusStripButton { Text = "But 1", ItemLocation = ItemLocationEnum.Left }); StatusStrip.AddChild(new StatusStripButton { Text = "But 2", ItemLocation = ItemLocationEnum.Left }); _statusStripProgressBar = new StatusStripProgressBar { Text = "P: {0}", Width = 14, Minimum = 0, Value = 16, Maximum = 25 }; StatusStrip.AddChild(_statusStripProgressBar); Initializetable(); _timer.Elapsed += timer_Elapsed; _timer.Start(); _timer2.Elapsed += _timer2_Elapsed; _timer2.Start(); }
protected override void Initialize() { _checkbox1 = new Checkbox { Location = new Point { Left = 3, Top = 4 }, Text = "Checkbox tentative" }; _checkbox1.CheckedChanged += checkbox1_CheckedChanged; RootPanel.AddChild(_checkbox1); _checkbox2 = new Checkbox { Location = new Point { Left = 3, Top = 6 }, IsChecked = true, Text = "Checkbox checked" }; RootPanel.AddChild(_checkbox2); _checkbox3 = new Checkbox { Location = new Point { Left = 3, Top = 8 }, IsChecked = false, Text = "Checkbox unchecked" }; RootPanel.AddChild(_checkbox3); _checkbox4 = new Checkbox { Location = new Point { Left = 3, Top = 10 }, IsChecked = false, Text = "Checkbox disabled", IsEnabled = false }; RootPanel.AddChild(_checkbox4); _label1 = new Label { Location = new Point { Left = 3, Top = 12 }, Text = "Label" }; RootPanel.AddChild(_label1); _radioButton1 = new RadioButton { Location = new Point { Left = 3, Top = 14 }, Text = "Radio unchecked" }; RootPanel.AddChild(_radioButton1); _radioButton2 = new RadioButton { Location = new Point { Left = 3, Top = 16 }, Text = "Radio checked", IsChecked = true }; RootPanel.AddChild(_radioButton2); _radioButton3 = new RadioButton { Location = new Point { Left = 3, Top = 18 }, Text = "Radio checked", IsChecked = true, IsEnabled = false }; RootPanel.AddChild(_radioButton3); _textBox1 = new TextBox { Location = new Point { Left = 3, Top = 20 } }; _textBox1.TextChanged += textBox1_TextChanged; RootPanel.AddChild(_textBox1); _button1 = new Button { Location = new Point { Left = 3, Top = 22 }, Width = 10 }; _button1.Pressed += button1_Pressed; RootPanel.AddChild(_button1); _button2 = new Button { Location = new Point { Left = 16, Top = 22 }, Width = 10, IsEnabled = false, Text = "Disabled button" }; _button2.Pressed += button2_Pressed; RootPanel.AddChild(_button2); _progressBar1 = new ProgressBar { Location = new Point { Left = 3, Top = 2 }, Width = 74 }; RootPanel.AddChild(_progressBar1); _bnext1 = new Button { Location = new Point { Left = 40, Top = 22 }, Width = 10, Text = "Next 1", Tag = 1 }; _bnext1.Pressed += bNextPressed; RootPanel.AddChild(_bnext1); _bnext2 = new Button { Location = new Point { Left = 51, Top = 22 }, Width = 10, Text = "Next 2", Tag = 2 }; _bnext2.Pressed += bNextPressed; RootPanel.AddChild(_bnext2); _bnext3 = new Button { Location = new Point { Left = 62, Top = 22 }, Width = 10, Text = "Next 3", Tag = 3 }; _bnext3.Pressed += bNextPressed; RootPanel.AddChild(_bnext3); _panel1 = new BorderPanel { Location = new Point { Left = 28, Top = 3 }, Size = new Size { Height = 7, Width = 25 } }; RootPanel.AddChild(_panel1); var subRadiobuton1 = new RadioButton { Location = new Point { Left = 1, Top = 1 } }; _panel1.AddChild(subRadiobuton1); var subRadiobuton2 = new RadioButton { Location = new Point { Left = 1, Top = 3 } }; _panel1.AddChild(subRadiobuton2); var subRadiobuton3 = new RadioButton { Location = new Point { Left = 1, Top = 5 } }; _panel1.AddChild(subRadiobuton3); _comboBox1 = new ComboBox { Location = new Point {Left = 29, Top = 12}, VisibleItemsCount = 7 }; _comboBox1.Items.AddRange(new[] { "EntityFX", "Green.Dragon", "Guzalianna", "Prozz", "Aik2029", "Zombie", "Wesker", "Perez", "Chuvak", "Magistr", "Mad", "XOBAH", }); RootPanel.AddChild(_comboBox1); RootPanel.AddChild(new Checkbox { Location = new Point { Left = 29, Top = 14 }, Text = "Checkbox for overlapp" }); RootPanel.AddChild(new BorderPanel { Location = new Point { Left = 29, Top = 16 }, Size = new Size {Width = 15, Height = 3} }); StatusStrip = new StatusStrip(); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 1" }); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 2" }); _timeStripItem = new StatusStripLabel { Text = "Item 3", ItemLocation = StatusStripItemLocationEnum.Right }; StatusStrip.AddChild(_timeStripItem); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 4", ItemLocation = StatusStripItemLocationEnum.Right }); StatusStrip.AddChild(new StatusStripButton { Text = "But 1", ItemLocation = StatusStripItemLocationEnum.Left }); StatusStrip.AddChild(new StatusStripButton { Text = "But 2", ItemLocation = StatusStripItemLocationEnum.Left }); _statusStripProgressBar = new StatusStripProgressBar { Text = "P: {0}", Width = 14, Minimum = 0, Value = 16, Maximum = 25 }; StatusStrip.AddChild(_statusStripProgressBar); Initializetable(); _timer.Elapsed += timer_Elapsed; _timer.Start(); _timer2.Elapsed += _timer2_Elapsed; _timer2.Start(); }
public static void ApplyTheme(Control c) { foreach (var control in c.Controls) { var ctrl = ((Control)control); if (ctrl.Tag is string && (string)ctrl.Tag == "notheme") { continue; } if (ctrl is Button) { ApplyButtonTheme((Button)ctrl); continue; } if (ctrl is ComboBox) { ApplyComboBoxTheme((ComboBox)ctrl); continue; } if (ctrl is GroupBox) { ApplyGroupBoxTheme((GroupBox)ctrl); } try { ctrl.BackColor = ThemeConstants.BackgroundColor; ctrl.ForeColor = Color.White; } catch (Exception e) { Debug.WriteLine("PECK >> " + e.Message + "\n" + e.ToString()); } if (ctrl is TextBox && !(ctrl.Parent is BorderPanel)) { ctrl.BackColor = ThemeConstants.BackgroundColor; ctrl.ForeColor = ThemeConstants.ForegroundColor; BorderPanel.EatControl(ctrl); } if (ctrl is Panel && !(ctrl is BorderPanel)) { ((Panel)ctrl).BorderStyle = BorderStyle.FixedSingle; } if (ctrl is TabControl) { foreach (var tab in ((TabControl)ctrl).TabPages) { ((TabPage)tab).BackColor = ThemeConstants.BackgroundColor; ((TabPage)tab).ForeColor = ThemeConstants.ForegroundColor; } } if (ctrl.Controls.Count > 0) { ApplyTheme(ctrl); } } }