- Свойство Window. Height (Word) Window.Height property (Word)
- Синтаксис Syntax
- Примечания Remarks
- Пример Example
- См. также See also
- Поддержка и обратная связь Support and feedback
- Console. Window Width Свойство
- Определение
- Значение свойства
- Исключения
- Примеры
- Комментарии
- Console. Window Height Свойство
- Определение
- Значение свойства
- Исключения
- Примеры
- Комментарии
- Window.Height Property
- Syntax
- Property Value
- Exceptions
- Remarks
- Examples
- Window. Size ToContent Свойство
- Определение
- Значение свойства
- Примеры
- Комментарии
Свойство Window. Height (Word) Window.Height property (Word)
Возвращает или задает высоту окна (в пунктах). Returns or sets the height of the window (in points). Для чтения и записи, Long. Read/write Long.
Синтаксис Syntax
Expression. Height (высота ) expression.Height
Expression (выражение ) Переменная, представляющая объект Window . expression A variable that represents a Window object.
Примечания Remarks
Невозможно задать это свойство, если окно развернуто или свернуто. You cannot set this property if the window is maximized or minimized. Используйте свойство UsableHeight объекта Application , чтобы определить максимальный размер окна. Use the UsableHeight property of the Application object to determine the maximum size for the window. Чтобы определить состояние окна, используйте свойство WindowState . Use the WindowState property to determine the window state.
Пример Example
В этом примере показано изменение высоты активного окна для заполнения области окна приложения. This example changes the height of the active window to fill the application window area.
См. также See also
Поддержка и обратная связь Support and feedback
Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Have questions or feedback about Office VBA or this documentation? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь. Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Console. Window Width Свойство
Определение
Возвращает или задает ширину окна консоли. Gets or sets the width of the console window.
Значение свойства
Ширина окна консоли измеряется столбцами. The width of the console window measured in columns.
Исключения
Значение свойства WindowWidth или WindowHeight не больше 0. The value of the WindowWidth property or the value of the WindowHeight property is less than or equal to 0.
Сумма значений свойств WindowHeight и WindowTop больше или равна MaxValue. The value of the WindowHeight property plus the value of the WindowTop property is greater than or equal to MaxValue.
Значение свойства WindowWidth или WindowHeight больше максимально возможной ширины или высоты окна для текущего разрешения экрана и шрифта консоли. The value of the WindowWidth property or the value of the WindowHeight property is greater than the largest possible window width or height for the current screen resolution and console font.
Ошибка при чтении или записи данных. Error reading or writing information.
Операция задания вызывается в операционной системе, отличной от Windows. The set operation is invoked on an operating system other than Windows.
Примеры
В этом примере демонстрируется SetWindowSize метод, а WindowWidth также WindowHeight Свойства и. This example demonstrates the SetWindowSize method, and the WindowWidth and WindowHeight properties. Чтобы увидеть полный результат изменения размера окна консоли, необходимо выполнить пример. You must run the example to see the full effect of changing the console window size.
Пример сообщает размерам окна консоли, для которых задано значение 85 столбцов и 43 строк, а затем ожидает нажатия клавиши. The example reports the dimensions of a console window set to 85 columns and 43 rows, then waits for a key press. При нажатии любой клавиши размеры окна консоли увеличиваются вдвое, выводятся новые измерения, а в примере ожидается еще один нажатие клавиши. When any key is pressed, the dimensions of the console window are halved, the new dimensions are reported, and the example waits for another key press. Наконец, при нажатии любой клавиши окно консоли восстанавливается до исходных измерений, а пример завершается. Finally, when any key is pressed the console window is restored to its original dimensions and the example terminates.
Комментарии
Попытка задать значение WindowWidth свойства при перенаправлении вывода вызывает исключение ArgumentOutOfRangeException или IOException . Attempting to set the value of the WindowWidth property when output is redirected throws either an ArgumentOutOfRangeException or an IOException exception. Чтобы предотвратить исключение, значение этого свойства можно задать только в том случае, если IsOutputRedirected свойство возвращает false . To prevent an exception, you can set the value of this property only if the IsOutputRedirected property returns false .
Console. Window Height Свойство
Определение
Возвращает или задает высоту области окна консоли. Gets or sets the height of the console window area.
Значение свойства
Высота окна консоли измеряется строками. The height of the console window measured in rows.
Исключения
Значение свойства WindowWidth или WindowHeight не больше 0. The value of the WindowWidth property or the value of the WindowHeight property is less than or equal to 0.
Сумма значений свойств WindowHeight и WindowTop больше или равна MaxValue. The value of the WindowHeight property plus the value of the WindowTop property is greater than or equal to MaxValue.
Значение свойства WindowWidth или WindowHeight больше максимально возможной ширины или высоты окна для текущего разрешения экрана и шрифта консоли. The value of the WindowWidth property or the value of the WindowHeight property is greater than the largest possible window width or height for the current screen resolution and console font.
Ошибка при чтении или записи данных. Error reading or writing information.
Операция задания вызывается в операционной системе, отличной от Windows. The set operation is invoked on an operating system other than Windows.
Примеры
В этом примере демонстрируется SetWindowSize метод, а WindowWidth также WindowHeight Свойства и. This example demonstrates the SetWindowSize method, and the WindowWidth and WindowHeight properties. Чтобы увидеть полный результат изменения размера окна консоли, необходимо выполнить пример. You must run the example to see the full effect of changing the console window size.
Пример сообщает размерам окна консоли, для которых задано значение 85 столбцов и 43 строк, а затем ожидает нажатия клавиши. The example reports the dimensions of a console window set to 85 columns and 43 rows, then waits for a key press. При нажатии любой клавиши размеры окна консоли увеличиваются вдвое, выводятся новые измерения, а в примере ожидается еще один нажатие клавиши. When any key is pressed, the dimensions of the console window are halved, the new dimensions are reported, and the example waits for another key press. Наконец, при нажатии любой клавиши окно консоли восстанавливается до исходных измерений, а пример завершается. Finally, when any key is pressed the console window is restored to its original dimensions and the example terminates.
Комментарии
Попытка задать значение WindowHeight свойства при перенаправлении вывода вызывает исключение ArgumentOutOfRangeException или IOException . Attempting to set the value of the WindowHeight property when output is redirected throws either an ArgumentOutOfRangeException or an IOException exception. Чтобы предотвратить исключение, значение этого свойства можно задать только в том случае, если IsOutputRedirected свойство возвращает false . To prevent an exception, you can set the value of this property only if the IsOutputRedirected property returns false .
Window.Height Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets or sets the height of the application window in pixels.
Namespace: В System.Windows
Assembly: В System.Windows (in System.Windows.dll)
Syntax
Property Value
Type: System.Double
The height of the application window in pixels. The default is the WindowSettings.Height setting in the application manifest.
Exceptions
The application is not running outside the browser.
The current thread is not the user interface (UI) thread.
When setting this property, except in response to a user-initiated action, the Application.Startup event has already occurred and Application.HasElevatedPermissions is false.
The specified value when setting this property is greater than the available screen height.
Remarks
You can set this property only in the following cases:
In response to a user-initiated action, for example, in a button Click event handler.
In a trusted application.
The minimum window height is dictated by the operating system. If you set this property to a value below this minimum, the value is ignored.
Examples
The following code example demonstrates the use of this property. In this example, the window position and dimensions were previously saved to the ApplicationSettings in the isolated storage as a user defined key/value pair. These key/value pairs are retrieved and used to set the current value of the window settings.
Window. Size ToContent Свойство
Определение
Возвращает или задает значение, указывающее, изменится ли автоматически размер окна в соответствии с размером его содержимого. Gets or sets a value that indicates whether a window will automatically size itself to fit the size of its content.
Значение свойства
Значение SizeToContent. A SizeToContent value. Значение по умолчанию — Manual. The default is Manual.
Примеры
В следующем примере показано, как задать SizeToContent свойство в коде, чтобы указать, как размер окна изменяется в соответствии с содержимым. The following example shows how to set the SizeToContent property in code to specify how a window resizes to fit its content.
Комментарии
Если SizeToContent параметр имеет значение WidthAndHeight , установка параметра Height или Width не оказывает никакого влияния; можно задать оба свойства, но значения, которые они задают с помощью, не применяются к окну. When SizeToContent is set to WidthAndHeight, setting either Height or Width has no effect; both properties can be set, but the values they are set with are not applied to the window.
Если SizeToContent параметр имеет значение Height , значение параметра не Height изменяет высоту окна. When SizeToContent is set to Height, setting Height does not change the height of the window.
Если SizeToContent имеет значение Width , параметр не Width изменяет ширину окна. When SizeToContent is set to Width, setting Width does not change the width of the window.
Если SizeToContent имеет значение, отличное от Manual : If SizeToContent has a value other than Manual:
SizeToContent автоматически устанавливается в значение, Manual Если пользователь изменяет размер окна с помощью захвата изменения размера или перетаскивания границы. SizeToContent is automatically set to Manual if a user resizes the window by using the resize grip or dragging the border.
Если размер содержимого изменяется так, что приводит к изменению размера окна, SizeChanged возникает исключение. If the size of the content changes in a way that causes the window to resize itself, SizeChanged is raised.
Если окно является прозрачным (см AllowsTransparency . раздел), следует установить для параметра значение, SizeToContent WidthAndHeight чтобы размер окна не превышал его видимого содержимого. If a window is transparent (see AllowsTransparency), you should consider setting SizeToContent to WidthAndHeight to ensure the window is no larger than its visible content.
Невозможно задать или получить это свойство, если окно размещается в браузере. You cannot set or get this property when a window is hosted in a browser.