G
Guest
I have the following code as part of a method of producing in-line tooltips.
It appears to work except that the form with the tooltip can never be less
than 34 pixels high or 124 wide. Not the 15 or so pixels pixels high that I
want it to be.
Please can someone tell me how to shrink my over-sized window.
TIA.
....
....
....
private class ToolTipWindow : System.Windows.Forms.Form
{
private string _tip = String.Empty;
private Rectangle _screenRectangle;
public ToolTipWindow(Rectangle screenRectangle, string tip, Font
font)
{
_tip = tip;
_screenRectangle = screenRectangle;
Size s = TextRenderer.MeasureText(tip, font);
Font = font;
FormBorderStyle = FormBorderStyle.FixedSingle;
ControlBox = false;
MinimizeBox = false;
MaximizeBox = false;
this.MinimumSize = new Size(1, 1);
this.StartPosition = FormStartPosition.Manual;
Location = screenRectangle.Location;
this.Size = new Size(s.Width +2, s.Height + 2);
}
protected override CreateParams CreateParams
{
get
{
const int CS_DROPSHADOW = 0x00020000;
CreateParams cp = base.CreateParams;
cp.ClassStyle |= CS_DROPSHADOW;
return cp;
}
}
....
....
....
It appears to work except that the form with the tooltip can never be less
than 34 pixels high or 124 wide. Not the 15 or so pixels pixels high that I
want it to be.
Please can someone tell me how to shrink my over-sized window.
TIA.
....
....
....
private class ToolTipWindow : System.Windows.Forms.Form
{
private string _tip = String.Empty;
private Rectangle _screenRectangle;
public ToolTipWindow(Rectangle screenRectangle, string tip, Font
font)
{
_tip = tip;
_screenRectangle = screenRectangle;
Size s = TextRenderer.MeasureText(tip, font);
Font = font;
FormBorderStyle = FormBorderStyle.FixedSingle;
ControlBox = false;
MinimizeBox = false;
MaximizeBox = false;
this.MinimumSize = new Size(1, 1);
this.StartPosition = FormStartPosition.Manual;
Location = screenRectangle.Location;
this.Size = new Size(s.Width +2, s.Height + 2);
}
protected override CreateParams CreateParams
{
get
{
const int CS_DROPSHADOW = 0x00020000;
CreateParams cp = base.CreateParams;
cp.ClassStyle |= CS_DROPSHADOW;
return cp;
}
}
....
....
....