代码拉取完成,页面将自动刷新
同步操作将从 DebugST/DotNet_WinForm_NodeEditor 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using ST.Library.UI.NodeEditor;
namespace WinNodeEditorDemo
{
public partial class Form1 : Form
{
public Form1() {
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
stNodePropertyGrid1.Text = "Node_Property";
stNodeTreeView1.LoadAssembly(Application.ExecutablePath);
stNodeEditor1.LoadAssembly(Application.ExecutablePath);
stNodeEditor1.ActiveChanged += (s, ea) => stNodePropertyGrid1.SetNode(stNodeEditor1.ActiveNode);
//stNodeEditor1.SelectedChanged += (s, ea) => stNodePropertyGrid1.SetSTNode(stNodeEditor1.ActiveNode);
stNodeEditor1.OptionConnected += (s, ea) => stNodeEditor1.ShowAlert(ea.Status.ToString(), Color.White, ea.Status == ConnectionStatus.Connected ? Color.FromArgb(125, Color.Green) : Color.FromArgb(125, Color.Red));
stNodeEditor1.CanvasScaled += (s, ea) => stNodeEditor1.ShowAlert(stNodeEditor1.CanvasScale.ToString("F2"), Color.White, Color.FromArgb(125, Color.Yellow));
stNodeEditor1.NodeAdded += (s, ea) => ea.Node.ContextMenuStrip = contextMenuStrip1;
stNodePropertyGrid1.SetInfoKey("Author", "Mail", "Link", "Show Help");
stNodeTreeView1.PropertyGrid.SetInfoKey("Author", "Mail", "Link", "Show Help");
stNodeEditor1.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
contextMenuStrip1.ShowImageMargin = false;
contextMenuStrip1.Renderer = new ToolStripRendererEx();
}
private void Form1_Load(object sender, EventArgs e) {
//int nLines = 0;
//foreach (var v in Directory.GetFiles("../../../", "*.cs", SearchOption.AllDirectories)) {
// nLines += File.ReadAllLines(v).Length;
//}
//MessageBox.Show(nLines.ToString());
//this.Resize += (s, ea) => this.Text = this.Size.ToString();
//this.BeginInvoke(new MethodInvoker(() => {
// //this.Size = new Size(488, 306);
// this.Size = new Size(488, 246);
// stNodeTreeView1.Visible = false;
// stNodePropertyGrid1.Top = stNodeEditor1.Top;
// stNodePropertyGrid1.Height = stNodeEditor1.Height;
// stNodeTreeView1.Height = stNodeEditor1.Height;
//}));
}
private void btn_open_Click(object sender, EventArgs e) {
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "*.stn|*.stn";
if (ofd.ShowDialog() != DialogResult.OK) return;
stNodeEditor1.Nodes.Clear();
stNodeEditor1.LoadCanvas(ofd.FileName);
}
private void btn_save_Click(object sender, EventArgs e) {
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "*.stn|*.stn";
if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
stNodeEditor1.SaveCanvas(sfd.FileName);
}
private void lockConnectionToolStripMenuItem_Click(object sender, EventArgs e) {
stNodeEditor1.ActiveNode.LockOption = !stNodeEditor1.ActiveNode.LockOption;
}
private void lockLocationToolStripMenuItem_Click(object sender, EventArgs e) {
if (stNodeEditor1.ActiveNode == null) return;
stNodeEditor1.ActiveNode.LockLocation = !stNodeEditor1.ActiveNode.LockLocation;
}
private void removeToolStripMenuItem_Click(object sender, EventArgs e) {
if (stNodeEditor1.ActiveNode == null) return;
stNodeEditor1.Nodes.Remove(stNodeEditor1.ActiveNode);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。