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

Port MonthCalendarDesigner to runtime #9536

Merged
merged 4 commits into from
Jul 26, 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
1 change: 1 addition & 0 deletions src/System.Design/src/System.Design.Forwards.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ListBoxDesigner))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ListViewDesigner))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.MaskedTextBoxDesigner))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.MonthCalendarDesigner))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.PanelDesigner))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.PictureBoxDesigner))]
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.RadioButtonDesigner))]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace System.Windows.Forms.Design;

internal class MonthCalendarDesigner : ControlDesigner
{
public MonthCalendarDesigner()
{
AutoResizeHandles = true;
}

/// <summary>
/// Retrieves a set of rules concerning the movement capabilities of a component.
/// This should be one or more flags from the SelectionRules class. If no designer
/// provides rules for a component, the component will not get any UI services.
/// </summary>
public override SelectionRules SelectionRules
{
get
{
SelectionRules rules = base.SelectionRules;

if (Control.Parent is null || !Control.Parent.IsMirrored)
{
rules &= ~(SelectionRules.TopSizeable | SelectionRules.LeftSizeable);
}
else
{
rules &= ~(SelectionRules.TopSizeable | SelectionRules.RightSizeable);
}

return rules;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,20 +203,22 @@ private void CreateDesignSurface(int n)
break;
case 4:
{
rootComponent = surface.CreateRootComponent<Form>(new Size(320, 200));
rootComponent = surface.CreateRootComponent<Form>(new Size(800, 600));
rootComponent.BackColor = Color.Orange;
rootComponent.Text = "Root Component hosted by the DesignSurface N.4"; //- step.1
//- step.3
//- create some Controls at DesignTime
Button b1 = surface.CreateControl<Button>(new Size(200, 40), new Point(10, 10));
Button b2 = surface.CreateControl<Button>(new Size(200, 40), new Point(100, 100));
Button b2 = surface.CreateControl<Button>(new Size(200, 40), new Point(10, 60));
b1.Text = "I'm the first Button";
b2.Text = "I'm the second Button";
b1.BackColor = Color.Gold;
b2.BackColor = Color.LightGreen;

Timer tm11 = surface.CreateComponent<Timer>();
FontDialog fd1 = surface.CreateComponent<FontDialog>();

surface.CreateControl<MonthCalendar>(new Size(230, 170), new Point(10,110));
}

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class DesignerAttributeTests
"System.Windows.Forms.Design.FlowLayoutPanelDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Windows.Forms.Design.FolderBrowserDialogDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Windows.Forms.Design.ImageListDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Windows.Forms.Design.MonthCalendarDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Windows.Forms.Design.NotifyIconDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Windows.Forms.Design.PrintDialogDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Windows.Forms.Design.PropertyGridDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
Expand Down
Loading