Created
December 11, 2017 01:12
-
-
Save MysteryDash/55423bbc434841caa66c0351cb655d21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Windows.Forms; | |
using System.Runtime.InteropServices; | |
class CueTextBox : TextBox | |
{ | |
private string _cue; | |
[Localizable(true)] | |
public string Cue | |
{ | |
get => _cue; | |
set | |
{ | |
_cue = value; | |
UpdateCue(); | |
} | |
} | |
[DllImport("user32.dll", CharSet = CharSet.Unicode)] | |
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, string lp); | |
private void UpdateCue() | |
{ | |
if (IsHandleCreated && _cue != null) | |
{ | |
SendMessage(Handle, 0x1501, (IntPtr)1, _cue); | |
} | |
} | |
protected override void OnHandleCreated(EventArgs e) | |
{ | |
base.OnHandleCreated(e); | |
UpdateCue(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment