Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable nullability in DesignerFrame and clean it up #9966

Merged
merged 5 commits into from
Sep 29, 2023
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
Expand Up @@ -22,7 +22,7 @@ private partial class AdornerWindow : Control
/// Constructor that parents itself to the Designer Frame and hooks all
/// necessary events.
/// </summary>
internal AdornerWindow(BehaviorService behaviorService, Control designerFrame)
internal AdornerWindow(BehaviorService behaviorService, DesignerFrame designerFrame)
{
_behaviorService = behaviorService;
DesignerFrame = designerFrame;
Expand Down Expand Up @@ -89,13 +89,13 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}

internal Control DesignerFrame { get; private set; }
internal DesignerFrame DesignerFrame { get; private set; }

/// <summary>
/// Returns the display rectangle for the adorner window
/// </summary>
internal Rectangle DesignerFrameDisplayRectangle
=> DesignerFrameValid ? ((DesignerFrame)DesignerFrame).DisplayRectangle : Rectangle.Empty;
=> DesignerFrameValid ? DesignerFrame.DisplayRectangle : Rectangle.Empty;

/// <summary>
/// Returns true if the DesignerFrame is created and not being disposed.
Expand Down Expand Up @@ -130,7 +130,7 @@ internal void InvalidateAdornerWindow(Region region)
if (DesignerFrameValid)
{
// Translate for non-zero scroll positions
Point scrollPosition = ((DesignerFrame)DesignerFrame).AutoScrollPosition;
Point scrollPosition = DesignerFrame.AutoScrollPosition;
region.Translate(scrollPosition.X, scrollPosition.Y);

DesignerFrame.Invalidate(region, true);
Expand All @@ -147,7 +147,7 @@ internal void InvalidateAdornerWindow(Rectangle rectangle)
if (DesignerFrameValid)
{
// Translate for non-zero scroll positions
Point scrollPosition = ((DesignerFrame)DesignerFrame).AutoScrollPosition;
Point scrollPosition = DesignerFrame.AutoScrollPosition;
rectangle.Offset(scrollPosition.X, scrollPosition.Y);

DesignerFrame.Invalidate(rectangle, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private static readonly TraceSwitch s_dragDropSwitch
private static MessageId WM_GETRECENTSNAPLINES;
private const string ToolboxFormat = ".NET Toolbox Item"; // used to detect if a drag is coming from the toolbox.

internal BehaviorService(IServiceProvider serviceProvider, Control windowFrame)
internal BehaviorService(IServiceProvider serviceProvider, DesignerFrame windowFrame)
{
_serviceProvider = serviceProvider;
_adornerWindow = new AdornerWindow(this, windowFrame);
Expand Down
Loading
Loading