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
| private const int WM_NCHITTEST = 0x84; | |
| private const int HTCAPTION = 2; | |
| private const int HTLEFT = 10, | |
| HTRIGHT = 11, | |
| HTTOP = 12, | |
| HTTOPLEFT = 13, | |
| HTTOPRIGHT = 14, | |
| HTBOTTOM = 15, | |
| HTBOTTOMLEFT = 16, | |
| HTBOTTOMRIGHT = 17; |
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
| private const int WM_NCHITTEST = 0x84; | |
| protected override void WndProc( ref Message msg ) | |
| { | |
| if( msg.Msg == WM_NCHITTEST ) | |
| { | |
| // A result of -1 sends mouse events to the underlying window | |
| msg.Result = (IntPtr)( -1 ); | |
| return; | |
| } |
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
| var workingArea = Screen.FromHandle( Handle ).WorkingArea; | |
| MaximizedBounds = new Rectangle( 0, 0, workingArea.Width, workingArea.Height ); | |
| WindowState = FormWindowState.Maximized; |
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
| // In addition to the code below, it is necessary to either: | |
| // 1 - Enable "Less secure app access" in Google Account -> Security | |
| // 2 - If using 2-Step Verification, go to Google Account -> Security -> Add passwords | |
| // then select app = Mail and device = Windows Computer to generate a password | |
| // An alternative to the above is to authorize access for the program as shown here: | |
| // https://developers.google.com/gmail/api/quickstart/dotnet | |
| using var msg = new MailMessage(); | |
| using var attachment = new Attachment( @"d:\icon.png" ); | |
| msg.From = new MailAddress( "[email protected]" ); |
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
| protected override bool ShowFocusCues | |
| { | |
| get | |
| { | |
| return false; | |
| } | |
| } |
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
| public const int GWL_STYLE = -16; | |
| public const int WS_HSCROLL = 0x00100000; | |
| public const int WS_VSCROLL = 0x00200000; | |
| [ DllImport( "user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto ) ] | |
| public static extern IntPtr GetWindowLong32( IntPtr hWnd, int nIndex ); | |
| [ DllImport( "user32.dll", EntryPoint = "GetWindowLongPtr", CharSet = CharSet.Auto ) ] | |
| public static extern IntPtr GetWindowLongPtr64( IntPtr hWnd, int nIndex ); |
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
| private const int TCM_FIRST = 0x1300; | |
| private const int TCM_SETPADDING = TCM_FIRST + 43; | |
| private const int PADDING_X = 24; | |
| private const int PADDING_Y = 2; | |
| protected override void WndProc( ref Message m ) | |
| { | |
| if( m.Msg == TCM_SETPADDING ) | |
| { |
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 SQLitePCL; | |
| public class Database | |
| { | |
| protected static SQLiteConnection _db; | |
| public BaseDb() | |
| { | |
| if( _db == null ) | |
| { |
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
| public class Example | |
| { | |
| public event EventHandler<string> PassString; | |
| public event EventHandler<( Keys key, int x, bool modified )> PassMultipleValues; | |
| private void NotifySubscribers() | |
| { | |
| PassString?.Invoke( this, "some text" ); | |
| PassMultipleValues?.Invoke( this, ( Keys.Up, 1, true ) ); | |
| } |
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
| internal class CheckBoxEx : CheckBox | |
| { | |
| private const float factor = 0.6f; | |
| private const int check = 2; | |
| public Color DisableFore = SystemColors.GrayText; | |
| protected override void OnPaint( PaintEventArgs pevent ) | |
| { | |
| base.OnPaint( pevent ); |