i have situation move windows form holding right mouse button on it's client area; form it's borderless i've stated.
i move "natively" (if possible, otherwise other answers ok too). mean way behaves when hold left mouse button on titlebar (with mouse-move , things lot of strange behaviours, maybe it's me).
i've read around lot of things , post looks helpful
i tried various way use , watched through http://msdn.microsoft.com/en-us/library/ff468877%28v=vs.85%29.aspx find other useful things , wm_ncrbuttondown came in mind, wndproc doesn't detect it, maybe because it's handled form?
any suggestion appreciated, thanks
francesco
public partial class dragform : form { // offset upper left of form mouse grabbed private size? _mousegraboffset; public dragform() { initializecomponent(); } protected override void onmousedown(mouseeventargs e) { if( e.button == system.windows.forms.mousebuttons.right ) _mousegraboffset = new size(e.location); base.onmousedown(e); } protected override void onmouseup(mouseeventargs e) { _mousegraboffset = null; base.onmouseup(e); } protected override void onmousemove(mouseeventargs e) { if (_mousegraboffset.hasvalue) { this.location = cursor.position - _mousegraboffset.value; } base.onmousemove(e); } }
Comments
Post a Comment