Skip to content

Commit ad44a9d

Browse files
author
grammarian
committed
- CalculateImageWidth() no longer adds 2 to the image width
- Fix calculation of cell edit boundaries on TreeListView controls - Fix some spelling mistakes git-svn-id: https://svn.code.sf.net/p/objectlistview/code/cs/trunk@811 0bec5ed8-b53f-49e6-9885-ce7bc93af311
1 parent fc24035 commit ad44a9d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

ObjectListView/Rendering/Renderers.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
* Date: 27/09/2008 9:15 AM
66
*
77
* Change log:
8+
* v2.9.2
9+
* 2016-06-02 JPP - CalculateImageWidth() no longer adds 2 to the image width
10+
* 2016-05-29 JPP - Fix calculation of cell edit boundaries on TreeListView controls
811
* v2.9
912
* 2015-08-22 JPP - Allow selected row back/fore colours to be specified for each row
1013
* 2015-06-23 JPP - Added ColumnButtonRenderer plus general support for Buttons
1114
* 2015-06-22 JPP - Added BaseRenderer.ConfigureItem() and ConfigureSubItem() to easily allow
1215
* other renderers to be chained for use within a primary renderer.
1316
* - Lots of tightening of hit tests and edit rectangles
14-
* 2015-05-15 JPP - Handle renderering an Image when that Image is returned as an aspect.
17+
* 2015-05-15 JPP - Handle rendering an Image when that Image is returned as an aspect.
1518
* v2.8
1619
* 2014-09-26 JPP - Dispose of animation timer in a more robust fashion.
1720
* 2014-05-20 JPP - Handle rendering disabled rows
@@ -305,7 +308,7 @@ public Rectangle? CellPadding {
305308
private Rectangle? cellPadding;
306309

307310
/// <summary>
308-
/// Gets the horiztonal alignment of the column
311+
/// Gets the horizontal alignment of the column
309312
/// </summary>
310313
[Browsable(false)]
311314
public HorizontalAlignment CellHorizontalAlignment
@@ -825,7 +828,7 @@ protected virtual Size CalculatePrimaryCheckBoxSize(Graphics g) {
825828
/// <returns></returns>
826829
protected virtual int CalculateImageWidth(Graphics g, object imageSelector)
827830
{
828-
return this.CalculateImageSize(g, imageSelector).Width + 2;
831+
return this.CalculateImageSize(g, imageSelector).Width;
829832
}
830833

831834
/// <summary>
@@ -909,7 +912,7 @@ protected virtual Size CalculateTextSize(Graphics g, string txt, int width)
909912
return TextRenderer.MeasureText(g, txt, this.Font, proposedSize, NormalTextFormatFlags);
910913
}
911914

912-
// Using GDI+ renderering
915+
// Using GDI+ rendering
913916
using (StringFormat fmt = new StringFormat()) {
914917
fmt.Trimming = StringTrimming.EllipsisCharacter;
915918
SizeF sizeF = g.MeasureString(txt, this.Font, width, fmt);
@@ -1319,7 +1322,7 @@ protected virtual void StandardHitTest(Graphics g, OlvListViewHitTestInfo hti, R
13191322
width = this.CalculateImageWidth(g, this.GetImageSelector());
13201323
Rectangle rTwo = r;
13211324
rTwo.Width = width;
1322-
// g.DrawRectangle(Pens.Red, rTwo);
1325+
//g.DrawRectangle(Pens.Red, rTwo);
13231326
if (rTwo.Contains(x, y)) {
13241327
if (this.Column != null && (this.Column.Index > 0 && this.Column.CheckBoxes))
13251328
hti.HitTestLocation = HitTestLocation.CheckBox;
@@ -1362,12 +1365,12 @@ protected virtual Rectangle StandardGetEditRectangle(Graphics g, Rectangle cellB
13621365
Size checkBoxSize = this.CalculatePrimaryCheckBoxSize(g);
13631366
int imageWidth = this.CalculateImageWidth(g, this.GetImageSelector());
13641367

1365-
int width = checkBoxSize.Width + imageWidth;
1368+
int width = checkBoxSize.Width + imageWidth + 2;
13661369

13671370
// Indent the primary column by the required amount
1368-
if (this.ListItem.IndentCount > 0) {
1371+
if (this.ColumnIsPrimary && this.ListItem.IndentCount > 0) {
13691372
int indentWidth = this.ListView.SmallImageSize.Width * this.ListItem.IndentCount;
1370-
width += indentWidth;
1373+
editControlBounds.X += indentWidth;
13711374
}
13721375

13731376
editControlBounds.X += width;
@@ -3496,7 +3499,7 @@ public Color DescriptionColorOrDefault {
34963499
/// Gets or sets the number of pixels that will be left between the image and the text
34973500
/// </summary>
34983501
[Category("ObjectListView"),
3499-
Description("The number of pixels that that will be left between the image and the text"),
3502+
Description("The number of pixels that will be left between the image and the text"),
35003503
DefaultValue(4)]
35013504
public int ImageTextSpace
35023505
{

0 commit comments

Comments
 (0)