本文整理汇总了C#中IDrawableContainer类的典型用法代码示例。如果您正苦于以下问题:C# IDrawableContainer类的具体用法?C# IDrawableContainer怎么用?C# IDrawableContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDrawableContainer类属于命名空间,在下文中一共展示了IDrawableContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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);
}
示例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);
}
}
示例4: AddElementMemento
public AddElementMemento(Surface surface, IDrawableContainer drawableContainer)
{
_surface = surface;
_drawableContainer = drawableContainer;
}
示例5: DrawableContainerBoundsChangeMemento
public DrawableContainerBoundsChangeMemento(IDrawableContainer drawableContainer) {
listOfdrawableContainer = new List<IDrawableContainer>();
listOfdrawableContainer.Add(drawableContainer);
StoreBounds();
}
示例6: UnbindElement
public void UnbindElement(IDrawableContainer dc) {
if (boundContainers.Contains(dc)) {
boundContainers.Remove(dc);
UpdateFromBoundElements();
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例10: IsOnSurface
public bool IsOnSurface(IDrawableContainer container)
{
return _elements.Contains(container);
}
示例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();
}
}
示例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);
}
示例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;
}
}
}
示例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);
}
}
示例15: BindAndUpdateElement
public void BindAndUpdateElement(IDrawableContainer dc) {
UpdateElement(dc);
BindElement(dc);
}