@@ -172,7 +172,7 @@ public OLVColumn ColumnToDecorate {
172
172
/// </summary>
173
173
public Pen Pen {
174
174
get {
175
- return this . pen ?? Pens . DarkRed ;
175
+ return this . pen ?? Pens . DarkSlateBlue ;
176
176
}
177
177
set {
178
178
if ( this . pen == value )
@@ -315,16 +315,6 @@ public enum ColumnEdge {
315
315
Right
316
316
}
317
317
318
- /// <summary>
319
- /// Specify if the decoration will be inside the column,
320
- /// overlap the column edge, or outside the column.
321
- /// </summary>
322
- public enum ColumnEdgeAlignment {
323
- Inside ,
324
- Middle ,
325
- Outside
326
- }
327
-
328
318
/// <summary>
329
319
/// This decoration draws a line on the edge(s) of its given column
330
320
/// </summary>
@@ -348,13 +338,13 @@ public ColumnEdgeDecoration() {
348
338
/// <param name="column"></param>
349
339
/// <param name="pen"></param>
350
340
/// <param name="edge"></param>
351
- /// <param name="alignment "></param>
352
- public ColumnEdgeDecoration ( OLVColumn column , Pen pen = null , ColumnEdge edge = ColumnEdge . Right , ColumnEdgeAlignment alignment = ColumnEdgeAlignment . Middle )
341
+ /// <param name="xOffset "></param>
342
+ public ColumnEdgeDecoration ( OLVColumn column , Pen pen = null , ColumnEdge edge = ColumnEdge . Right , float xOffset = 0 )
353
343
: this ( ) {
354
344
this . ColumnToDecorate = column ;
355
345
this . Pen = pen ;
356
346
this . Edge = edge ;
357
- this . Alignment = alignment ;
347
+ this . XOffset = xOffset ;
358
348
}
359
349
360
350
#endregion
@@ -371,14 +361,13 @@ public ColumnEdge Edge {
371
361
private ColumnEdge edge = ColumnEdge . Right ;
372
362
373
363
/// <summary>
374
- /// Gets or sets whether this decoration will draw a line inside the column, overlapping the edge,
375
- /// or outside of the column.
364
+ /// Gets or sets the horizontal offset from centered at which the line will be drawn
376
365
/// </summary>
377
- public ColumnEdgeAlignment Alignment {
378
- get { return alignment ; }
379
- set { alignment = value ; }
366
+ public float XOffset {
367
+ get { return xOffset ; }
368
+ set { xOffset = value ; }
380
369
}
381
- private ColumnEdgeAlignment alignment = ColumnEdgeAlignment . Middle ;
370
+ private float xOffset ;
382
371
383
372
#endregion
384
373
@@ -391,33 +380,9 @@ public override void DrawDecoration(ObjectListView olv, Graphics g, Rectangle r,
391
380
}
392
381
393
382
private float CalculateEdge ( Rectangle columnBounds ) {
394
- int tweak = this . Pen . Width <= 2 ? 0 : 1 ;
395
- switch ( this . Edge ) {
396
- case ColumnEdge . Left :
397
- switch ( this . Alignment ) {
398
- case ColumnEdgeAlignment . Inside :
399
- return tweak + columnBounds . Left ;
400
- case ColumnEdgeAlignment . Middle :
401
- return tweak + columnBounds . Left - this . Pen . Width / 2 ;
402
- case ColumnEdgeAlignment . Outside :
403
- return tweak + columnBounds . Left - this . Pen . Width ;
404
- default :
405
- throw new ArgumentOutOfRangeException ( ) ;
406
- }
407
- case ColumnEdge . Right :
408
- switch ( this . Alignment ) {
409
- case ColumnEdgeAlignment . Inside :
410
- return tweak + columnBounds . Right - this . Pen . Width ;
411
- case ColumnEdgeAlignment . Middle :
412
- return tweak + columnBounds . Right - this . Pen . Width / 2 ;
413
- case ColumnEdgeAlignment . Outside :
414
- return tweak + columnBounds . Right ;
415
- default :
416
- throw new ArgumentOutOfRangeException ( ) ;
417
- }
418
- default :
419
- throw new ArgumentOutOfRangeException ( ) ;
420
- }
383
+ float tweak = this . XOffset + ( this . Pen . Width <= 2 ? 0 : 1 ) ;
384
+ int x = this . Edge == ColumnEdge . Left ? columnBounds . Left : columnBounds . Right ;
385
+ return tweak + x - this . Pen . Width / 2 ;
421
386
}
422
387
423
388
#endregion
0 commit comments