c# - Resizing controls in WinForm Designer by 32px-steps (VS15) -
i have little problem new custom control. question want resizes 32px-steps create grid, i'm looking event of post-resizing, or similar adjust control's size. has ideas?
just enforce size requirements:
class mygrid : control { private const int pitch = 32; protected override void onclientsizechanged(eventargs e) { var w = pitch * ((this.clientsize.width + pitch/2) / pitch); var h = pitch * ((this.clientsize.height + pitch/2) / pitch); if (w != this.clientsize.width || h != this.clientsize.height) this.clientsize = new size(w, h); else base.onclientsizechanged(e); } }
it not fantastic design-time experience serviceable , simple since doesn't require custom designer.
do careful this, hard-coding sizes in pixels not idea these days 4k monitors available , costing less $500. 32 px grid cell going fleck of dust on such screen.
Comments
Post a Comment