c# - Resizing pictureBox and changing minimumsize -
so have code resizing picturebox:
class sizeablepicturebox : picturebox { public sizeablepicturebox() { this.resizeredraw = true; } protected override void onpaint(painteventargs e) { base.onpaint(e); var rc = new rectangle(this.clientsize.width - grab, this.clientsize.height - grab, grab, grab); controlpaint.drawsizegrip(e.graphics, this.backcolor, rc); } protected override void wndproc(ref message m) { base.wndproc(ref m); if (m.msg == 0x84) { // trap wm_nchittest var pos = this.pointtoclient(new point(m.lparam.toint32() & 0xffff, m.lparam.toint32() >> 16)); if (pos.x >= this.clientsize.width - grab && pos.y >= this.clientsize.height - grab) m.result = new intptr(17); // ht_bottomright } } private const int grab = 16; }
i found here on stackoverflow, , works great. however, change minimumsize on it, since can't scale down enough. after point, stops downscaling.