Skip to content

Commit

Permalink
add custom richtextbox
Browse files Browse the repository at this point in the history
this control automatically scrolls when text is appended to it
  • Loading branch information
murrty authored Dec 17, 2021
1 parent ed3b101 commit a54a903
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion youtube-dl-gui/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@
<value>2.263</value>
</setting>
<setting name="LastDebugDate" serializeAs="String">
<value>2021-11-25</value>
<value>2021-12-17</value>
</setting>
<setting name="IsBetaVersion" serializeAs="String">
<value>True</value>
Expand Down
18 changes: 18 additions & 0 deletions youtube-dl-gui/Controls/ExtendedRichTextBox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Windows.Forms;

namespace youtube_dl_gui.Controls {
class ExtendedRichTextBox : RichTextBox {
public const int WM_VSCROLL = 277;
public const int SB_PAGEBOTTOM = 7;

/// <summary>
/// Appends text to the rich text box, scrolling to the bottom when necessary.
/// </summary>
/// <param name="text">Text to append.</param>
public new void AppendText(string text) {
this.Text += text;
NativeMethods.SendMessage(this.Handle, WM_VSCROLL, (IntPtr)SB_PAGEBOTTOM, IntPtr.Zero);
}
}
}
4 changes: 2 additions & 2 deletions youtube-dl-gui/Forms/frmConverter.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions youtube-dl-gui/Forms/frmDownloader.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion youtube-dl-gui/Forms/frmException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void loadLanguage() {
}

public static string GetRelevantInformation() {
string NewRelevantInfo = "Lanugage: {0}\n Current Culture: {1}\nOS: {2}";
string NewRelevantInfo = "Current version: {0}\nCurrent culture: {1}\nOS: {2}\n";

if (Properties.Settings.Default.IsBetaVersion) {
return string.Format(NewRelevantInfo,
Expand Down
2 changes: 1 addition & 1 deletion youtube-dl-gui/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion youtube-dl-gui/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="LastDebugDate" Type="System.String" Scope="Application">
<Value Profile="(Default)">2021-11-25</Value>
<Value Profile="(Default)">2021-12-17</Value>
</Setting>
<Setting Name="SkippedVersion" Type="System.Decimal" Scope="User">
<Value Profile="(Default)">-1</Value>
Expand Down
3 changes: 3 additions & 0 deletions youtube-dl-gui/youtube-dl-gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
<Compile Include="Classes\NativeMethods.cs" />
<Compile Include="Classes\UpdateChecker.cs" />
<Compile Include="Classes\ErrorLog.cs" />
<Compile Include="Controls\ExtendedRichTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\ExtendedTextBox.cs">
<SubType>Component</SubType>
</Compile>
Expand Down

0 comments on commit a54a903

Please sign in to comment.