This repository was archived by the owner on May 29, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathMarkdownViewerHtmlPanel.cs
More file actions
67 lines (63 loc) · 1.79 KB
/
Copy pathMarkdownViewerHtmlPanel.cs
File metadata and controls
67 lines (63 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using TheArtOfDev.HtmlRenderer.WinForms;
/// <summary>
///
/// </summary>
namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
{
/// <summary>
///
/// </summary>
public class MarkdownViewerHtmlPanel : HtmlPanel
{
/// <summary>
///
/// </summary>
public MarkdownViewerHtmlPanel()
{
this.AllowDrop = false;
this.Dock = System.Windows.Forms.DockStyle.Fill;
this.IsContextMenuEnabled = false;
this.Location = new System.Drawing.Point(0, 24);
this.MinimumSize = new System.Drawing.Size(20, 20);
this.Name = "markdownViewerHtmlPanel";
this.Size = new System.Drawing.Size(284, 237);
this.TabIndex = 0;
this.AvoidImagesLateLoading = false;
}
/// <summary>
///
/// </summary>
public override string Text {
get { return _text; }
set {
_text = value;
if (!IsDisposed)
{
_htmlContainer.SetHtml(_text, _baseCssData);
Redraw();
}
}
}
/// <summary>
/// Scroll by the given ratio, calculated with max and page
/// </summary>
/// <param name="scrollRatio"></param>
public void ScrollByRatioVertically(double scrollRatio)
{
if (!IsDisposed)
{
VerticalScroll.Value = (int)((VerticalScroll.Maximum - VerticalScroll.LargeChange) * scrollRatio);
Redraw();
}
}
/// <summary>
///
/// </summary>
protected void Redraw()
{
PerformLayout();
Invalidate();
InvokeMouseMove();
}
}
}