user2660145 user2660145 - 5 months ago 53
C# Question

month Calender not displayed fully inside a groupbox

I have a requirement to show a monthcalender on focus of a text box.

This text box is placed in a groupbox along with other controls. The problem is when the calendar poput on the focus of the text box the calendar is not displayed fully after running the application. because the height of the group box is small. As per requirement i should not increase the size of the groupbox and i should display the calender completly.

I tried below code but not working.


groupBox.Controls.SetChildIndex(Calendar, 0);


If the calendar is in the GroupBox, it will be clipped if it stretches beyond the bounds of its parent.

Solution 1:

Put the calendar into a Panel and turn AutoScroll on so a scroll bar will appear to access the whole calendar.

enter image description here

Solution 2:

Simply place the calendar onto the parent of the GroupBox.

enter image description here