Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Drawing;

namespace System.Windows.Forms
{
public partial class Form
{
/// <summary>
/// Form control accessible object with UI Automation provider functionality.
/// This inherits from the base ControlAccessibleObject
/// to have all base functionality.
/// </summary>
internal class FormAccessibleObject : ControlAccessibleObject
{
private readonly Form _owner;

internal FormAccessibleObject(Form owner) : base(owner)
{
_owner = owner;
}

public override Rectangle Bounds => _owner.RectangleToScreen(_owner.ClientRectangle);

internal override Rectangle BoundingRectangle => _owner.Bounds;

internal override bool IsIAccessibleExSupported()
{
if (_owner != null)
{
return true;
}

return base.IsIAccessibleExSupported();
}

internal override bool IsPatternSupported(int patternId)
{
if (patternId == NativeMethods.UIA_LegacyIAccessiblePatternId)
{
return true;
}

return base.IsPatternSupported(patternId);
}

internal override void SetValue(string newValue)
{
Value = newValue;
}
}
}
}
21 changes: 14 additions & 7 deletions src/System.Windows.Forms/src/System/Windows/Forms/Form.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace System.Windows.Forms
DefaultEvent(nameof(Load)),
InitializationEvent(nameof(Load)),
]
public class Form : ContainerControl
public partial class Form : ContainerControl
{
#if DEBUG
static readonly BooleanSwitch AlwaysRestrictWindows = new BooleanSwitch("AlwaysRestrictWindows", "Always make Form classes behave as though they are restricted");
Expand Down Expand Up @@ -1707,10 +1707,10 @@ public Form[] MdiChildren
}

/// <summary>
/// Gets the MDIClient that the MDI container form is using to contain Multiple Document Interface (MDI) child forms,
/// Gets the MDIClient that the MDI container form is using to contain Multiple Document Interface (MDI) child forms,
/// if this is an MDI container form.
/// Represents the client area of a Multiple Document Interface (MDI) Form window, also known as the MDI child window.
/// </summary>
/// </summary>
internal MdiClient MdiClient
{
get
Expand Down Expand Up @@ -3361,6 +3361,11 @@ private Size ComputeWindowSize(Size clientSize, int style, int exStyle)
return new Size(result.right - result.left, result.bottom - result.top);
}

protected override AccessibleObject CreateAccessibilityInstance()
{
return new FormAccessibleObject(this);
}

[EditorBrowsable(EditorBrowsableState.Advanced)]
protected override Control.ControlCollection CreateControlsInstance()
{
Expand Down Expand Up @@ -3552,7 +3557,7 @@ private void DeactivateMdiChild()
/// a
/// subclass overrides this function,
/// it must call the base implementation.
/// </summary>
/// </summary>
[
EditorBrowsable(EditorBrowsableState.Advanced)
]
Expand Down Expand Up @@ -4252,7 +4257,7 @@ private protected override void OnAutoScaleModeChanged()
base.OnAutoScaleModeChanged();
if (formStateEx[FormStateExSettingAutoScale] != 1)
{
// Obsolete code required here for backwards compat
// Obsolete code required here for backwards compat
#pragma warning disable 618
AutoScale = false;
#pragma warning restore 618
Expand Down Expand Up @@ -5873,6 +5878,8 @@ internal bool ShouldSerializeTransparencyKey()
return !TransparencyKey.Equals(Color.Empty);
}

internal override bool SupportsUiaProviders => true;

/// <summary>
/// This is called when we are about to become minimized. Laying out
/// while minimized can be a problem because the physical dimensions
Expand Down Expand Up @@ -6202,7 +6209,7 @@ internal void UpdateFormStyles()
private static Type FindClosestStockType(Type type)
{
Type[] stockTypes = new Type[] { typeof(MenuStrip) }; // as opposed to what we had before...
// simply add other types here from most specific to most generic if we want to merge other types of toolstrips...
// simply add other types here from most specific to most generic if we want to merge other types of toolstrips...
foreach (Type t in stockTypes)
{
if (t.IsAssignableFrom(type))
Expand Down Expand Up @@ -7343,7 +7350,7 @@ public override void Add(Control value)
}

/// <summary>
/// Removes a control from the form.
/// Removes a control from the form.
/// </summary>
public override void Remove(Control value)
{
Expand Down