TransformPattern.Resize(Double, Double) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤의 크기를 조정합니다.
public:
void Resize(double width, double height);
public void Resize(double width, double height);
member this.Resize : double * double -> unit
Public Sub Resize (width As Double, height As Double)
매개 변수
- width
- Double
창의 새 너비(픽셀)입니다.
- height
- Double
창의 새 높이(픽셀)입니다.
예외
속성이 CanResize false입니다.
예제
다음 예제 TransformPattern 에서는 컨트롤 패턴을 가져온 AutomationElement 후 크기를 조정 AutomationElement하는 데 사용됩니다.
///--------------------------------------------------------------------
/// <summary>
/// Obtains a TransformPattern control pattern from
/// an automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A TransformPattern object.
/// </returns>
///--------------------------------------------------------------------
private TransformPattern GetTransformPattern(
AutomationElement targetControl)
{
TransformPattern transformPattern = null;
try
{
transformPattern =
targetControl.GetCurrentPattern(TransformPattern.Pattern)
as TransformPattern;
}
catch (InvalidOperationException)
{
// object doesn't support the TransformPattern control pattern
return null;
}
return transformPattern;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a TransformPattern control pattern from
''' an automation element.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' A TransformPattern object.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetTransformPattern( _
ByVal targetControl As AutomationElement) As TransformPattern
Dim transformPattern As TransformPattern = Nothing
Try
transformPattern = DirectCast( _
targetControl.GetCurrentPattern(transformPattern.Pattern), _
TransformPattern)
Catch exc As InvalidOperationException
' object doesn't support the TransformPattern control pattern
Return Nothing
End Try
Return transformPattern
End Function 'GetTransformPattern
///--------------------------------------------------------------------
/// <summary>
/// Calls the TransformPattern.Resize() method for an associated
/// automation element.
/// </summary>
/// <param name="transformPattern">
/// The TransformPattern control pattern obtained from
/// an automation element.
/// </param>
/// <param name="width">
/// The requested width of the automation element.
/// </param>
/// <param name="height">
/// The requested height of the automation element.
/// </param>
///--------------------------------------------------------------------
private void ResizeElement(
TransformPattern transformPattern, double width, double height)
{
try
{
if (transformPattern.Current.CanResize)
{
transformPattern.Resize(width, height);
}
}
catch (InvalidOperationException)
{
// object is not able to perform the requested action
return;
}
}
'''--------------------------------------------------------------------
''' <summary>
''' Calls the TransformPattern.Resize() method for an associated
''' automation element.
''' </summary>
''' <param name="transformPattern">
''' The TransformPattern control pattern obtained from
''' an automation element.
''' </param>
''' <param name="width">
''' The requested width of the automation element.
''' </param>
''' <param name="height">
''' The requested height of the automation element.
''' </param>
'''--------------------------------------------------------------------
Private Sub ResizeElement( _
ByVal transformPattern As TransformPattern, _
ByVal width As Double, ByVal height As Double)
Try
If transformPattern.Current.CanResize Then
transformPattern.Resize(width, height)
End If
Catch
' object is not able to perform the requested action
Return
End Try
End Sub
설명
분할 창을 지원하는 컨트롤에서 호출되는 경우 이 메서드는 다른 연속 창의 크기를 조정하는 부작용이 있을 수 있습니다.
개체의 결과 화면 위치가 컨테이너의 좌표 밖에 있고 키보드나 마우스에 액세스할 수 없도록 개체를 이동, 크기 조정 또는 회전할 수 없습니다. 예를 들어 최상위 창이 완전히 화면 외부로 이동되거나 자식 개체가 컨테이너 뷰포트의 경계 밖으로 이동하는 경우입니다. 이러한 경우 개체는 컨테이너 경계 내에 있도록 재정의된 위쪽 또는 왼쪽 좌표를 사용하여 요청된 화면 좌표에 최대한 가깝게 배치됩니다.