public UiEncodingMainCharacterControl() { Orientation = Orientation.Horizontal; VerticalAlignment = VerticalAlignment.Center; #region Construct _indexLabel = UiTextBlockFactory.Create("#"); { _indexLabel.Margin = new Thickness(5); _indexLabel.VerticalAlignment = VerticalAlignment.Center; Children.Add(_indexLabel); } _ox = AddUiElement(new UiEncodingLabeledNumber("OX:", 60, 0, short.MaxValue, OXChanged)); _oy = AddUiElement(new UiEncodingLabeledNumber("OY:", 60, 0, short.MaxValue, OYChanged)); _before = AddUiElement(new UiEncodingLabeledNumber(Lang.EncodingEditor.Main.Before, 50, sbyte.MinValue, sbyte.MaxValue, BeforeChanged)); _width = AddUiElement(new UiEncodingLabeledNumber(Lang.EncodingEditor.Main.Width, 50, 0, sbyte.MaxValue, WidthChanged)); _after = AddUiElement(new UiEncodingLabeledNumber(Lang.EncodingEditor.Main.After, 50, sbyte.MinValue, sbyte.MaxValue, AfterChanged)); _output = AddUiElement(new UiEncodingLabeledWatermark(Lang.EncodingEditor.Main.ToText, "0x31->\"1\"", 50, OnOutputTextChanged)); _input = AddUiElement(new UiEncodingLabeledWatermark(Lang.EncodingEditor.Main.FromText, "0x31<-\"1\"", 70, OnInputTextChanged)); #endregion }
public UiEncodingWindow() { #region Construct WindowStartupLocation = WindowStartupLocation.CenterScreen; ResizeMode = ResizeMode.CanMinimize; Width = 1024; Height = 768; UiGrid root = UiGridFactory.Create(4, 1); { root.RowDefinitions[0].Height = GridLength.Auto; root.RowDefinitions[2].Height = GridLength.Auto; root.RowDefinitions[3].Height = GridLength.Auto; _comboBox = UiComboBoxFactory.Create(); { _comboBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; _comboBox.Margin = new Thickness(3); _comboBox.DisplayMemberPath = "DisplayName"; _comboBox.SelectionChanged += OnComboBoxItemChanged; root.AddUiElement(_comboBox, 0, 0); } _editViewport = new UiDxViewport(); { _editViewport.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; _editViewport.VerticalAlignment = VerticalAlignment.Stretch; _editViewport.DrawSprites += OnEditViewportDrawSprites; _editViewport.DrawPrimitives += OnEditViewportDrawPrimitives; _editViewport.DxControl.Control.MouseDown += OnDxControlElementMouseDown; _editViewport.DxControl.Control.MouseUp += OnDxControlElementMouseUp; _editViewport.DxControl.Control.MouseMove += OnDxControlElementMouseMove; root.AddUiElement(_editViewport, 1, 0); } UiGrid previewGroup = UiGridFactory.Create(2, 2); { previewGroup.RowDefinitions[0].Height = GridLength.Auto; previewGroup.ColumnDefinitions[1].Width = GridLength.Auto; _previewViewport = new UiDxViewport(); { _previewViewport.Height = 200; _previewViewport.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; _previewViewport.VerticalAlignment = VerticalAlignment.Stretch; _previewViewport.DrawSprites += OnPreviewViewportDraw; _previewViewport.DxControl.RenderContainer.BackBuffer.BackgroundColor = Colors.Black; previewGroup.AddUiElement(_previewViewport, 0, 0, 2); } UiEncodingLabeledNumber scale = new UiEncodingLabeledNumber("Масштаб:", 200, 100, 400, OnScaleValueChanged); { scale.Value = 100; scale.NumberControl.Increment = 25; previewGroup.AddUiElement(scale, 0, 1); } UiTextBox textBox = UiTextBoxFactory.Create(); { textBox.Text = _previewText; textBox.TextChanged += OnPreviewTextChanged; previewGroup.AddUiElement(textBox, 1, 1); } root.AddUiElement(previewGroup, 2, 0); } _charactersControl = new UiEncodingCharactersControl(); { root.AddUiElement(_charactersControl, 3, 0); } UiButton button = UiButtonFactory.Create("OK"); { button.Width = 70; button.Margin = new Thickness(3); button.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; button.Click += (s, a) => DialogResult = true; root.AddUiElement(button, 3, 0); } } Content = root; _editViewport.DxControl.RenderContainer.Reseted += ResetBurshes; ResetBurshes(_editViewport.DxControl.RenderContainer); Thread movingThread = new Thread(MovingThread); movingThread.Start(); Activated += OnWindowActivated; Closing += (s, e) => ClosingEvent.Set(); Closing += OnWindowClosing; #endregion }
public UiEncodingWindow() { #region Construct WindowStartupLocation = WindowStartupLocation.CenterScreen; ResizeMode = ResizeMode.CanMinimize; Width = 1024; Height = 768; UiGrid root = UiGridFactory.Create(4, 1); { root.RowDefinitions[0].Height = GridLength.Auto; root.RowDefinitions[2].Height = GridLength.Auto; root.RowDefinitions[3].Height = GridLength.Auto; _comboBox = UiComboBoxFactory.Create(); { _comboBox.HorizontalAlignment = HorizontalAlignment.Stretch; _comboBox.Margin = new Thickness(3); _comboBox.DisplayMemberPath = "DisplayName"; _comboBox.SelectionChanged += OnComboBoxItemChanged; root.AddUiElement(_comboBox, 0, 0); } _glControlViewer = UiScrollViewerFactory.Create(); { _glControlViewer.HorizontalAlignment = HorizontalAlignment.Left; _glControlViewer.VerticalAlignment = VerticalAlignment.Top; _glControlViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible; _glControlViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; _glEditControl = new UiScrollableGlControl(); { _glEditControl.ClipToBounds = true; _glEditControl.Control.Load += OnGLControlElementLoaded; _glEditControl.Control.Resize += OnGLControlElementResize; _glEditControl.Control.MouseDown += OnGLControlElementMouseDown; _glEditControl.Control.MouseUp += OnGLControlElementMouseUp; _glEditControl.Control.MouseMove += OnGLControlElementMouseMove; _glControlViewer.Content = _glEditControl; } root.AddUiElement(_glControlViewer, 1, 0); } UiGrid previewGroup = UiGridFactory.Create(2, 2); { previewGroup.RowDefinitions[0].Height = GridLength.Auto; previewGroup.ColumnDefinitions[1].Width = GridLength.Auto; _glPreviewViewer = UiScrollViewerFactory.Create(); { _glPreviewViewer.Height = 200; _glPreviewViewer.HorizontalAlignment = HorizontalAlignment.Left; _glPreviewViewer.VerticalAlignment = VerticalAlignment.Top; _glPreviewViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible; _glPreviewViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; _glPreviewControl = new UiScrollableGlControl(); { _glPreviewControl.ClipToBounds = true; _glPreviewControl.Control.Load += OnGLControlElementLoaded; _glPreviewControl.Control.Resize += OnGLControlElementResize; _glPreviewViewer.Content = _glPreviewControl; } previewGroup.AddUiElement(_glPreviewViewer, 0, 0, 2); UiEncodingLabeledNumber scale = new UiEncodingLabeledNumber("Масштаб:", 200, 100, 400, OnScaleValueChanged); { scale.Value = 100; previewGroup.AddUiElement(scale, 0, 1); } UiTextBox textBox = UiTextBoxFactory.Create(); { textBox.Text = _previewText; textBox.TextChanged += OnPreviewTextChanged; previewGroup.AddUiElement(textBox, 1, 1); } } root.AddUiElement(previewGroup, 2, 0); } _charactersControl = new UiEncodingCharactersControl(); { root.AddUiElement(_charactersControl, 3, 0); } UiButton button = UiButtonFactory.Create("OK"); { button.Width = 70; button.Margin = new Thickness(3); button.HorizontalAlignment = HorizontalAlignment.Right; button.Click += (s, a) => DialogResult = true; root.AddUiElement(button, 3, 0); } } Content = root; Thread movingThread = new Thread(MovingThread); movingThread.Start(); Closing += (s, e) => movingThread.Abort(); #endregion }