c# - Is there a way to make the Splitter resize immediately on drag, instead of waiting for mouse up? -


i need way make splitter resize instantly when mouse drags. default shows ugly dot pattern preview , doesn't show resize until let go.

i've seen immediate resize behaviour in outlook, instance. .net framework provide way implement this?

i have apparently customized behaviour of splitter container in project. welcome code :

class ribbonsplitcontainer : splitcontainer {     private color topgradientcolor = color.fromargb(89, 135, 214);     private color bottomgradientcolor = color.fromargb(0, 45, 150);     private color notchcolor = color.fromargb(40, 50, 71);     private color notchshadowcolor = color.fromargb(249, 249, 251);     private color notchtouchcolor = color.fromargb(97, 116, 152);     private ushort nbrnotches = 9;     private int diff = 0;     private bool drawborderbottom = false;     private bool drawbordertop = false;     private bool drawborderleft = false;     private bool drawborderright = false;      [defaultvalue(typeof(color), "89,135,214")]     [categoryattribute("appearance")]     public color topgradientcolor     {         { return topgradientcolor; }         set { topgradientcolor = value; }     }      [defaultvalue(typeof(color), "0,45,150")]     public color bottomgradientcolor     {         { return bottomgradientcolor; }         set { bottomgradientcolor = value; }     }      [defaultvalue(typeof(color), "40, 50, 71")]     public color notchcolor     {         { return notchcolor; }         set { notchcolor = value; }     }      [defaultvalue(typeof(color), "249, 249, 251")]     public color notchshadowcolor     {         { return notchshadowcolor; }         set { notchshadowcolor = value; }     }      [defaultvalue(typeof(color), "97, 116, 152")]     public color notchtouchcolor     {         { return notchtouchcolor; }         set { notchtouchcolor = value; }     }      [defaultvalue(9)]     public ushort nbrnotches     {         { return nbrnotches; }         set { nbrnotches = value; }     }      [defaultvalue(false)]     [categoryattribute("appearance")]     public bool drawborderbottom     {         { return drawborderbottom; }         set { drawborderbottom = value; }     }      [defaultvalue(false)]     [categoryattribute("appearance")]     public bool drawbordertop     {         { return drawbordertop; }         set { drawbordertop = value; }     }      [defaultvalue(false)]     [categoryattribute("appearance")]     public bool drawborderleft     {         { return drawborderleft; }         set { drawborderleft = value; }     }      [defaultvalue(false)]     [categoryattribute("appearance")]     public bool drawborderright     {         { return drawborderright; }         set { drawborderright = value; }     }      protected override void onmouseup(mouseeventargs e)     {         invalidate();     }      protected override void onmousemove(mouseeventargs e)     {         if (e.button == mousebuttons.left)         {             if (orientation == orientation.horizontal)             {                 int y = e.y - diff;                 if (y < 0) y = 0;                 splitterdistance = y;             }             else             {                 int x = e.x - diff;                 if (x < 0) x = 0;                 splitterdistance = x;             }             graphics g = creategraphics();             paint(g);             g.dispose();             this.panel1.invalidate();             this.panel2.invalidate();             update();         }         else base.onmousemove(e);     }      protected override void onpaintbackground(painteventargs e)     {         //base.onpaintbackground(e);     }      protected override void onkeydown(keyeventargs e)     {         //base.onkeydown(e);     }      protected override void onkeypress(keypresseventargs e)     {         //base.onkeypress(e);     }      protected override void onmousedown(mouseeventargs e)     {         if (orientation == orientation.horizontal)         {             diff = e.y - this.panel1.height;         }         else         {             diff = e.x - this.panel1.width;         }     }      protected new virtual void paint(graphics g)     {         rectangle r = clientrectangle;          if (orientation == orientation.horizontal)         {             r.y = this.panel1.height;             r.height = this.splitterwidth;         }         else         {             r.x = this.panel1.width;             r.width = this.splitterwidth;         }          lineargradientbrush brush = new lineargradientbrush(r, topgradientcolor,             bottomgradientcolor, (orientation == orientation.horizontal) ? lineargradientmode.vertical : lineargradientmode.horizontal);         g.fillrectangle(brush, r);         pen pen = new pen(bottomgradientcolor);         if (orientation == orientation.horizontal) g.drawline(pen, 0, r.height, r.width, r.height);         else g.drawline(pen, r.width, 0, r.width, r.height);          int startx;         int starty;         if (orientation == orientation.horizontal)         {             startx = (width - (4 * nbrnotches - 1)) / 2;             starty = r.y + 1;         }         else         {             startx = r.x + 2;             starty = (height - (4 * nbrnotches - 1)) / 2;         }          (ushort = 0; < nbrnotches; i++)         {             pen.color = notchcolor;             g.drawpolygon(pen, new point[] { new point(startx, starty + 1), new point(startx, starty), new point(startx + 1, starty) });             pen.color = notchtouchcolor;             g.drawline(pen, startx + 1, starty + 1, startx + 2, starty + 1);             pen.color = notchshadowcolor;             g.drawpolygon(pen, new point[] { new point(startx + 1, starty + 2), new point(startx + 2, starty + 2), new point(startx + 2, starty + 1) });              if (orientation == orientation.horizontal) startx += 4;             else starty += 4;         }          brush.dispose();         pen.dispose();          if (drawborderbottom)         {             g.drawline(pens.black, r.left, r.bottom-1, r.right, r.bottom-1);         }          if (drawbordertop)         {             g.drawline(pens.black, r.left, r.top, r.right, r.top);         }          if (drawborderleft)         {             g.drawline(pens.black, r.left, r.top, r.left, r.bottom);         }          if (drawborderright)         {             g.drawline(pens.black, r.right-1, r.top, r.right-1, r.bottom);         }     }      protected override void onpaint(painteventargs e)     {         graphics g = e.graphics;         paint(g);     }      protected override void onresize(eventargs e)     {         base.onresize(e);         refresh();     } } 

it gives splitter whole new too.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -