本文整理汇总了C#中System.Windows.Controls.DockPanel.Arrange方法的典型用法代码示例。如果您正苦于以下问题:C# DockPanel.Arrange方法的具体用法?C# DockPanel.Arrange怎么用?C# DockPanel.Arrange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.DockPanel
的用法示例。
在下文中一共展示了DockPanel.Arrange方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DockPanelLayoutTest
public void DockPanelLayoutTest()
{
DockPanel panel = new DockPanel();
panel.InvalidateMeasure();
FrameworkElement child1 = new FrameworkElement { Width = 100 };
FrameworkElement child2 = new FrameworkElement { Height = 100 };
FrameworkElement child3 = new FrameworkElement { Width = 100 };
FrameworkElement child4 = new FrameworkElement { Height = 100 };
FrameworkElement child5 = new FrameworkElement();
panel.Children.Add(child1);
panel.Children.Add(child2);
panel.Children.Add(child3);
panel.Children.Add(child4);
panel.Children.Add(child5);
DockPanel.SetDock(child1, Dock.Left);
DockPanel.SetDock(child2, Dock.Top);
DockPanel.SetDock(child3, Dock.Right);
DockPanel.SetDock(child4, Dock.Bottom);
panel.Measure(new Size(1000, 1000));
Assert.AreEqual(new Size(200, 200), panel.DesiredSize);
panel.Arrange(new Rect(1000, 1000));
Assert.AreEqual(new Size(1000, 1000), panel.VisualSize);
Assert.AreEqual(new Size(100, 1000), child1.VisualSize);
Assert.AreEqual(new Size(900, 100), child2.VisualSize);
Assert.AreEqual(new Size(100, 900), child3.VisualSize);
Assert.AreEqual(new Size(800, 100), child4.VisualSize);
Assert.AreEqual(new Size(800, 800), child5.VisualSize);
Assert.AreEqual(new Point(0, 0), child1.VisualOffset);
Assert.AreEqual(new Point(100, 0), child2.VisualOffset);
Assert.AreEqual(new Point(900, 100), child3.VisualOffset);
Assert.AreEqual(new Point(100, 900), child4.VisualOffset);
Assert.AreEqual(new Point(100, 100), child5.VisualOffset);
}
示例2: printMenuItem_Click
/*
* printMenuItem_Click
* Handles the printMenuItem_Click event - builds a DockPanel showing the sample grid and other stuff for print format - then sends to a PrintDlg
*
*/
private void printMenuItem_Click(object sender, RoutedEventArgs e)
{
Grid printSampleGrid = new Grid();
printSampleGrid.Name = "printSampleGrid";
printSampleGrid.ShowGridLines = false;
RowDefinition sampleRowdef1 = new RowDefinition();
sampleRowdef1.Height = new GridLength(1, GridUnitType.Star);
RowDefinition sampleRowdef2 = new RowDefinition();
sampleRowdef2.Height = new GridLength(1, GridUnitType.Star);
RowDefinition sampleRowdef3 = new RowDefinition();
sampleRowdef3.Height = new GridLength(1, GridUnitType.Star);
RowDefinition sampleRowdef4 = new RowDefinition();
sampleRowdef4.Height = new GridLength(1, GridUnitType.Star);
RowDefinition sampleRowdef5 = new RowDefinition();
sampleRowdef5.Height = new GridLength(1, GridUnitType.Star);
RowDefinition sampleRowdef6 = new RowDefinition();
sampleRowdef6.Height = new GridLength(1, GridUnitType.Star);
ColumnDefinition sampleColdef1 = new ColumnDefinition();
sampleColdef1.Width = new GridLength(1, GridUnitType.Star);
ColumnDefinition sampleColdef2 = new ColumnDefinition();
sampleColdef2.Width = new GridLength(1, GridUnitType.Star);
ColumnDefinition sampleColdef3 = new ColumnDefinition();
sampleColdef3.Width = new GridLength(1, GridUnitType.Star);
ColumnDefinition sampleColdef4 = new ColumnDefinition();
sampleColdef4.Width = new GridLength(1, GridUnitType.Star);
ColumnDefinition sampleColdef5 = new ColumnDefinition();
sampleColdef5.Width = new GridLength(1, GridUnitType.Star);
printSampleGrid.RowDefinitions.Add(sampleRowdef1);
printSampleGrid.RowDefinitions.Add(sampleRowdef2);
printSampleGrid.RowDefinitions.Add(sampleRowdef3);
printSampleGrid.RowDefinitions.Add(sampleRowdef4);
printSampleGrid.RowDefinitions.Add(sampleRowdef5);
printSampleGrid.RowDefinitions.Add(sampleRowdef6);
printSampleGrid.ColumnDefinitions.Add(sampleColdef1);
printSampleGrid.ColumnDefinitions.Add(sampleColdef2);
printSampleGrid.ColumnDefinitions.Add(sampleColdef3);
printSampleGrid.ColumnDefinitions.Add(sampleColdef4);
printSampleGrid.ColumnDefinitions.Add(sampleColdef5);
addStationControlToGrid(printSampleGrid);
colorDisabledStations(printSampleGrid);
updateSampleGrid(printSampleGrid);
DockPanel printDockPanel = new DockPanel();
printDockPanel.Margin = new Thickness(80, 60, 80, 60);
TextBlock nameLabelText = new TextBlock();
nameLabelText.Text = "Name: ________________________________";
nameLabelText.Padding = new Thickness(20, 0, 0, 20);
nameLabelText.FontSize = 20;
printDockPanel.Children.Add(nameLabelText);
DockPanel.SetDock(nameLabelText, Dock.Top);
printDockPanel.Children.Add(printSampleGrid);
DockPanel.SetDock(printSampleGrid, Dock.Bottom);
PrintDialog printDlg = new PrintDialog();
if (printDlg.ShowDialog() == true)
{
var printCapabilities = printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket);
var size = new Size(printCapabilities.PageImageableArea.ExtentWidth,
printCapabilities.PageImageableArea.ExtentHeight);
printDockPanel.Measure(size);
printDockPanel.Arrange(new Rect(new Point(printCapabilities.PageImageableArea.OriginWidth,
printCapabilities.PageImageableArea.OriginHeight), size));
try
{
printDlg.PrintVisual(printDockPanel, "Adherent Oven Sample Run");
}
catch (Exception ex)
{
logger.Warn("Error occurred while printing", ex);
MessageBox.Show("Error occurred while printing - check log for details");
}
}
}
示例3: FindDiagnosis
//.........这里部分代码省略.........
panelallprocedure.Children.Add(panelprocedure1);
var procedure1 = procedure;
labelprocedure.MouseDoubleClick += (o, args) =>
{
var form = new WorkerInfo(procedure1.IdWorker);
form.ShowDialog();
};
}
if (intProcedure != 0)
{
var gradient = new LinearGradientBrush {StartPoint = new Point(0, 0), EndPoint = new Point(1, 1)};
var buttonopenprocedure = new Button
{
Background = gradient,
Foreground = Brushes.MediumBlue,
FontWeight = FontWeights.Bold,
Content = "Переглянути процедури",
Height = 20,
Width = 450
};
gradient.GradientStops.Add(new GradientStop
{
Color = Color.FromArgb(255, 249, 249, 200),
Offset = 0
});
gradient.GradientStops.Add(new GradientStop
{
Color = Color.FromArgb(255, 251, 228, 0),
Offset = 1
});
DockPanel.SetDock(buttonopenprocedure, Dock.Bottom);
paneldiagnosis1.Children.Add(buttonopenprocedure);
panelallprocedure.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
panelallprocedure.Arrange(new Rect(new Point(0, 0), panelallprocedure.DesiredSize));
var panelHeight = panelallprocedure.ActualHeight;
panelallprocedure.Height = 0;
var isToggle = new bool();
buttonopenprocedure.Click += (o, args) =>
{
var da = new DoubleAnimation();
if (!isToggle)
{
da.From = 450;
da.To = 800;
da.Duration = TimeSpan.FromSeconds(0.5);
buttonopenprocedure.BeginAnimation(WidthProperty, da);
da.From = 0;
da.To = panelHeight;
da.Duration = TimeSpan.FromSeconds(0.5);
panelallprocedure.BeginAnimation(HeightProperty, da);
isToggle = true;
buttonopenprocedure.Content = "Закрити";
}
else
{
da.From = 800;
da.To = 450;
da.Duration = TimeSpan.FromSeconds(0.5);
buttonopenprocedure.BeginAnimation(WidthProperty, da);
da.From = panelHeight;
da.To = 0;
da.Duration = TimeSpan.FromSeconds(0.5);
panelallprocedure.BeginAnimation(HeightProperty, da);
isToggle = false;
buttonopenprocedure.Content = "Переглянути процедури";
示例4: FindVisit
//.........这里部分代码省略.........
var analysis1 = analysis;
labelanalysis.MouseDoubleClick += (o, args) =>
{
var form = new WorkerInfo(analysis1.IdWorker);
form.ShowDialog();
};
}
if (intAnalysis != 0)
{
var gradient = new LinearGradientBrush {StartPoint = new Point(0, 0), EndPoint = new Point(1, 1)};
var buttonopenanalisis = new Button
{
Background = gradient,
Foreground = Brushes.MediumBlue,
FontWeight = FontWeights.Bold,
Content = "Переглянути аналізи",
Height = 20,
Width = 450
};
gradient.GradientStops.Add(new GradientStop
{
Color = Color.FromArgb(255, 249, 249, 200),
Offset = 0
});
gradient.GradientStops.Add(new GradientStop
{
Color = Color.FromArgb(255, 251, 228, 0),
Offset = 1
});
DockPanel.SetDock(buttonopenanalisis, Dock.Bottom);
panelvisit1.Children.Add(buttonopenanalisis);
panelallanalysis.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
panelallanalysis.Arrange(new Rect(new Point(0, 0), panelallanalysis.DesiredSize));
var panelHeight = panelallanalysis.ActualHeight;
panelallanalysis.Height = 0;
var isToggle = new bool();
buttonopenanalisis.Click += (o, args) =>
{
var da = new DoubleAnimation();
if (!isToggle)
{
da.From = 450;
da.To = 800;
da.Duration = TimeSpan.FromSeconds(0.5);
buttonopenanalisis.BeginAnimation(WidthProperty, da);
da.From = 0;
da.To = panelHeight;
da.Duration = TimeSpan.FromSeconds(0.5);
panelallanalysis.BeginAnimation(HeightProperty, da);
isToggle = true;
buttonopenanalisis.Content = "Закрити";
}
else
{
da.From = 800;
da.To = 450;
da.Duration = TimeSpan.FromSeconds(0.5);
buttonopenanalisis.BeginAnimation(WidthProperty, da);
da.From = panelHeight;
da.To = 0;
da.Duration = TimeSpan.FromSeconds(0.5);
panelallanalysis.BeginAnimation(HeightProperty, da);
isToggle = false;
buttonopenanalisis.Content = "Переглянути аналізи";
示例5: FindVisit
//.........这里部分代码省略.........
analysis.AnalysisDateOnset,
analysis.Snp),
Margin = new Thickness(10, 10, 10, 10),
};
intAnalysis = intAnalysis + 1;
DockPanel.SetDock(panelanalysis1, Dock.Top);
DockPanel.SetDock(panelanalysis, Dock.Top);
DockPanel.SetDock(labelanalysis, Dock.Top);
panelanalysis.Children.Add(labelanalysis);
panelanalysis1.Children.Add(panelanalysis);
panelallanalysis.Children.Add(panelanalysis1);
var analysis1 = analysis;
labelanalysis.MouseDoubleClick += (o, args) =>
{
PatientInfo form = new PatientInfo(analysis1.IdPatient);
form.ShowDialog();
};
}
}
if (intAnalysis != 0)
{
LinearGradientBrush gradient = new LinearGradientBrush();
gradient.StartPoint = new Point(0, 0);
gradient.EndPoint = new Point(1, 1);
Button buttonopenanalisis = new Button
{
Background = gradient,
Foreground = Brushes.MediumBlue,
FontWeight = FontWeights.Bold,
Content = "Переглянути аналізи",
Height = 20,
Width = 450
};
gradient.GradientStops.Add(new GradientStop()
{
Color = Color.FromArgb(255, 249, 249, 200),
Offset = 0
});
gradient.GradientStops.Add(new GradientStop()
{
Color = Color.FromArgb(255, 251, 228, 0),
Offset = 1
});
DockPanel.SetDock(buttonopenanalisis, Dock.Bottom);
panelvisit1.Children.Add(buttonopenanalisis);
panelallanalysis.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
panelallanalysis.Arrange(new Rect(new Point(0, 0), panelallanalysis.DesiredSize));
double panelHeight = panelallanalysis.ActualHeight;
panelallanalysis.Height = 0;
bool isToggle = new bool();
buttonopenanalisis.Click += (o, args) =>
{
DoubleAnimation da = new DoubleAnimation();
if (!isToggle)
{
da.From = 450;
da.To = 800;
da.Duration = TimeSpan.FromSeconds(1);
buttonopenanalisis.BeginAnimation(WidthProperty, da);
da.From = 0;
da.To = panelHeight;
da.Duration = TimeSpan.FromSeconds(1);
panelallanalysis.BeginAnimation(HeightProperty, da);
isToggle = true;
buttonopenanalisis.Content = "Закрити";
}
else
{
da.From = 800;
da.To = 450;
da.Duration = TimeSpan.FromSeconds(1);
buttonopenanalisis.BeginAnimation(WidthProperty, da);
da.From = panelHeight;
da.To = 0;
da.Duration = TimeSpan.FromSeconds(1);
panelallanalysis.BeginAnimation(HeightProperty, da);
isToggle = false;
buttonopenanalisis.Content = "Переглянути процедури";
}
};
}
DockPanel.SetDock(panelvisit1, Dock.Top);
DockPanel.SetDock(panelallanalysis, Dock.Top);
DockPanel.SetDock(panelvisit, Dock.Top);
DockPanel.SetDock(labelvisit, Dock.Top);
panelvisit.Children.Add(labelvisit);
panelvisit1.Children.Add(panelvisit);
panelvisit1.Children.Add(panelallanalysis);
panelAllVisit.Children.Add(panelvisit1);
var visit1 = visit;
labelvisit.MouseDoubleClick += (o, args) =>
{
PatientInfo form = new PatientInfo(visit1.IdPatient);
form.ShowDialog();
};
PatientsPanel.Visibility = Visibility.Visible;
}
}
示例6: FindDiagnosis
//.........这里部分代码省略.........
procedure.DateOnset,
procedure.Snp),
Margin = new Thickness(10, 10, 10, 10),
};
intProcedure = intProcedure + 1;
DockPanel.SetDock(panelprocedure1, Dock.Top);
DockPanel.SetDock(panelprocedure, Dock.Top);
DockPanel.SetDock(labelprocedure, Dock.Top);
panelprocedure.Children.Add(labelprocedure);
panelprocedure1.Children.Add(panelprocedure);
panelallprocedure.Children.Add(panelprocedure1);
var procedure1 = procedure;
labelprocedure.MouseDoubleClick += (o, args) =>
{
PatientInfo form = new PatientInfo(procedure1.IdPatient);
form.ShowDialog();
};
}
}
if (intProcedure != 0)
{
LinearGradientBrush gradient = new LinearGradientBrush();
gradient.StartPoint = new Point(0, 0);
gradient.EndPoint = new Point(1, 1);
Button buttonopenprocedure = new Button
{
Background = gradient,
Foreground = Brushes.MediumBlue,
FontWeight = FontWeights.Bold,
Content = "Переглянути процедури",
Height = 20,
Width = 450
};
gradient.GradientStops.Add(new GradientStop()
{
Color = Color.FromArgb(255, 249, 249, 200),
Offset = 0
});
gradient.GradientStops.Add(new GradientStop()
{
Color = Color.FromArgb(255, 251, 228, 0),
Offset = 1
});
DockPanel.SetDock(buttonopenprocedure, Dock.Bottom);
paneldiagnosis1.Children.Add(buttonopenprocedure);
panelallprocedure.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
panelallprocedure.Arrange(new Rect(new Point(0, 0), panelallprocedure.DesiredSize));
double panelHeight = panelallprocedure.ActualHeight;
panelallprocedure.Height = 0;
bool isToggle = new bool();
buttonopenprocedure.Click += (o, args) =>
{
DoubleAnimation da = new DoubleAnimation();
if (!isToggle)
{
da.From = 450;
da.To = 800;
da.Duration = TimeSpan.FromSeconds(1);
buttonopenprocedure.BeginAnimation(WidthProperty, da);
da.From = 0;
da.To = panelHeight;
da.Duration = TimeSpan.FromSeconds(1);
panelallprocedure.BeginAnimation(HeightProperty, da);
isToggle = true;
buttonopenprocedure.Content = "Закрити";
}
else
{
da.From = 800;
da.To = 450;
da.Duration = TimeSpan.FromSeconds(1);
buttonopenprocedure.BeginAnimation(WidthProperty, da);
da.From = panelHeight;
da.To = 0;
da.Duration = TimeSpan.FromSeconds(1);
panelallprocedure.BeginAnimation(HeightProperty, da);
isToggle = false;
buttonopenprocedure.Content = "Переглянути процедури";
}
};
}
DockPanel.SetDock(paneldiagnosis1, Dock.Top);
DockPanel.SetDock(panelallprocedure, Dock.Top);
DockPanel.SetDock(paneldiagnosis, Dock.Top);
DockPanel.SetDock(labeldiagnosis, Dock.Top);
paneldiagnosis.Children.Add(labeldiagnosis);
paneldiagnosis1.Children.Add(paneldiagnosis);
paneldiagnosis1.Children.Add(panelallprocedure);
panelAllDiagnosis.Children.Add(paneldiagnosis1);
var disease1 = disease;
labeldiagnosis.MouseDoubleClick += (o, args) =>
{
PatientInfo form = new PatientInfo(disease1.IdPatient);
form.ShowDialog();
};
PatientsPanel.Visibility = Visibility.Visible;
}
}