using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Drawing; using System.Windows.Forms; namespace JRCookbookControls { internal static class modSharedRoutines { internal static void ShowInsertionBar(Control control, JRCookbookControls.InsertLocation insertLocation) { if (insertLocation == InsertLocation.InsertBefore) { DrawLine(control, 0, 0, control.Width - 1, 0, System.Drawing.SystemColors.MenuHighlight); } else if (insertLocation == InsertLocation.InsertAfter) { DrawLine(control, 0, control.Height - 1, control.Width - 1, control.Height - 1, System.Drawing.SystemColors.MenuHighlight); } } internal static void HideInsertionBar(Control control) { DrawLine(control, 0, 0, control.Width - 1, 0, System.Drawing.SystemColors.Control); DrawLine(control, 0, control.Height - 1, control.Width - 1, control.Height - 1, System.Drawing.SystemColors.Control); } internal static void DragStarted(Control control) { control.BackColor = System.Drawing.SystemColors.MenuHighlight; } internal static void DragEnded(Control control) { control.BackColor = System.Drawing.SystemColors.Control; } private static void DrawLine(Control control, int x1, int y1, int x2, int y2, Color color) { System.Drawing.Pen myPen; myPen = new System.Drawing.Pen(color, 1); System.Drawing.Graphics line = control.CreateGraphics(); line.DrawLine(myPen, x1, y1, x2, y2); //control.Refresh(); myPen.Dispose(); line.Dispose(); } } }