Skip to content

Commit d9eb54c

Browse files
committed
Small ToolTip layout improvements
1 parent cd1c320 commit d9eb54c

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Source/ExcelDna.IntelliSense.Host/MyFunctions.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ namespace ExcelDna.CustomAddin
88
// These functions - are just here for testing...
99
public class MyFunctions
1010
{
11-
[ExcelFunction(Description = "A useful test function that adds two numbers, and returns the product.")]
11+
[ExcelFunction(Description = "Returns the sum of two particular numbers that are given")]
1212
public static double AddThem(
13-
[ExcelArgument(Name = "Augend", Description = "is the first number, to which will be multiplied")] double v1,
14-
[ExcelArgument(Name = "Addend", Description = "is the second number that will be multiplied")] double v2)
13+
[ExcelArgument(Name = "Augend", Description = "is the first number, to which will be added")] double v1,
14+
[ExcelArgument(Name = "Addend", Description = "is the second number that will be added")] double v2)
15+
{
16+
return v1 + v2;
17+
}
18+
19+
[ExcelFunction(Description = "--------------------")]
20+
public static double AdxThem(
21+
[ExcelArgument(Name = "Augend", Description = "is the first number, to which will be added")] double v1,
22+
[ExcelArgument(Name = "Addend", Description = "is the second number that will be added")] double v2)
1523
{
1624
return v1 + v2;
1725
}

Source/ExcelDna.IntelliSense/ToolTipForm.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ protected override void OnPaint(PaintEventArgs e)
174174
Debug.Assert(_left != 0 || _top != 0);
175175
Logger.Display.Verbose($"ToolTipForm OnPaint: {_text.ToString()} @ ({_left},{_top})");
176176
const int leftPadding = 6;
177-
const int linePadding = 2;
178-
const int widthPadding = 10;
177+
const int linePadding = 0;
178+
const int widthPadding = 12;
179179
const int heightPadding = 2;
180180

181181
base.OnPaint(e);
@@ -195,7 +195,8 @@ protected override void OnPaint(PaintEventArgs e)
195195

196196
foreach (var line in _text)
197197
{
198-
int lineHeight = 0;
198+
totalHeight += linePadding;
199+
int lineHeight = 12;
199200
foreach (var run in line)
200201
{
201202
var font = _fonts[run.Style];
@@ -209,10 +210,9 @@ protected override void OnPaint(PaintEventArgs e)
209210
lineWidths.Add(totalWidth);
210211
totalWidth = 0;
211212
totalHeight += lineHeight;
212-
layoutRect = new Rectangle(layoutLeft, layoutTop + totalHeight + linePadding, 1000, 500);
213+
layoutRect = new Rectangle(layoutLeft, layoutTop + totalHeight - 1, 1000, 500);
213214
}
214215
}
215-
216216
var width = lineWidths.Max() + widthPadding;
217217
var height = totalHeight + heightPadding;
218218
SetBounds(_left, _top, width, height);

0 commit comments

Comments
 (0)