本文整理汇总了C#中Dock类的典型用法代码示例。如果您正苦于以下问题:C# Dock类的具体用法?C# Dock怎么用?C# Dock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dock类属于命名空间,在下文中一共展示了Dock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderSpiral
public void RenderSpiral ()
{
var dock = new Dock()
.AddChildren(
new Fill { Char = 'a', Width = 4, Margin = new Thickness(1, 1, 0, 1) }
.Set(Dock.ToProperty, DockTo.Left),
new Fill { Char = 'b', Height = 3, Margin = new Thickness(1, 1, 1, 0) }
.Set(Dock.ToProperty, DockTo.Top),
new Fill { Char = 'c', Width = 2, Margin = new Thickness(0, 1, 1, 1) }
.Set(Dock.ToProperty, DockTo.Right),
new Fill { Char = 'd', Height = 1, Margin = new Thickness(1, 0, 1, 1) }
.Set(Dock.ToProperty, DockTo.Bottom),
new Fill { Char = 'e', Margin = 1, Width = 2, Height = 2 }
);
GetRenderedText(dock, 12).Should().BeLines(
" ",
" aaaa bbbbb ",
" aaaa bbbbb ",
" aaaa bbbbb ",
" aaaa ",
" aaaa ee cc ",
" aaaa ee cc ",
" aaaa cc ",
" aaaa dd cc ",
" ");
}
示例2: BoardInjector
public BoardInjector()
{
dock = new Dock();
DockPath = new LinkedList<MainTrack>();
SavePath = new LinkedList<MainTrack>();
SecondPath = new LinkedList<MainTrack>();
ConSwitch = new ConvergingSwitch[5];
for (int x = 0; x < ConSwitch.Length; x++)
{
ConSwitch[x] = new ConvergingSwitch();
}
DevSwitch = new DevergingSwitch[5];
for (int x = 0; x < DevSwitch.Length; x++)
{
DevSwitch[x] = new DevergingSwitch();
}
Basis = new MainTrack[10];
for (int x = 0; x < Basis.Length; x++)
{
Basis[x] = new MainTrack();
}
Warehouses = new Warehouse[3];
for (int x = 0; x < Warehouses.Length; x++)
{
Warehouses[x] = new Warehouse();
}
}
示例3: ShowInWindow
/// <summary>
/// Maximum Flexibility of Window Definition version of Show In Window
/// </summary>
/// <param name="window">THe Window in which to show this View</param>
/// <param name="windowTitle">A Title for the Window</param>
/// <param name="windowWidth">The Width of the Window</param>
/// <param name="windowHeight">The Height of the Window</param>
/// <param name="dock">How should the View be Docked</param>
/// <param name="onWindowClosed">Event handler for when the window is closed</param>
public void ShowInWindow(bool modal, ViewWindow window, string windowTitle, double windowWidth, double windowHeight, Dock dock, OnWindowClose onWindowClose)
{
this.onWindowClosed = onWindowClose;
viewWindow = window;
viewWindow.Title = windowTitle;
DockPanel.SetDock(this, dock);
// The viewWindow must have a dockPanel called WindowDockPanel. If you want to change this to use some other container on the window, then
// the below code should be the only place it needs to be changed.
viewWindow.WindowDockPanel.Children.Add(this);
if (windowWidth == 0 && windowHeight == 0)
{
viewWindow.SizeToContent = SizeToContent.WidthAndHeight;
}
else
{
viewWindow.SizeToContent = SizeToContent.Manual;
viewWindow.Width = windowWidth;
viewWindow.Height = windowHeight;
}
if (modal)
{
viewWindow.ShowDialog();
}
else
{
viewWindow.Show();
}
}
示例4: Dispatch
//Undocks, sets crate, and triggers movement update
public void Dispatch(Crate crate, Dock port)
{
HeldCrate = crate;
Undock(port);
reverse = port == Pipe.To;
Move();
}
示例5: OnGrabberDocked
private void OnGrabberDocked(Dock port, Grabber grabber)
{
if(port == output && outputOverflow != null)
{
grabber.Dispatch(outputOverflow, port);
outputOverflow = null;
}
else if(inputA.DockedGrabbers.Count > 0
&& inputB.DockedGrabbers.Count > 0
&& output.DockedGrabbers.Count > 0)
{
Crate inCrateA = inputA.DockedGrabbers[0].HeldCrate;
Crate inCrateB = inputB.DockedGrabbers[0].HeldCrate;
int featuresMoved = Mathf.Min (Crate.MaxFeatures - inCrateA.Features.Count, inCrateB.Features.Count);
for(int i = 0; i < featuresMoved; i++)
{
inCrateA.Features.Add(inCrateB.Features[i]);
}
if(featuresMoved < inCrateB.Features.Count)
{
inCrateB.Features.RemoveRange (0, featuresMoved);
outputOverflow = inCrateB;
}
inputA.DockedGrabbers[0].Dispatch(null, inputA);
inputB.DockedGrabbers[0].Dispatch(null, inputB);
output.DockedGrabbers[0].Dispatch(inCrateA, output);
}
}
示例6: OnMouseDown
protected override void OnMouseDown(MouseButtonEventArgs e)
{
if (!IsEnabled) return;
if (!IsMouseCaptured)
{
StartDragPoint = e.GetPosition(Parent as IInputElement);
Panel ParentPanel = Parent as Panel;
int i = ParentPanel.Children.IndexOf(this);
// The splitter cannot be the first child of the parent DockPanel
// The splitter works on the 'older' sibling
if (i > 0 && ParentPanel.Children.Count > 0)
{
_element = ParentPanel.Children[i - 1] as FrameworkElement;
_element = ParentPanel.Children[i - 1] as FrameworkElement;
if (_element != null)
{
_width = _element.ActualWidth;
_height = _element.ActualHeight;
_dock = DockPanel.GetDock(this);
CaptureMouse();
}
}
}
base.OnMouseDown(e);
}
示例7: DockablePane
public DockablePane(ManagedContent content, Dock dock)
{
Dock = dock;
_tabs.TabStripPlacement = Dock.Bottom;
Add(content);
}
示例8: SetDock
/// <summary>
/// Sets the value of the Dock attached property to a specified element.
/// </summary>
/// <param name="element">The element to which the attached property is written.</param>
/// <param name="dock">The new Dock value.</param>
public static void SetDock(UIElement element, Dock dock)
{
if (element == null)
throw new ArgumentNullException("element");
element.SetValue(DockProperty, dock);
}
示例9: Add
public Pane Add(ManagedContent content, Dock dock)
{
DockablePane pane = new DockablePane(content, dock);
Add(pane);
return pane;
}
示例10: GrabberDocked
void GrabberDocked(Dock dock, Grabber grabber)
{
if (grabber.HeldCrate == null)
{
Quantity--;
grabber.Dispatch(new Crate(Crate), dock);
}
}
示例11: SlideMenu
public SlideMenu(Dock docking, double width = 0)
{
InitializeComponent();
Width = width;
Show();
Focus();
SetDock(docking);
Closed += SlideMenuClosed;
}
示例12: BindPorts
public void BindPorts(IList<Dock> inPorts, IList<Dock> outPorts)
{
inputA = inPorts[0];
inputB = inPorts[1];
output = outPorts[0];
inputA.OnGrabberDocked += OnGrabberDocked;
inputB.OnGrabberDocked += OnGrabberDocked;
output.OnGrabberDocked += OnGrabberDocked;
inputA.Effect = DockEffect.First;
inputB.Effect = DockEffect.Last;
}
示例13: BindPorts
public void BindPorts(IList<Dock> inPorts, IList<Dock> outPorts)
{
input = inPorts[0];
outputSingle = outPorts[0];
outputRemainder = outPorts[1];
input.OnGrabberDocked += OnGrabberDocked;
outputSingle.OnGrabberDocked += OnGrabberDocked;
outputRemainder.OnGrabberDocked += OnGrabberDocked;
outputSingle.Effect = DockEffect.Last;
outputRemainder.Effect = DockEffect.First;
}
示例14: OverlayDockablePane
public OverlayDockablePane(DockManager dockManager, DockableContent content, Dock initialDock)
: base(dockManager, initialDock)
{
btnAutoHide.LayoutTransform = new RotateTransform(90);
ReferencedPane = content.ContainerPane as DockablePane;
ReferencedContent = content;
Add(ReferencedContent);
Show(ReferencedContent);
ReferencedContent.SetContainerPane(ReferencedPane);
_state = PaneState.AutoHide;
}
示例15: GetAnchorForDock
public IPipeDisplayAnchor GetAnchorForDock(Dock dock)
{
//TODO: Make not O(N)
foreach(var anchor in pipeAnchors)
{
if(anchor.Dock == dock)
{
return anchor;
}
}
return null;
}