|
|
|
@ -55,7 +55,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions |
|
|
|
ResizeThumb resizeThumb = new ResizeThumbImpl( cursor == Cursors.SizeNS, cursor == Cursors.SizeWE ); |
|
|
|
ResizeThumb resizeThumb = new ResizeThumbImpl( cursor == Cursors.SizeNS, cursor == Cursors.SizeWE ); |
|
|
|
resizeThumb.Cursor = cursor; |
|
|
|
resizeThumb.Cursor = cursor; |
|
|
|
resizeThumb.Alignment = alignment; |
|
|
|
resizeThumb.Alignment = alignment; |
|
|
|
AdornerPanel.SetPlacement(resizeThumb, new RelativePlacement(alignment.Horizontal, alignment.Vertical)); |
|
|
|
AdornerPanel.SetPlacement(resizeThumb, Place(ref resizeThumb, alignment)); |
|
|
|
adornerPanel.Children.Add(resizeThumb); |
|
|
|
adornerPanel.Children.Add(resizeThumb); |
|
|
|
|
|
|
|
|
|
|
|
DragListener drag = new DragListener(resizeThumb); |
|
|
|
DragListener drag = new DragListener(resizeThumb); |
|
|
|
@ -64,6 +64,37 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions |
|
|
|
drag.Completed += new DragHandler(drag_Completed); |
|
|
|
drag.Completed += new DragHandler(drag_Completed); |
|
|
|
return resizeThumb; |
|
|
|
return resizeThumb; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Places resize thumbs at their respective positions
|
|
|
|
|
|
|
|
/// and streches out thumbs which are at the center of outline to extend resizability across the whole outline
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="resizeThumb"></param>
|
|
|
|
|
|
|
|
/// <param name="alignment"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
private RelativePlacement Place(ref ResizeThumb resizeThumb,PlacementAlignment alignment) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
RelativePlacement placement = new RelativePlacement(alignment.Horizontal,alignment.Vertical); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (alignment.Horizontal == HorizontalAlignment.Center) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
placement.WidthRelativeToContentWidth = 1; |
|
|
|
|
|
|
|
placement.HeightOffset = 6; |
|
|
|
|
|
|
|
resizeThumb.Opacity = 0; |
|
|
|
|
|
|
|
return placement; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (alignment.Vertical == VerticalAlignment.Center) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
placement.HeightRelativeToContentHeight = 1; |
|
|
|
|
|
|
|
placement.WidthOffset = 6; |
|
|
|
|
|
|
|
resizeThumb.Opacity = 0; |
|
|
|
|
|
|
|
return placement; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
placement.WidthOffset = 6; |
|
|
|
|
|
|
|
placement.HeightOffset = 6; |
|
|
|
|
|
|
|
return placement; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Size oldSize; |
|
|
|
Size oldSize; |
|
|
|
|
|
|
|
|
|
|
|
|