public override void Draw(DrawingContext ctx, Matrix matrix) { bool flag = false; Point pointBegin; Point pointEnd; this.GetPoints(out pointBegin, out pointEnd); if (this.IsX) { GridColumnSelectionSet columnSelectionSet = ((GridRowColumnAdornerSet)this.AdornerSet).GridColumnSelectionSet; if (columnSelectionSet != null) { flag = !columnSelectionSet.GridLineMode && columnSelectionSet.IsSelected(this.Grid.ColumnDefinitions[this.Index]); } } else { GridRowSelectionSet gridRowSelectionSet = ((GridRowColumnAdornerSet)this.AdornerSet).GridRowSelectionSet; if (gridRowSelectionSet != null) { flag = !gridRowSelectionSet.GridLineMode && gridRowSelectionSet.IsSelected(this.Grid.RowDefinitions[this.Index]); } } MatrixTransform matrixTransform = new MatrixTransform(matrix); matrixTransform.Freeze(); ctx.PushTransform((Transform)matrixTransform); ctx.DrawRectangle(flag ? (Brush)LayoutBackgroundAdorner.SelectedBrush : (Brush)LayoutBackgroundAdorner.UnselectedBrush, (Pen)null, new Rect(pointBegin, pointEnd)); ctx.Pop(); }
public override void Draw(DrawingContext drawingContext, Matrix matrix) { bool flag; if (this.IsX) { GridColumnSelectionSet columnSelectionSet = ((GridRowColumnAdornerSet)this.AdornerSet).GridColumnSelectionSet; flag = columnSelectionSet.GridLineMode && columnSelectionSet.IsSelected(this.Grid.ColumnDefinitions[this.Index]); } else { GridRowSelectionSet gridRowSelectionSet = ((GridRowColumnAdornerSet)this.AdornerSet).GridRowSelectionSet; flag = gridRowSelectionSet.GridLineMode && gridRowSelectionSet.IsSelected(this.Grid.RowDefinitions[this.Index]); } Brush brush = flag ? this.ActiveBrush : this.InactiveBrush; Matrix matrix1 = this.TruncateMatrix(matrix); Point center = this.GetCenter(matrix, matrix1); matrix1.Translate(center.X, center.Y); if (!this.IsX) { matrix1.RotatePrepend(-90.0); } MatrixTransform matrixTransform = new MatrixTransform(matrix1); matrixTransform.Freeze(); drawingContext.PushTransform((Transform)matrixTransform); drawingContext.DrawGeometry(brush, this.ThinPen, LayoutAdorner.TriangleGeometry); drawingContext.Pop(); }