-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ArunKumarSF4054/WPF-865510-SamplesForKB
WPF-865510_To add the Samples For KB
- Loading branch information
Showing
13 changed files
with
704 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.8.34309.116 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PanTool", "PanTool\PanTool.csproj", "{D1A251E6-2333-43E8-92DC-CAF4E120214C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{D1A251E6-2333-43E8-92DC-CAF4E120214C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D1A251E6-2333-43E8-92DC-CAF4E120214C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D1A251E6-2333-43E8-92DC-CAF4E120214C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D1A251E6-2333-43E8-92DC-CAF4E120214C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {928EAFEB-2161-4DE0-8430-4CE3C66B805B} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /> | ||
</startup> | ||
</configuration> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
using Syncfusion.Windows.Forms.Diagram; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
using Rectangle = Syncfusion.Windows.Forms.Diagram.Rectangle; | ||
|
||
namespace PanTool | ||
{ | ||
public partial class Form1 : Form | ||
{ | ||
public Form1() | ||
{ | ||
InitializeComponent(); | ||
|
||
|
||
this.diagram1.EventSink.NodeMouseEnter += EventSink_NodeMouseEnter; | ||
this.diagram1.EventSink.NodeMouseLeave += EventSink_NodeMouseLeave; | ||
this.CreateRectangle(200, 150); | ||
} | ||
|
||
private void EventSink_NodeMouseLeave(NodeMouseEventArgs evtArgs) | ||
{ | ||
this.diagram1.Controller.ActivateTool("PanTool"); | ||
} | ||
|
||
private void EventSink_NodeMouseEnter(NodeMouseEventArgs evtArgs) | ||
{ | ||
this.diagram1.Controller.ActivateTool("SelectTool"); | ||
} | ||
|
||
private void CreateRectangle(float x, float y) | ||
{ | ||
var rectangle = new Rectangle(x, y, 100, 100); | ||
rectangle.FillStyle.Type = FillStyleType.Solid; | ||
rectangle.FillStyle.Color = Color.CornflowerBlue; | ||
rectangle.EnableCentralPort = true; | ||
|
||
var rectangle1 = new Rectangle(x + 50, y + 200, 100, 100); | ||
rectangle1.FillStyle.Type = FillStyleType.Solid; | ||
rectangle1.FillStyle.Color = Color.CornflowerBlue; | ||
rectangle1.EnableCentralPort = true; | ||
|
||
#region CentralPort | ||
var port1 = new ConnectionPoint() | ||
{ | ||
//VisualType = PortVisualType.SquarePort, | ||
AllowConnectOnDrag = true, | ||
OffsetX = 0, | ||
OffsetY = 0, | ||
}; | ||
port1.FillStyle.Type = FillStyleType.Solid; | ||
port1.FillStyle.Color = Color.Black; | ||
rectangle.Ports.Add(port1); | ||
|
||
var port = new ConnectionPoint() | ||
{ | ||
//VisualType = PortVisualType.SquarePort, | ||
AllowConnectOnDrag = true, | ||
OffsetX = 0, | ||
OffsetY = 0, | ||
}; | ||
port.FillStyle.Type = FillStyleType.Solid; | ||
port.FillStyle.Color = Color.Black; | ||
rectangle1.Ports.Add(port); | ||
#endregion | ||
OrgLineConnector connector = new OrgLineConnector(new PointF(0, 0), new PointF(0, 0)); | ||
|
||
|
||
|
||
this.diagram1.Model.AppendChild(rectangle); | ||
this.diagram1.Model.AppendChild(rectangle1); | ||
rectangle1.CentralPort.TryConnect(connector.HeadEndPoint); | ||
rectangle.CentralPort.TryConnect(connector.TailEndPoint); | ||
rectangle1.CentralPort.ConnectionsLimit = 2; | ||
|
||
diagram1.Model.AppendChild(connector); | ||
|
||
var custRect = new Rectangle(x + 200, y, 100, 100); | ||
custRect.FillStyle.Type = FillStyleType.Solid; | ||
custRect.FillStyle.Color = Color.CornflowerBlue; | ||
custRect.EnableCentralPort = true; | ||
|
||
|
||
|
||
var custRect2 = new Rectangle(x + 300, y + 200, 100, 100); | ||
custRect2.FillStyle.Type = FillStyleType.Solid; | ||
custRect2.FillStyle.Color = Color.CornflowerBlue; | ||
custRect2.EnableCentralPort = true; | ||
|
||
|
||
diagram1.Model.AppendChild(custRect); | ||
diagram1.Model.AppendChild(custRect2); | ||
} | ||
} | ||
} |
Oops, something went wrong.