本文整理汇总了C#中PlacementOperation类的典型用法代码示例。如果您正苦于以下问题:C# PlacementOperation类的具体用法?C# PlacementOperation怎么用?C# PlacementOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlacementOperation类属于命名空间,在下文中一共展示了PlacementOperation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LeaveContainer
public override void LeaveContainer(PlacementOperation operation)
{
base.LeaveContainer(operation);
/* Hide the rectangle in case switching to the other container
* otherwise it will show up intersecting with the container */
_rectangle.Visibility = Visibility.Hidden;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:StackPanelPlacementSupport.cs
示例2: BeforeSetPosition
public override void BeforeSetPosition(PlacementOperation operation)
{
base.BeforeSetPosition(operation);
if (surface == null) return;
DesignPanel designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel == null || !designPanel.UseRasterPlacement)
return;
if (Keyboard.IsKeyDown(Key.LeftCtrl))
{
surface.Children.Clear();
rasterDrawn = false;
return;
}
drawRaster();
var bounds = operation.PlacedItems[0].Bounds;
bounds.Y = ((int)bounds.Y/raster)*raster;
bounds.X = ((int)bounds.X/raster)*raster;
bounds.Width = Convert.ToInt32((bounds.Width/raster))*raster;
bounds.Height = Convert.ToInt32((bounds.Height/raster))*raster;
operation.PlacedItems[0].Bounds = bounds;
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:25,代码来源:RasterPlacementBehavior.cs
示例3: GetPosition
public override Rect GetPosition(PlacementOperation operation, DesignItem item)
{
UIElement child = item.View;
if (child == null)
return Rect.Empty;
double x, y;
if (IsPropertySet(child, Canvas.LeftProperty) || !IsPropertySet(child, Canvas.RightProperty)) {
x = GetCanvasProperty(child, Canvas.LeftProperty);
} else {
x = extendedComponent.ActualWidth - GetCanvasProperty(child, Canvas.RightProperty) - PlacementOperation.GetRealElementSize(child).Width;
}
if (IsPropertySet(child, Canvas.TopProperty) || !IsPropertySet(child, Canvas.BottomProperty)) {
y = GetCanvasProperty(child, Canvas.TopProperty);
} else {
y = extendedComponent.ActualHeight - GetCanvasProperty(child, Canvas.BottomProperty) - PlacementOperation.GetRealElementSize(child).Height;
}
var p = new Point(x, y);
//Fixes, Empty Image Resized to 0
//return new Rect(p, child.RenderSize);
return new Rect(p, PlacementOperation.GetRealElementSize(item.View));
}
开发者ID:icsharpcode,项目名称:WpfDesigner,代码行数:26,代码来源:CanvasPlacementSupport.cs
示例4: GetPosition
public virtual Rect GetPosition(PlacementOperation operation, DesignItem item)
{
if (item.View == null)
return Rect.Empty;
var p = item.View.TranslatePoint(new Point(), operation.CurrentContainer.View);
return new Rect(p, item.View.RenderSize);
}
开发者ID:QIWEB,项目名称:SharpDevelop,代码行数:7,代码来源:DefaultPlacementBehavior.cs
示例5: EndPlacement
public virtual void EndPlacement(PlacementOperation operation)
{
InfoTextEnterArea.Stop(ref infoTextEnterArea);
this.ExtendedItem.Services.Selection.SetSelectedComponents(null);
this.ExtendedItem.Services.Selection.SetSelectedComponents(operation.PlacedItems.Select(x => x.Item).ToList());
}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:7,代码来源:DefaultPlacementBehavior.cs
示例6: LeaveContainer
public override void LeaveContainer(PlacementOperation operation)
{
base.LeaveContainer(operation);
foreach (PlacementInformation info in operation.PlacedItems) {
info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).Reset();
info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).Reset();
}
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:8,代码来源:CanvasPlacementSupport.cs
示例7: LeaveContainer
public override void LeaveContainer(PlacementOperation operation)
{
GrayOutDesignerExceptActiveArea.Stop(ref grayOut);
base.LeaveContainer(operation);
foreach (PlacementInformation info in operation.PlacedItems) {
info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).Reset();
info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).Reset();
}
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:9,代码来源:CanvasPlacementSupport.cs
示例8: EnterContainer
public override void EnterContainer(PlacementOperation operation)
{
base.EnterContainer(operation);
foreach (PlacementInformation info in operation.PlacedItems) {
info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.MarginProperty].Reset();
}
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:9,代码来源:CanvasPlacementSupport.cs
示例9: EnterContainer
public override void EnterContainer(PlacementOperation operation)
{
base.EnterContainer(operation);
foreach (var info in operation.PlacedItems) {
info.Item.Properties[FrameworkElement.MarginProperty].Reset();
info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].Reset();
}
_rectangle.Visibility = Visibility.Visible;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:10,代码来源:StackPanelPlacementSupport.cs
示例10: BeginPlacement
public override void BeginPlacement(PlacementOperation operation)
{
base.BeginPlacement(operation);
DesignPanel designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel != null)
raster = designPanel.RasterWidth;
CreateSurface(operation);
}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:10,代码来源:RasterPlacementBehavior.cs
示例11: Start
public void Start(Point p)
{
startPoint = p;
IPlacementBehavior b = PlacementOperation.GetPlacementBehavior(selectedItems);
if (b != null && b.CanPlace(selectedItems, PlacementType.Move, PlacementAlignment.TopLeft)) {
List<DesignItem> sortedSelectedItems = new List<DesignItem>(selectedItems);
sortedSelectedItems.Sort(ModelTools.ComparePositionInModelFile);
selectedItems = sortedSelectedItems;
operation = PlacementOperation.Start(selectedItems, PlacementType.Move);
}
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:11,代码来源:MoveLogic.cs
示例12: CreateSurface
void CreateSurface(PlacementOperation operation)
{
if (ExtendedItem.Services.GetService<IDesignPanel>() != null)
{
surface = new Canvas();
adornerPanel = new AdornerPanel();
adornerPanel.SetAdornedElement(ExtendedItem.View, ExtendedItem);
AdornerPanel.SetPlacement(surface, AdornerPlacement.FillContent);
adornerPanel.Children.Add(surface);
ExtendedItem.Services.DesignPanel.Adorners.Add(adornerPanel);
}
}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:12,代码来源:RasterPlacementBehavior.cs
示例13: CanEnterContainer
public virtual bool CanEnterContainer(PlacementOperation operation, bool shouldAlwaysEnter)
{
var canEnter = internalCanEnterContainer(operation);
if (canEnter && !shouldAlwaysEnter && !Keyboard.IsKeyDown(Key.LeftAlt) && !Keyboard.IsKeyDown(Key.RightAlt))
{
var b = new Rect(0, 0, ((FrameworkElement)this.ExtendedItem.View).ActualWidth, ((FrameworkElement)this.ExtendedItem.View).ActualHeight);
InfoTextEnterArea.Start(ref infoTextEnterArea, this.Services, this.ExtendedItem.View, b, Translations.Instance.PressAltText);
return false;
}
return canEnter;
}
开发者ID:icsharpcode,项目名称:WpfDesigner,代码行数:14,代码来源:DefaultPlacementBehavior.cs
示例14: BeginPlacement
public override void BeginPlacement(PlacementOperation operation)
{
base.BeginPlacement(operation);
if (_rects.Count > 0)
_rects.Clear();
/* Add Rect of all children to _rects */
var children = this.ExtendedItem.ContentProperty.CollectionElements;
foreach (var child in children) {
Point p = child.View.TranslatePoint(new Point(0, 0), this.ExtendedItem.View);
_rects.Add(new Rect(p, child.View.RenderSize));
}
if (_adornerPanel != null && this.ExtendedItem.Services.DesignPanel.Adorners.Contains(_adornerPanel))
this.ExtendedItem.Services.DesignPanel.Adorners.Remove(_adornerPanel);
/* Place the Rectangle */
_adornerPanel = new AdornerPanel();
_rectangle = new Rectangle();
_adornerPanel.SetAdornedElement(this.ExtendedItem.View, this.ExtendedItem);
_adornerPanel.Children.Add(_rectangle);
this.ExtendedItem.Services.DesignPanel.Adorners.Add(_adornerPanel);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:22,代码来源:StackPanelPlacementSupport.cs
示例15: EnterContainer
public override void EnterContainer(PlacementOperation operation)
{
base.EnterContainer(operation);
foreach (PlacementInformation info in operation.PlacedItems) {
info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].Reset();
info.Item.Properties[FrameworkElement.MarginProperty].Reset();
if (operation.Type == PlacementType.PasteItem) {
if (!double.IsNaN((double)info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).ValueOnInstance)) {
info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty)
.SetValue(((double) info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).ValueOnInstance) +
PlacementOperation.PasteOffset);
}
if (!double.IsNaN((double)info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).ValueOnInstance)) {
info.Item.Properties.GetAttachedProperty(Canvas.TopProperty)
.SetValue(((double) info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).ValueOnInstance) +
PlacementOperation.PasteOffset);
}
}
}
}
开发者ID:icsharpcode,项目名称:WpfDesigner,代码行数:23,代码来源:CanvasPlacementSupport.cs
示例16: dragX_Started
private void dragX_Started(DragListener drag)
{
_adornerLayer = this.adornerPanel.TryFindParent<AdornerLayer>();
var designerItem = this.ExtendedItem.Component as FrameworkElement;
this.parent = VisualTreeHelper.GetParent(designerItem) as UIElement;
startPoint = Mouse.GetPosition(this.parent);
if (this.skewTransform == null)
{
this.skewX = 0;
this.skewY = 0;
}
else
{
this.skewX = this.skewTransform.AngleX;
this.skewY = this.skewTransform.AngleY;
}
rtTransform = this.ExtendedItem.Properties[FrameworkElement.RenderTransformProperty].Value;
operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:24,代码来源:SkewThumbExtension.cs
示例17: EndPlacement
public override void EndPlacement(PlacementOperation operation)
{
base.EndPlacement(operation);
if (_adornerPanel != null && this.ExtendedItem.Services.DesignPanel.Adorners.Contains(_adornerPanel))
this.ExtendedItem.Services.DesignPanel.Adorners.Remove(_adornerPanel);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:6,代码来源:StackPanelPlacementSupport.cs
示例18: drag_Started
// TODO : Remove all hide/show extensions from here.
void drag_Started(DragListener drag)
{
var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel != null)
{
var p = VisualTreeHelper.GetParent(designPanel);
while (p != null && !(p is ZoomControl))
{
p = VisualTreeHelper.GetParent(p);
}
zoom = p as ZoomControl;
}
/* Abort editing Text if it was editing, because it interferes with the undo stack. */
foreach(var extension in this.ExtendedItem.Extensions){
if(extension is InPlaceEditorExtension){
((InPlaceEditorExtension)extension).AbortEdit();
}
}
oldSize = new Size(ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View));
if (resizeBehavior != null)
operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
else {
changeGroup = this.ExtendedItem.Context.OpenGroup("Resize", extendedItemArray);
}
_isResizing=true;
ShowSizeAndHideHandles();
}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:30,代码来源:ResizeThumbExtension.cs
示例19: CanLeaveContainer
public virtual bool CanLeaveContainer(PlacementOperation operation)
{
return true;
}
开发者ID:modulexcite,项目名称:WpfDesigner,代码行数:4,代码来源:DefaultPlacementBehavior.cs
示例20: BeforeSetPosition
public virtual void BeforeSetPosition(PlacementOperation operation)
{
}
开发者ID:modulexcite,项目名称:WpfDesigner,代码行数:3,代码来源:DefaultPlacementBehavior.cs
注:本文中的PlacementOperation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论