private void OnDxControlElementMouseDown(object sender, MouseEventArgs e) { if (_currentSource == null) { return; } int viewportX = _editViewport.X; int viewportY = _editViewport.Y; List <int> mainIndices = new List <int>(2); List <int> additionalIndices = new List <int>(2); WflContent info = _currentSource.Info; int height = info.Header.LineHeight; for (int i = 0; i < 256 * 2; i++) { if (i % 256 < 0x20) { continue; } int offsets = info.Offsets[i]; int sizes = info.Sizes[i]; int y = (offsets >> 16) & 0xFFFF; int oy = viewportY + e.Y - y; if (oy >= 0 && oy <= height) { int x = offsets & 0xFFFF; int width = (sizes & 0x0000FF00) >> 8; int ox = viewportX + e.X - x; if (ox >= 0 && ox <= width) { mainIndices.Add(i); _newMovable = 1; } } } int squareSize = info.Header.LineSpacing + info.Header.SquareDiff; short value = (short)(((viewportY + e.Y) / squareSize) << 8 | ((viewportX + e.X) / squareSize)); int index = Array.IndexOf(info.AdditionalTable, value); if (index >= 0) { additionalIndices.Add(index); } _charactersControl.SetCurrent(_currentSource, mainIndices, additionalIndices); if (mainIndices.Count > 0 || additionalIndices.Count > 0) { _editViewport.Refresh(); } }
private void OnScaleValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { _scale = (int)e.NewValue / 100f; _previewViewport.Refresh(); }