Skip to content
Open
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
@@ -1,30 +1,13 @@
// <snippet1>
using System;
using System.Collections.Generic;
using System.Text;

namespace DSMSample
{
// <snippet2>
public class SampleObject
public class SampleObject2
{
private string stringValue = null;
private int intValue = int.MinValue;

public string StringProperty
{
get { return this.stringValue; }

set { this.stringValue = value; }
}

public int IntProperty
{
get { return this.intValue; }
public string StringProperty { get; set; }

set{ this.intValue = value; }
}
public int IntProperty { get; set; } = int.MinValue;
}
// </snippet2>
}
// </snippet1>
// </snippet1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,54 +1,31 @@
// <snippet10>
using System;
using System.Collections.Generic;
using System.Text;

namespace DSMSample
{
// <snippet11>
public class SampleObject
{
private string stringValue = null;
private int intValue = int.MinValue;
private SampleObject childValue = null;

public string StringProperty
{
get { return this.stringValue; }
public string StringProperty { get; set; }

set { this.stringValue = value; }
}

public int IntProperty
{
get { return this.intValue; }
public int IntProperty { get; set; } = int.MinValue;

set { this.intValue = value; }
}

public SampleObject Child
{
get { return this.childValue; }

set { this.childValue = value; }
}
public SampleObject Child { get; set; }
}
// </snippet11>

// <snippet12>
class Program
{
// <snippet13>
static void Main(string[] args)
static void Main()
{
// <snippet14>
SampleObject root = new SampleObject();
SampleObject root = new();

SampleObject currentObject = root;

for (int i = 0; i < 10; i++)
{
SampleObject o = new SampleObject();
SampleObject o = new();

currentObject.Child = o;

Expand All @@ -60,4 +37,4 @@ static void Main(string[] args)
}
// </snippet12>
}
// </snippet10>
// </snippet10>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,109 +1,56 @@
using System;
using System.Collections;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Design;
using System.Web.UI.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace EditorAttributeExamples
namespace EditorExamples
{
public class Class1 : System.ComponentModel.Component
public class Class1 : Component
{
// System.ComponentModel.Design.CollectionEditor EditorAttribute example
// System.ComponentModel.Design.CollectionEditor Editor example.
//<Snippet1>
[EditorAttribute(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
public ICollection testCollection
{
get
{
return Icollection;
}
set
{
Icollection = value;
}
}
private ICollection Icollection;
[Editor(typeof(CollectionEditor), typeof(UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ICollection testCollection { get; set; }
//</Snippet1>

// System.Drawing.Design.FontEditor EditorAttribute example
// FontEditor Editor example.
//<Snippet2>
[EditorAttribute(typeof(System.Drawing.Design.FontEditor), typeof(System.Drawing.Design.UITypeEditor))]
public Font testFont
{
get
{
return font;
}
set
{
font = value;
}
}
private Font font;
[Editor(typeof(FontEditor), typeof(UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Font testFont { get; set; }
//</Snippet2>

// System.Drawing.Design.ImageEditor EditorAttribute example
// ImageEditor Editor example.
//<Snippet3>
[EditorAttribute(typeof(System.Drawing.Design.ImageEditor), typeof(System.Drawing.Design.UITypeEditor))]
public Image testImage
{
get
{
return testImg;
}
set
{
testImg = value;
}
}
private Image testImg;
[Editor(typeof(ImageEditor), typeof(UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Image testImage { get; set; }
//</Snippet3>

// System.Windows.Forms.Design.AnchorEditor EditorAttribute example
// System.Windows.Forms.Design.AnchorEditor Editor example.
//<Snippet4>
[EditorAttribute(typeof(System.Windows.Forms.Design.AnchorEditor), typeof(System.Drawing.Design.UITypeEditor))]
public System.Windows.Forms.AnchorStyles testAnchor
{
get
{
return anchor;
}
set
{
anchor = value;
}
}
private AnchorStyles anchor;
[Editor(typeof(System.Windows.Forms.Design.AnchorEditor), typeof(UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public AnchorStyles testAnchor { get; set; }
//</Snippet4>

// System.Windows.Forms.Design.FileNameEditor EditorAttribute example
// System.Windows.Forms.Design.FileNameEditor Editor example.
//<Snippet5>
[EditorAttribute(typeof(System.Windows.Forms.Design.FileNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string testFilename
{
get
{
return filename;
}
set
{
filename = value;
}
}
private string filename;
[Editor(typeof(System.Windows.Forms.Design.FileNameEditor), typeof(UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string testFilename { get; set; }
//</Snippet5>

public Class1()
{
// Initialize collections for design-mode editor testing.
Icollection = new int[] { 0, 2, 4, 6, 8, 12, 14 };
font = new Font("Arial", 8);
testCollection = new int[] { 0, 2, 4, 6, 8, 12, 14 };
testFont = new("Arial", 8);
testAnchor = AnchorStyles.None;
filename = string.Empty;
testFilename = string.Empty;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

</Project>
Loading
Loading