I have created a popup control (derived from Control) and host (attach) 1 listbox to this popup control (obvious I will set property Dock of listbox to Fill)
PopupControl _popup = new
PopupControl();
ListBox listbox = new
ListBox();
listbox.Dock = DockStyles.Fill;
_popup.Controls.Add(listbox);
I override CreateParams on PopupControl to style:
protected
override
CreateParams CreateParams
{
get
{
const
int
CS_DROPSHADOW = 0x00020000;
const
int
CS_NOCLOSEBUTTON = 0x200;
const
int
CS_NOVERTICALSCROLLBAR = ~0x200000;
CreateParams cp = base
.CreateParams;
if
(mParent != null
&& !DesignMode)
{
cp.Style = (int
)(((long
)cp.Style & 0xffff) | 0x90200000);
cp.Style &= CS_NOVERTICALSCROLLBAR;
cp.ClassStyle |= CS_DROPSHADOW;
cp.Parent = mParent.Handle;
Point pos = mParent.PointToScreen(Point.Empty);
cp.X = pos.X;
cp.Y = pos.Y + mParent.Height;
cp.Width = this
.DefaultSize.Width;
cp.Height = this
.DefaultSize.Height;
}
return
cp;
}
}
But when popup is displayed, it appear a space at the bottom, please see my captured image:
http://img24.imageshack.us/img24/4107/94256039.png
I think I need to modify CreateParams a little but I don't know how to do.
Please help me to disable the unwanted space. Thanks.