private void SetTextBoxHeight(TextFilePreviewOptions options) { var s = ""; for (int i = 0; i < options.NrOfTextRowsForTextPreview; i++) { s += "Å" + Environment.NewLine; } var a = TextRenderer.MeasureText(s, options.TextPreviewer.Font, new Size(10, 1024)); options.TextPreviewer.Height = a.Height + options.TextPreviewer.Padding.Top + options.TextPreviewer.Padding.Bottom + SystemInformation.VerticalScrollBarWidth + 5; }
public void ShowDisplay(string key, TextFilePreviewOptions options) { if (_currentlyLoading.Equals(key) && Visible) { return; } _currentOptions = options; _currentlyLoading = key; Visible = true; Loading(true); SetTextBoxHeight(options); Task.Run(() => ShowOrCreateDisplay(key, options)); }
private Image CreateDisplay(TextFilePreviewOptions options) { _currentOptions = options; var renderer = new TextDataVisualizer(options); renderer.TextColor = options.TextColor; renderer.WhiteSpaceColor = options.WhiteSpaceColor; renderer.Render(); var bitmap = GetBitmapFromSource(renderer.Bitmap); return(bitmap); }
public TextDataVisualizer(TextFilePreviewOptions options) { TextVisual = new DrawingVisual(); _postColoring = options.DateaWrapperService?.LogFileAnalyzer?.AnalyzerResults; _textView = options.DateaWrapperService; _bmpStride = (_bmpWidth * _pixelFormat.BitsPerPixel + 7) / 8; _bmpHeight = 0; _bmpWidth = options.PreviewImageWidth; _bmpPixels = null; _stride = _bmpStride; _width = _bmpWidth; _height = _bmpHeight; _pixels = null; _lineRatio = 1.0; }
private bool ShowOrCreateDisplay(string key, TextFilePreviewOptions options) { if (!_displays.ContainsKey(key)) { Image img = null; if (options.DateaWrapperService.Lines.Count != 0) { img = CreateDisplay(options); } _displays[key] = img; } Invoke(new Action(() => { ShowDisplay(_displays[key]); Loading(false); })); return(true); }