Skip to content

Commit

Permalink
Enable nullability in TransparentBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetrou committed May 1, 2024
1 parent 2d02446 commit 20695a8
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable disable

using System.Drawing;
using System.Windows.Forms.Design.Behavior;

Expand Down Expand Up @@ -34,7 +32,7 @@ internal class TransparentBehavior : Behavior.Behavior
/// <summary>
/// Forwards DragDrop notification from the BehaviorService to the related ControlDesigner.
/// </summary>
public override void OnDragDrop(Glyph g, DragEventArgs e)
public override void OnDragDrop(Glyph? g, DragEventArgs e)
{
_controlRect = Rectangle.Empty;
_designer.OnDragDrop(e);
Expand All @@ -43,20 +41,20 @@ public override void OnDragDrop(Glyph g, DragEventArgs e)
/// <summary>
/// Forwards DragDrop notification from the BehaviorService to the related ControlDesigner.
/// </summary>
public override void OnDragEnter(Glyph g, DragEventArgs e)
public override void OnDragEnter(Glyph? g, DragEventArgs e)
{
if (_designer is not null && _designer.Control is not null)
{
_controlRect = _designer.Control.RectangleToScreen(_designer.Control.ClientRectangle);
}

_designer.OnDragEnter(e);
_designer?.OnDragEnter(e);
}

/// <summary>
/// Forwards DragDrop notification from the BehaviorService to the related ControlDesigner.
/// </summary>
public override void OnDragLeave(Glyph g, EventArgs e)
public override void OnDragLeave(Glyph? g, EventArgs e)
{
_controlRect = Rectangle.Empty;
_designer.OnDragLeave(e);
Expand All @@ -65,7 +63,7 @@ public override void OnDragLeave(Glyph g, EventArgs e)
/// <summary>
/// Forwards DragDrop notification from the BehaviorService to the related ControlDesigner.
/// </summary>
public override void OnDragOver(Glyph g, DragEventArgs e)
public override void OnDragOver(Glyph? g, DragEventArgs e)
{
// If we are not over a valid drop area, then do not allow the drag/drop. Now that all
// dragging/dropping is done via the behavior service and adorner window, we have to do our own
Expand All @@ -82,7 +80,7 @@ public override void OnDragOver(Glyph g, DragEventArgs e)
/// <summary>
/// Forwards DragDrop notification from the BehaviorService to the related ControlDesigner.
/// </summary>
public override void OnGiveFeedback(Glyph g, GiveFeedbackEventArgs e)
public override void OnGiveFeedback(Glyph? g, GiveFeedbackEventArgs e)
{
_designer.OnGiveFeedback(e);
}
Expand Down

0 comments on commit 20695a8

Please sign in to comment.