当前位置: 首页>>代码示例>>C#>>正文


C# DesignItem类代码示例

本文整理汇总了C#中DesignItem的典型用法代码示例。如果您正苦于以下问题:C# DesignItem类的具体用法?C# DesignItem怎么用?C# DesignItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DesignItem类属于命名空间,在下文中一共展示了DesignItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GridRailAdorner

		bool displayUnitSelector; // Indicates whether Grid UnitSeletor should be displayed.
		
		public GridRailAdorner(DesignItem gridItem, AdornerPanel adornerPanel, Orientation orientation)
		{
			Debug.Assert(gridItem != null);
			Debug.Assert(adornerPanel != null);
			
			this.gridItem = gridItem;
			this.grid = (Grid)gridItem.Component;
			this.adornerPanel = adornerPanel;
			this.orientation = orientation;
			this.displayUnitSelector=false;
			this.unitSelector = new GridUnitSelector(this);
			adornerPanel.Children.Add(unitSelector);
			
			if (orientation == Orientation.Horizontal) {
				this.Height = RailSize;
				previewAdorner = new GridColumnSplitterAdorner(this, gridItem, null, null);
			} else { // vertical
				this.Width = RailSize;
				previewAdorner = new GridRowSplitterAdorner(this, gridItem, null, null);
			}
			unitSelector.Orientation = orientation;
			previewAdorner.IsPreview = true;
			previewAdorner.IsHitTestVisible = false;
			unitSelector.Visibility = Visibility.Hidden;
			
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:28,代码来源:GridAdorner.cs

示例2: ExtractItems

		private void ExtractItems(int[] itemSerials)
		{
			for(int i=0; i < itemSerials.Length; ++i)
			{
				Item item = World.FindItem(itemSerials[i]);

				if(item != null && !(item is BaseMulti))
				{
					DesignItem designItem = new DesignItem();
					designItem.ItemID = (short)item.ItemID;
					designItem.X = item.X;
					designItem.Y = item.Y;
					designItem.Z = item.Z;
					designItem.Hue = (short)item.Hue;

					_items.Add(designItem);
				}
			}

			ExtractResponse resp = null;

			if(_items.Count > 0)
				resp = new ExtractResponse(_items);
			else
				resp = null;

			SendResponse(resp);
		}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:28,代码来源:ExtractItemsRequest.cs

示例3: InitializeDefaults

		public override void InitializeDefaults(DesignItem item)
		{
			DesignItemProperty fillProperty = item.Properties["Fill"];
			if (fillProperty.ValueOnInstance == null) {
				fillProperty.SetValue(Brushes.YellowGreen);
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:Initializers.cs

示例4: ChangeContainer

		/// <summary>
		/// Make the placed item switch the container.
		/// This method assumes that you already have checked if changing the container is possible.
		/// </summary>
		public void ChangeContainer(DesignItem newContainer)
		{
			if (newContainer == null)
				throw new ArgumentNullException("newContainer");
			if (isAborted || isCommitted)
				throw new InvalidOperationException("The operation is not running anymore.");
			if (currentContainer == newContainer)
				return;
			
			if (!currentContainerBehavior.CanLeaveContainer(this))
				throw new NotSupportedException("The items cannot be removed from their parent container.");
			
			try {
				currentContainerBehavior.LeaveContainer(this);
				
				GeneralTransform transform = currentContainer.View.TransformToVisual(newContainer.View);
				
				foreach (PlacementInformation info in placedItems) {
					info.OriginalBounds = TransformRectByMiddlePoint(transform, info.OriginalBounds);
					info.Bounds = TransformRectByMiddlePoint(transform, info.Bounds).Round();
				}
				
				currentContainer = newContainer;
				currentContainerBehavior = newContainer.GetBehavior<IPlacementBehavior>();
				
				Debug.Assert(currentContainerBehavior != null);
				currentContainerBehavior.EnterContainer(this);
			} catch (Exception ex) {
				Debug.WriteLine(ex.ToString());
				Abort();
				throw;
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:37,代码来源:PlacementOperation.cs

示例5: StartDrawItem

		public void StartDrawItem(DesignItem clickedOn, Type createItemType, IDesignPanel panel, System.Windows.Input.MouseEventArgs e)
		{
			var createdItem = CreateItem(panel.Context, createItemType);

			var startPoint = e.GetPosition(clickedOn.View);
			var operation = PlacementOperation.TryStartInsertNewComponents(clickedOn,
			                                                               new DesignItem[] { createdItem },
			                                                               new Rect[] { new Rect(startPoint.X, startPoint.Y, double.NaN, double.NaN) },
			                                                               PlacementType.AddItem);
			if (operation != null) {
				createdItem.Services.Selection.SetSelectedComponents(new DesignItem[] { createdItem });
				operation.Commit();
			}
			
			createdItem.Properties[Shape.StrokeProperty].SetValue(Brushes.Black);
			createdItem.Properties[Shape.StrokeThicknessProperty].SetValue(2d);
			createdItem.Properties[Shape.StretchProperty].SetValue(Stretch.None);
			
			var figure = new PathFigure();
			var geometry = new PathGeometry();
			var geometryDesignItem = createdItem.Services.Component.RegisterComponentForDesigner(geometry);
			var figureDesignItem = createdItem.Services.Component.RegisterComponentForDesigner(figure);
			createdItem.Properties[Path.DataProperty].SetValue(geometry);
			//geometryDesignItem.Properties[PathGeometry.FiguresProperty].CollectionElements.Add(figureDesignItem);
			figureDesignItem.Properties[PathFigure.StartPointProperty].SetValue(new Point(0,0));
			
			new DrawPathMouseGesture(figure, createdItem, clickedOn.View, changeGroup, this.ExtendedItem.GetCompleteAppliedTransformationToView()).Start(panel, (MouseButtonEventArgs) e);
		}
开发者ID:modulexcite,项目名称:WpfDesigner,代码行数:28,代码来源:DrawPathExtension.cs

示例6: OutlineNodeBase

		protected OutlineNodeBase(DesignItem designItem)
		{
			DesignItem = designItem;

			bool hidden = false;
			try
			{
				hidden = (bool)designItem.Properties.GetAttachedProperty(DesignTimeProperties.IsHiddenProperty).ValueOnInstance;
			}
			catch (Exception)
			{ }
			if (hidden) {
				_isDesignTimeVisible = false;
			}

			bool locked = false;
			try
			{
				locked = (bool)designItem.Properties.GetAttachedProperty(DesignTimeProperties.IsLockedProperty).ValueOnInstance;
			}
			catch (Exception)
			{ }
			if (locked) {
				_isDesignTimeLocked = true;
			}

			//TODO

			DesignItem.NameChanged += new EventHandler(DesignItem_NameChanged);
			DesignItem.PropertyChanged += new PropertyChangedEventHandler(DesignItem_PropertyChanged);
		}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:31,代码来源:OutlineNodeBase.cs

示例7: SetBindings

        public override void SetBindings(DesignItem item, FrameworkElement view)
        {
            base.SetBindings(item, view);

            view.SetBinding(FrameworkElement.VerticalAlignmentProperty, new Binding("Component.VerticalOptions") { Source = item, Converter = LayoutOptionsToVerticalAlignmentConverter.Instance });
            view.SetBinding(FrameworkElement.HorizontalAlignmentProperty, new Binding("Component.HorizontalOptions") { Source = item, Converter = LayoutOptionsToHorizontalAlignmentConverter.Instance });
        }
开发者ID:jogibear9988,项目名称:XamarinFormsXamlEditor,代码行数:7,代码来源:ViewExtension.cs

示例8: CanvasPositionHandle

		public CanvasPositionHandle(DesignItem adornedControlItem, AdornerPanel adornerPanel, HandleOrientation orientation)
		{
			Debug.Assert(adornedControlItem != null);
			this.adornedControlItem = adornedControlItem;
			this.adornerPanel = adornerPanel;
			this.orientation = orientation;

			Angle = (double) orientation;
			
			canvas = (Canvas) adornedControlItem.Parent.Component;
			adornedControl = (FrameworkElement) adornedControlItem.Component;
			Stub = new MarginStub(this);
			ShouldBeVisible = true;

			leftDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.LeftProperty,
			                                                           adornedControlItem.Component.GetType());
			leftDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
			rightDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.RightProperty,
			                                                            adornedControlItem.Component.GetType());
			rightDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
			topDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.TopProperty,
			                                                          adornedControlItem.Component.GetType());
			topDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
			bottomDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.BottomProperty,
			                                                             adornedControlItem.Component.GetType());
			bottomDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
			widthDescriptor = DependencyPropertyDescriptor.FromProperty(Control.WidthProperty,
			                                                            adornedControlItem.Component.GetType());
			widthDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
			heightDescriptor = DependencyPropertyDescriptor.FromProperty(Control.WidthProperty,
			                                                             adornedControlItem.Component.GetType());
			heightDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
			BindAndPlaceHandle();
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:34,代码来源:CanvasPositionHandle.cs

示例9: CreateView

        public override FrameworkElement CreateView(DesignItem item)
        {
            var tabcontrol = new System.Windows.Controls.TabControl();
            tabcontrol.Background = TransparentBrush.GetTransparentBrush();

            foreach (var collectionElement in item.ContentProperty.CollectionElements)
            {
                tabcontrol.Items.Add(collectionElement.View);
            }

            item.ContentProperty.CollectionElements.CollectionChanged += (sender, args) =>
            {
                if (args.Action == NotifyCollectionChangedAction.Add)
                {
                    foreach (DesignItem newItem in args.NewItems)
                    {
                        tabcontrol.Items.Add(newItem.View);
                    }
                }
                else if (args.Action == NotifyCollectionChangedAction.Remove)
                {
                    foreach (DesignItem oldItem in args.OldItems)
                    {
                        tabcontrol.Items.Remove(oldItem.View);
                    }
                }
            };

            return tabcontrol;
        }
开发者ID:jogibear9988,项目名称:XamarinFormsXamlEditor,代码行数:30,代码来源:TabbedPageView.cs

示例10: GetOutlineNodeName

		public string GetOutlineNodeName(DesignItem designItem)
		{
			if (string.IsNullOrEmpty(designItem.Name)) {
					return designItem.ComponentType.Name;
				}
				return designItem.ComponentType.Name + " (" + designItem.Name + ")";
		}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:7,代码来源:OutlineNodeNameService.cs

示例11: LoadItemsCollection

		public void LoadItemsCollection(DesignItem item)
		{
			Debug.Assert(item.View is ItemsControl);
			_item=item;
			_componentService=item.Services.Component;
			item.Services.Selection.SelectionChanged+= delegate { PropertyGridView.SelectedItems=item.Services.Selection.SelectedItems;  };
			var control=item.View as ItemsControl;
			if(control!=null){
				TypeMappings.TryGetValue(control.GetType(), out _type);
				if (_type != null) {
					IOutlineNode node = OutlineNode.Create(item);
					Outline.Root = node;
					PropertyGridView.PropertyGrid.SelectedItems = item.Services.Selection.SelectedItems;
				}
				else{
					PropertyGridView.IsEnabled=false;
					Outline.IsEnabled=false;
					AddItem.IsEnabled=false;
					RemoveItem.IsEnabled=false;
					MoveUpItem.IsEnabled=false;
					MoveDownItem.IsEnabled=false;
				}
			}
			
		}
开发者ID:modulexcite,项目名称:WpfDesigner,代码行数:25,代码来源:CollectionEditor.xaml.cs

示例12: PanelMoveAdorner

		public PanelMoveAdorner(DesignItem item)
		{
			this.item = item;
			
			scaleTransform = new ScaleTransform(1.0, 1.0);
			this.LayoutTransform = scaleTransform;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:PanelMoveAdorner.cs

示例13: 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

示例14: 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

示例15: ComparePositionInModelFile

		/// <summary>
		/// Compares the positions of a and b in the model file.
		/// </summary>
		public static int ComparePositionInModelFile(DesignItem a, DesignItem b)
		{
			// first remember all parent properties of a
			HashSet<DesignItemProperty> aProps = new HashSet<DesignItemProperty>();
			DesignItem tmp = a;
			while (tmp != null) {
				aProps.Add(tmp.ParentProperty);
				tmp = tmp.Parent;
			}
			
			// now walk up b's parent tree until a matching property is found
			tmp = b;
			while (tmp != null) {
				DesignItemProperty prop = tmp.ParentProperty;
				if (aProps.Contains(prop)) {
					if (prop.IsCollection) {
						return prop.CollectionElements.IndexOf(a).CompareTo(prop.CollectionElements.IndexOf(b));
					} else {
						return 0;
					}
				}
				tmp = tmp.Parent;
			}
			return 0;
		}
开发者ID:lvv83,项目名称:SharpDevelop,代码行数:28,代码来源:ModelTools.cs


注:本文中的DesignItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。