Add attributes to System.Drawing.Printing.PrintDocument (#35162)
authorEriawan Kusumawardhono <eriawan@live.com>
Tue, 23 Jun 2020 20:15:49 +0000 (03:15 +0700)
committerGitHub <noreply@github.com>
Tue, 23 Jun 2020 20:15:49 +0000 (13:15 -0700)
* add DefaultPropertyAttribute and DefaultEventAttribute to PrintDocument class and add references to System.ComponentModel.TypeConverter

* add the DefaultPropertyAttribute and DefaultEventAttribute to PrintDocument in the ref

Add DefaultEventAttribute and DefaultPropertyAttribute to PrintDocument in PrintDoument.Unix.cs

src/libraries/System.Drawing.Common/ref/System.Drawing.Common.cs
src/libraries/System.Drawing.Common/ref/System.Drawing.Common.csproj
src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj
src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.Unix.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.Windows.cs

index b3d2f09..0bda1dd 100644 (file)
@@ -2719,6 +2719,8 @@ namespace System.Drawing.Printing
         public virtual System.Drawing.Graphics? OnStartPage(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintPageEventArgs e) { throw null; }
         public virtual void OnStartPrint(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintEventArgs e) { }
     }
+    [System.ComponentModel.DefaultPropertyAttribute("DocumentName")]
+    [System.ComponentModel.DefaultEventAttribute("PrintPage")]
     public partial class PrintDocument : System.ComponentModel.Component
     {
         public PrintDocument() { }
index 34d6599..d41e02d 100644 (file)
@@ -12,6 +12,7 @@
     <ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
     <ProjectReference Include="..\..\System.ComponentModel\ref\System.ComponentModel.csproj" />
     <ProjectReference Include="..\..\System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" />
+    <ProjectReference Include="..\..\System.ComponentModel.TypeConverter\ref\System.ComponentModel.TypeConverter.csproj" />
     <ProjectReference Include="..\..\System.Drawing.Primitives\ref\System.Drawing.Primitives.csproj" />
     <ProjectReference Include="..\..\System.ObjectModel\ref\System.ObjectModel.csproj" />
     <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
@@ -22,6 +23,7 @@
     <Reference Include="System.Collections.NonGeneric" />
     <Reference Include="System.ComponentModel" />
     <Reference Include="System.ComponentModel.Primitives" />
+    <Reference Include="System.ComponentModel.TypeConverter" />
     <Reference Include="System.Diagnostics.Debug" />
     <Reference Include="System.Drawing.Primitives" />
     <Reference Include="System.ObjectModel" />
index 7bb92b1..ecc1d8f 100644 (file)
     <Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
     <Reference Include="System.ComponentModel" />
     <Reference Include="System.ComponentModel.Primitives" />
+    <Reference Include="System.ComponentModel.TypeConverter" />
     <Reference Include="System.Threading" />
     <Reference Include="System.Threading.Thread" />
     <Reference Include="System.Text.Encoding.Extensions" />
index 90f79eb..e26c79c 100644 (file)
@@ -40,6 +40,7 @@ using System.ComponentModel;
 
 namespace System.Drawing.Printing
 {
+    [DefaultProperty("DocumentName"), DefaultEvent("PrintPage")]
     public class PrintDocument : System.ComponentModel.Component
     {
         private PageSettings defaultpagesettings;
index 47d0ef8..abe8853 100644 (file)
@@ -9,7 +9,7 @@ namespace System.Drawing.Printing
     /// <summary>
     /// Defines a reusable object that sends output to the printer.
     /// </summary>
-    [SRDescription(nameof(SR.PrintDocumentDesc))]
+    [DefaultProperty("DocumentName"), DefaultEvent("PrintPage"), SRDescription(nameof(SR.PrintDocumentDesc))]
     public class PrintDocument : Component
     {
         private string _documentName = "document";