• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDrawableContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BindElement

		public void BindElement(IDrawableContainer dc) {
			DrawableContainer container = dc as DrawableContainer;
			if (container != null && !boundContainers.Contains(container)) {
				boundContainers.Add(container);
				container.ChildrenChanged += delegate {
					UpdateFromBoundElements();
				};
				UpdateFromBoundElements();
			}
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:10,代码来源:FieldAggregator.cs


示例2: AddElement

 /// <summary>
 /// Wrapper for makeUndoable flag which was introduced later, will call AddElement with makeundoable set to true
 /// </summary>
 /// <param name="element">the new element</param>
 public void AddElement(IDrawableContainer element)
 {
     AddElement(element, true);
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:8,代码来源:Surface.cs


示例3: DeselectElement

 public void DeselectElement(IDrawableContainer container)
 {
     DrawableContainer element = container as DrawableContainer;
     element.HideGrippers();
     element.Selected = false;
     selectedElements.Remove(element);
     FieldAggregator.UnbindElement(element);
     if (MovingElementChanged != null) {
         MovingElementChanged(this, selectedElements);
     }
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:11,代码来源:Surface.cs


示例4: AddElementMemento

 public AddElementMemento(Surface surface, IDrawableContainer drawableContainer)
 {
     _surface = surface;
     _drawableContainer = drawableContainer;
 }
开发者ID:RailTracker,项目名称:ShareX,代码行数:5,代码来源:AddElementMemento.cs


示例5: DrawableContainerBoundsChangeMemento

		public DrawableContainerBoundsChangeMemento(IDrawableContainer drawableContainer) {
			listOfdrawableContainer = new List<IDrawableContainer>();
			listOfdrawableContainer.Add(drawableContainer);
			StoreBounds();
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:5,代码来源:DrawableContainerBoundsChangeMemento.cs


示例6: UnbindElement

		public void UnbindElement(IDrawableContainer dc) {
			if (boundContainers.Contains(dc)) {
				boundContainers.Remove(dc);
				UpdateFromBoundElements();
			}
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:6,代码来源:FieldAggregator.cs


示例7: SelectElement

 /// <summary>
 /// Select the supplied element
 /// </summary>
 /// <param name="container"></param>
 public void SelectElement(IDrawableContainer container)
 {
     if (!selectedElements.Contains(container))
     {
         selectedElements.Add(container);
         container.ShowGrippers();
         container.Selected = true;
         FieldAggregator.BindElement(container);
         if (_movingElementChanged != null)
         {
             SurfaceElementEventArgs eventArgs = new SurfaceElementEventArgs();
             eventArgs.Elements = selectedElements;
             _movingElementChanged(this, eventArgs);
         }
         container.Invalidate();
     }
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:21,代码来源:Surface.cs


示例8: CountStepLabels

 /// <summary>
 /// Count all the VISIBLE steplabels in the surface, up to the supplied one
 /// </summary>
 /// <param name="stopAtContainer">can be null, if not the counting stops here</param>
 /// <returns>number of steplabels before the supplied container</returns>
 public int CountStepLabels(IDrawableContainer stopAtContainer)
 {
     int number = 1;
     foreach (var possibleThis in _stepLabels)
     {
         if (possibleThis == stopAtContainer)
         {
             break;
         }
         if (IsOnSurface(possibleThis))
         {
             number++;
         }
     }
     return number;
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:21,代码来源:Surface.cs


示例9: RemoveElement

 /// <summary>
 /// Remove an element of the elements list
 /// </summary>
 /// <param name="elementToRemove">Element to remove</param>
 /// <param name="makeUndoable">flag specifying if the remove needs to be undoable</param>
 public void RemoveElement(IDrawableContainer elementToRemove, bool makeUndoable)
 {
     DeselectElement(elementToRemove);
     _elements.Remove(elementToRemove);
     DrawableContainer element = elementToRemove as DrawableContainer;
     if (element != null)
     {
         element.FieldChanged -= element_FieldChanged;
     }
     elementToRemove.PropertyChanged -= ElementPropertyChanged;
     // Do not dispose, the memento should!! element.Dispose();
     Invalidate();
     if (makeUndoable)
     {
         MakeUndoable(new DeleteElementMemento(this, elementToRemove), false);
     }
     _modified = true;
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:23,代码来源:Surface.cs


示例10: IsOnSurface

 public bool IsOnSurface(IDrawableContainer container)
 {
     return _elements.Contains(container);
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:4,代码来源:Surface.cs


示例11: SelectElement

 public void SelectElement(IDrawableContainer container)
 {
     DrawableContainer element = container as DrawableContainer;
     if(!selectedElements.Contains(element)) {
         selectedElements.Add(element);
         element.ShowGrippers();
         element.Selected = true;
         FieldAggregator.BindElement(element);
         if (MovingElementChanged != null) {
             MovingElementChanged(this, selectedElements);
         }
         element.Invalidate();
     }
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:14,代码来源:Surface.cs


示例12: Dispose

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Count--;
                LOG.Debug("Disposing surface!");
                if (_buffer != null)
                {
                    _buffer.Dispose();
                    _buffer = null;
                }
                if (_transparencyBackgroundBrush != null)
                {
                    _transparencyBackgroundBrush.Dispose();
                    _transparencyBackgroundBrush = null;
                }

                // Cleanup undo/redo stacks
                while (_undoStack != null && _undoStack.Count > 0)
                {
                    _undoStack.Pop().Dispose();
                }
                while (_redoStack != null && _redoStack.Count > 0)
                {
                    _redoStack.Pop().Dispose();
                }
                foreach (IDrawableContainer container in _elements)
                {
                    container.Dispose();
                }
                if (_undrawnElement != null)
                {
                    _undrawnElement.Dispose();
                    _undrawnElement = null;
                }
                if (_cropContainer != null)
                {
                    _cropContainer.Dispose();
                    _cropContainer = null;
                }
            }
            base.Dispose(disposing);
        }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:43,代码来源:Surface.cs


示例13: ConfirmSelectedConfirmableElements

 /// <summary>
 /// This method is called to confirm/cancel "confirmable" elements, like the crop-container.
 /// Called when pressing enter or using the "check" in the editor.
 /// </summary>
 /// <param name="confirm"></param>
 public void ConfirmSelectedConfirmableElements(bool confirm)
 {
     // create new collection so that we can iterate safely (selectedElements might change due with confirm/cancel)
     List<IDrawableContainer> selectedDCs = new List<IDrawableContainer>(selectedElements);
     foreach (IDrawableContainer dc in selectedDCs)
     {
         if (dc.Equals(_cropContainer))
         {
             DrawingMode = DrawingModes.None;
             // No undo memento for the cropcontainer itself, only for the effect
             RemoveElement(_cropContainer, false);
             if (confirm)
             {
                 ApplyCrop(_cropContainer.Bounds);
             }
             _cropContainer.Dispose();
             _cropContainer = null;
         }
     }
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:25,代码来源:Surface.cs


示例14: DeselectElement

 /// <summary>
 /// Deselect the specified element
 /// </summary>
 /// <param name="container"></param>
 public void DeselectElement(IDrawableContainer container)
 {
     container.HideGrippers();
     container.Selected = false;
     selectedElements.Remove(container);
     FieldAggregator.UnbindElement(container);
     if (_movingElementChanged != null)
     {
         SurfaceElementEventArgs eventArgs = new SurfaceElementEventArgs();
         eventArgs.Elements = selectedElements;
         _movingElementChanged(this, eventArgs);
     }
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:17,代码来源:Surface.cs


示例15: BindAndUpdateElement

		public void BindAndUpdateElement(IDrawableContainer dc) {
			UpdateElement(dc);
			BindElement(dc);
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:4,代码来源:FieldAggregator.cs


示例16: ChangeFieldHolderMemento

		public ChangeFieldHolderMemento(IDrawableContainer drawableContainer, Field fieldToBeChanged) {
			this.drawableContainer = drawableContainer;
			this.fieldToBeChanged = fieldToBeChanged;
			oldValue = fieldToBeChanged.Value;
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:5,代码来源:ChangeFieldHolderMemento.cs


示例17: SurfaceMouseDown

        /// <summary>
        /// This event handler is called when someone presses the mouse on a surface.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SurfaceMouseDown(object sender, MouseEventArgs e)
        {
            _mouseStart = e.Location;

            // check contextmenu
            if (e.Button == MouseButtons.Right)
            {
                DrawableContainerList selectedList = null;
                if (selectedElements != null && selectedElements.Count > 0)
                {
                    selectedList = selectedElements;
                }
                else
                {
                    // Single element
                    IDrawableContainer rightClickedContainer = _elements.ClickableElementAt(_mouseStart.X, _mouseStart.Y);
                    if (rightClickedContainer != null)
                    {
                        selectedList = new DrawableContainerList(ID);
                        selectedList.Add(rightClickedContainer);
                    }
                }
                if (selectedList != null && selectedList.Count > 0)
                {
                    selectedList.ShowContextMenu(e, this);
                }
                return;
            }

            _mouseDown = true;
            _isSurfaceMoveMadeUndoable = false;

            if (_cropContainer != null && ((_undrawnElement == null) || (_undrawnElement != null && DrawingMode != DrawingModes.Crop)))
            {
                RemoveElement(_cropContainer, false);
                _cropContainer = null;
                _drawingElement = null;
            }

            if (_drawingElement == null && DrawingMode != DrawingModes.None)
            {
                if (_undrawnElement == null)
                {
                    DeselectAllElements();
                    if (_undrawnElement == null)
                    {
                        CreateUndrawnElement();
                    }
                }
                _drawingElement = _undrawnElement;
                // if a new element has been drawn, set location and register it
                if (_drawingElement != null)
                {
                    _drawingElement.Status = _undrawnElement.DefaultEditMode;
                    _drawingElement.PropertyChanged += ElementPropertyChanged;
                    if (!_drawingElement.HandleMouseDown(_mouseStart.X, _mouseStart.Y))
                    {
                        _drawingElement.Left = _mouseStart.X;
                        _drawingElement.Top = _mouseStart.Y;
                    }
                    AddElement(_drawingElement);
                    _drawingElement.Selected = true;
                }
                _undrawnElement = null;
            }
            else
            {
                // check whether an existing element was clicked
                // we save mouse down element separately from selectedElements (checked on mouse up),
                // since it could be moved around before it is actually selected
                _mouseDownElement = _elements.ClickableElementAt(_mouseStart.X, _mouseStart.Y);

                if (_mouseDownElement != null)
                {
                    _mouseDownElement.Status = EditStatus.MOVING;
                }
            }
        }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:83,代码来源:Surface.cs


示例18: UpdateElement

		public void UpdateElement(IDrawableContainer dc) {
			DrawableContainer container = dc as DrawableContainer;
			if (container == null) {
				return;
			}
			internalUpdateRunning = true;
			foreach(Field field in GetFields()) {
				if (container.HasField(field.FieldType) && field.HasValue) {
					//if(LOG.IsDebugEnabled) LOG.Debug("   "+field+ ": "+field.Value);
					container.SetFieldValue(field.FieldType, field.Value);
				}
			}
			internalUpdateRunning = false;
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:14,代码来源:FieldAggregator.cs


示例19: SurfaceMouseUp

        /// <summary>
        /// This event handle is called when the mouse button is unpressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SurfaceMouseUp(object sender, MouseEventArgs e)
        {
            Point currentMouse = new Point(e.X, e.Y);

            _elements.Status = EditStatus.IDLE;
            if (_mouseDownElement != null)
            {
                _mouseDownElement.Status = EditStatus.IDLE;
            }
            _mouseDown = false;
            _mouseDownElement = null;
            if (DrawingMode == DrawingModes.None)
            {
                // check whether an existing element was clicked
                IDrawableContainer element = _elements.ClickableElementAt(currentMouse.X, currentMouse.Y);
                bool shiftModifier = (ModifierKeys & Keys.Shift) == Keys.Shift;
                if (element != null)
                {
                    element.Invalidate();
                    bool alreadySelected = selectedElements.Contains(element);
                    if (shiftModifier)
                    {
                        if (alreadySelected)
                        {
                            DeselectElement(element);
                        }
                        else
                        {
                            SelectElement(element);
                        }
                    }
                    else
                    {
                        if (!alreadySelected)
                        {
                            DeselectAllElements();
                            SelectElement(element);
                        }
                    }
                }
                else if (!shiftModifier)
                {
                    DeselectAllElements();
                }
            }

            if (selectedElements.Count > 0)
            {
                selectedElements.ShowGrippers();
                selectedElements.Selected = true;
            }

            if (_drawingElement != null)
            {
                if (!_drawingElement.InitContent())
                {
                    _elements.Remove(_drawingElement);
                    _drawingElement.Invalidate();
                }
                else
                {
                    _drawingElement.HandleMouseUp(currentMouse.X, currentMouse.Y);
                    _drawingElement.Invalidate();
                    if (Math.Abs(_drawingElement.Width) < 5 && Math.Abs(_drawingElement.Height) < 5)
                    {
                        _drawingElement.Width = 25;
                        _drawingElement.Height = 25;
                    }
                    SelectElement(_drawingElement);
                    _drawingElement.Selected = true;
                }
                _drawingElement = null;
            }
        }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:79,代码来源:Surface.cs


示例20: DeleteElementMemento

 public DeleteElementMemento(Surface surface, IDrawableContainer drawableContainer)
 {
     this.surface = surface;
     this.drawableContainer = drawableContainer;
 }
开发者ID:Grifs99,项目名称:ShareX,代码行数:5,代码来源:DeleteElementMemento.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDrawingView类代码示例发布时间:2022-05-24
下一篇:
C# IDrawable类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap