Make user control display outside of form boundry

后端 未结 5 1867
慢半拍i
慢半拍i 2020-12-24 09:46

I\'ve decided to reimplement the datetime picker, as a standard datetime picker isn\'t nullable. The user wants to start with a blank field and type (not select) the date.

5条回答
  •  佛祖请我去吃肉
    2020-12-24 10:25

    The reason that your control gets chopped off is because it is a child control of the form that you reside on. Any control on the form must be contained by the form, hence it gets chopped off.

    I haven't done this in .Net, but had a similar problem in VB6. The solution then was to set the parent of the popup window (the calendar in your case) to be the desktop. This will allow it to extend beyond the boundaries of your form. You'll have to do some P/Invoke magic to find the hWnd of the popup, and another P/Invoke to set the parent.

提交回复
热议问题