From 6a3790e449e6b6372f94b2a6da2d65f3b717c173 Mon Sep 17 00:00:00 2001 From: Epica3055 Date: Tue, 5 Sep 2023 15:21:56 +0800 Subject: [PATCH] fix comments --- .../Forms/Design/Behavior/TableLayoutPanelBehavior.cs | 2 +- .../Forms/Design/DataGridViewAddColumnDialog.cs | 4 ++-- .../src/System/Windows/Forms/Internals/DpiHelper.cs | 11 ++++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/TableLayoutPanelBehavior.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/TableLayoutPanelBehavior.cs index 31a7b8b7549..ade1e21320c 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/TableLayoutPanelBehavior.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/TableLayoutPanelBehavior.cs @@ -19,7 +19,7 @@ internal class TableLayoutPanelBehavior : Behavior private BehaviorService behaviorService; //used for bounds translation private IServiceProvider serviceProvider; //cached to allow our behavior to get services private TableLayoutPanelResizeGlyph tableGlyph; //the glyph being resized - private DesignerTransaction resizeTransaction; //used to make size adjustements within transaction + private DesignerTransaction resizeTransaction; //used to make size adjustments within transaction private PropertyDescriptor resizeProp; //cached property descriptor representing either the row or column styles private PropertyDescriptor changedProp; //cached property descriptor that refers to the RowSTyles or ColumnStyles collection. private TableLayoutPanel table; diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewAddColumnDialog.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewAddColumnDialog.cs index 753532000c6..b76090eb75d 100644 --- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewAddColumnDialog.cs +++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataGridViewAddColumnDialog.cs @@ -918,8 +918,8 @@ public static bool ValidName(string name, private class ListBoxItem { - private Type _propertyType; - private string _propertyName; + private readonly Type _propertyType; + private readonly string _propertyName; public ListBoxItem(Type propertyType, string propertyName) { diff --git a/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Internals/DpiHelper.cs b/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Internals/DpiHelper.cs index fac738ebe17..9ac6a4b833e 100644 --- a/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Internals/DpiHelper.cs +++ b/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/Internals/DpiHelper.cs @@ -139,7 +139,7 @@ private static InterpolationMode InterpolationMode } } - internal static Bitmap ScaleBitmapToSize(Bitmap logicalImage, Size deviceImageSize, bool offset = true) + private static Bitmap ScaleBitmapToSize(Bitmap logicalImage, Size deviceImageSize) { Bitmap deviceImage; deviceImage = new Bitmap(deviceImageSize.Width, deviceImageSize.Height, logicalImage.PixelFormat); @@ -156,10 +156,7 @@ internal static Bitmap ScaleBitmapToSize(Bitmap logicalImage, Size deviceImageSi // and will appear black even if we cleared the background with transparent color. // The apparition of these artifacts depends on the interpolation mode, on the dpi scaling factor, etc. // E.g. at 150% DPI, Bicubic produces them and NearestNeighbor is fine, but at 200% DPI NearestNeighbor also shows them. - if (offset) - { - sourceRect.Offset(-0.5f, -0.5f); - } + sourceRect.Offset(-0.5f, -0.5f); graphics.DrawImage(logicalImage, destRect, sourceRect, GraphicsUnit.Pixel); } @@ -294,14 +291,14 @@ public static Size LogicalToDeviceUnits(Size logicalSize, int deviceDpi = 0) /// The image to scale from logical units to device units /// The size to scale image to [return: NotNullIfNotNull("logicalImage")] - public static Bitmap? CreateResizedBitmap(Bitmap? logicalImage, Size targetImageSize, bool doNotOffset = false) + public static Bitmap? CreateResizedBitmap(Bitmap? logicalImage, Size targetImageSize) { if (logicalImage is null) { return null; } - return ScaleBitmapToSize(logicalImage, targetImageSize, doNotOffset); + return ScaleBitmapToSize(logicalImage, targetImageSize); } ///