本文整理汇总了C#中System.Windows.SizeChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# SizeChangedEventArgs类的具体用法?C# SizeChangedEventArgs怎么用?C# SizeChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SizeChangedEventArgs类属于System.Windows命名空间,在下文中一共展示了SizeChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSizeChanged
private void OnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs)
{
if (this.ActualWidth < 700)
_viewModel.IsSideBarVisible = false;
else
_viewModel.IsSideBarVisible = true;
}
示例2: OnSizeChanged
private void OnSizeChanged(object sender, SizeChangedEventArgs e)
{
if (this.sizeHasBeenSet)
{
Controller.NotifyOfWindowSizeChange(new Point(ActualWidth, ActualHeight));
}
}
示例3: Page_SizeChanged
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Compare the current window to the ideal dimensions.
double heightRatio = this.ActualHeight / idealPageSize.Height;
double widthRatio = this.ActualWidth / idealPageSize.Width;
// Create the transform.
ScaleTransform scale = new ScaleTransform();
// Determine the smallest dimension.
// This preserves the aspect ratio.
if (heightRatio < widthRatio)
{
scale.ScaleX = heightRatio;
scale.ScaleY = heightRatio;
}
else
{
scale.ScaleX = widthRatio;
scale.ScaleY = widthRatio;
}
// Apply the transform.
this.RenderTransform = scale;
}
示例4: ContentGridSizeChanged
void ContentGridSizeChanged(object sender, SizeChangedEventArgs e)
{
this.sizeValue = this.mainWindow.ActualWidth <= this.mainWindow.ActualHeight ? this.mainWindow.ActualWidth : this.mainWindow.ActualHeight;
this.startButton.Width = this.sizeValue / 3.5;
this.startButton.Height = this.sizeValue / 3.5;
this.startButton.FontSize = this.mainWindow.ActualHeight / 17.5;
}
示例5: OpenGLControl_SizeChanged
/// <summary>
/// Handles the SizeChanged event of the OpenGLControl control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.SizeChangedEventArgs"/> instance containing the event data.</param>
void OpenGLControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Lock on OpenGL.
lock (gl)
{
int width = (int)e.NewSize.Width;
int height = (int)e.NewSize.Height;
gl.SetDimensions(width, height);
// Set the viewport.
gl.Viewport(0, 0, width, height);
// If we have a project handler, call it...
if (width != -1 && height != -1)
{
var handler = Resized;
if (handler != null)
handler(this, eventArgsFast);
else
{
// Otherwise we do our own projection.
gl.MatrixMode(SharpGL.OpenGL.GL_PROJECTION);
gl.LoadIdentity();
// Calculate The Aspect Ratio Of The Window
gl.Perspective(45.0f, (float)width / (float)height, 0.1f, 100.0f);
gl.MatrixMode(SharpGL.OpenGL.GL_MODELVIEW);
gl.LoadIdentity();
}
}
}
}
示例6: CalendarStrip_SizeChanged
void CalendarStrip_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.WidthChanged)
{
RecalculateDayWidth();
}
}
示例7: Home_SizeChanged
void Home_SizeChanged(object sender, SizeChangedEventArgs e)
{
PageScale.ScaleX = 1;
PageScale.ScaleY = 1;
// if the plugin is bigger than the minimum values set,
// scale the contents of the silverlight application
// get the ratios of plugin height/width to design-time height/width
double heightRatio = e.NewSize.Height / this.canvasRoot.Height;
double widthRatio = e.NewSize.Width / this.canvasRoot.Width;
// if the height ratio is smaller than the width ratio
if (heightRatio < widthRatio)
{
// set scale the content based on the height ratio
PageScale.ScaleX = heightRatio;
PageScale.ScaleY = heightRatio;
}
// if not, set scale based on the width ratio
else
{
PageScale.ScaleX = widthRatio;
PageScale.ScaleY = widthRatio;
}
// scale the content
this.canvasRoot.RenderTransform = PageScale;
}
示例8: PlusMinusButton_SizeChanged
void PlusMinusButton_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (m_brdrPlus != null)
{
double marg = Math.Round(Math.Max(1, this.ActualWidth / 9));
m_brdrPlus.Width = marg;
m_brdrPlus.Margin = new Thickness(0, marg, 0, marg);
}
if (m_brdrMinus != null)
{
double marg = Math.Round(Math.Max(1, this.ActualHeight / 9));
m_brdrMinus.Height = marg;
m_brdrMinus.Margin = new Thickness(marg, 0, marg, 0);
}
//border.BorderThickness = new Thickness(Math.Round(Math.Max(1, this.ActualHeight / 15)));
//LayoutRoot.Margin = new Thickness(Math.Round(Math.Max(1, (2 * this.ActualHeight / 15))));
////if (this.ActualHeight % 2 != 0)
//{
// LayoutRoot.ColumnDefinitions[1].Width = new GridLength(Math.Round(Math.Max(1, this.ActualHeight / 15)));
// LayoutRoot.RowDefinitions[1].Height = new GridLength(Math.Round(Math.Max(1, this.ActualHeight / 15)));
// //line1.StrokeThickness = 0.5 * this.ActualHeight / 13;
// //line2.StrokeThickness = 0.5 * this.ActualHeight / 13;
// border1.BorderThickness = new Thickness(Math.Round(Math.Max(1, this.ActualHeight / 15)));
// border2.BorderThickness = new Thickness(Math.Round(Math.Max(1, this.ActualHeight / 15)));
//}
}
示例9: onGridSizeChanged
private void onGridSizeChanged(object sender, SizeChangedEventArgs e) {
Debug.WriteLine("width: " + LayoutRoot.ActualWidth + " height: " + LayoutRoot.ActualHeight);
if (ball == null) {
float width = (float)LayoutRoot.ActualWidth;
float height = (float)LayoutRoot.ActualHeight;
ballBody = BodyFactory.CreateBody(world, new Vector2(ConvertUnits.ToSimUnits(width / 2f), ConvertUnits.ToSimUnits(height / 2f)));
ballBody.BodyType = BodyType.Dynamic;
ballBody.LinearDamping = 1f;
CircleShape circleShape = new CircleShape(ConvertUnits.ToSimUnits(8f), 1f);
Fixture fixture = ballBody.CreateFixture(circleShape);
fixture.OnCollision += OnBalCollision;
ball = new Ball(canvas, 8, new System.Windows.Point(width / 2f, height / 2f));
}
if (level == null) {
level = new Level(currentLevel, canvas);
Body wallBody;
System.Windows.Point position;
foreach (Wall wall in level.getWalls()) {
position = wall.getPosition();
wallBody = BodyFactory.CreateRectangle(
world,
ConvertUnits.ToSimUnits(wall.getWidth()),
ConvertUnits.ToSimUnits(wall.getHeight()),
0.001f,
new Vector2(ConvertUnits.ToSimUnits(position.X + wall.getWidth() / 2f), ConvertUnits.ToSimUnits(position.Y + wall.getHeight() / 2f))
);
wallBody.Restitution = 0.25f;
}
ballBody.Position = new Vector2(ConvertUnits.ToSimUnits(level.getStart().X), ConvertUnits.ToSimUnits(level.getStart().Y));
ball.setPosition(new System.Windows.Point(ConvertUnits.ToDisplayUnits(ballBody.Position.X), ConvertUnits.ToDisplayUnits(ballBody.Position.Y)));
}
}
示例10: OnHelpPageSizeChanged
private void OnHelpPageSizeChanged(object sender, SizeChangedEventArgs e)
{
if (helpViewer != null && helpViewer.IsInitialized)
{
//helpViewer.Width = e.NewSize.Width;
}
}
示例11: ChangePictureSize
private void ChangePictureSize(object sender, SizeChangedEventArgs e)
{
mainCanva.Width = mainGrid.ActualWidth - 175;
mainCanva.Height = mainGrid.ActualHeight;
schema.Width = mainGrid.ActualWidth - 175;
schema.Height = mainGrid.ActualHeight;
}
示例12: ControlHostElement_SizeChanged
private void ControlHostElement_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (device != null)
{
needsResizing = true;
}
}
示例13: LoadingBar_SizeChanged
private void LoadingBar_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (IsLoading)
{
Start(false);
}
}
示例14: MainWindow_SizeChanged
private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (WindowState == WindowState.Minimized)
{
this.ShowInTaskbar = false;
}
}
示例15: ContentControl_SizeChanged
private void ContentControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (this.ClipContent)
{
this.UpdateClipSize(new Size(base.ActualWidth, base.ActualHeight));
}
}