You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.2 KiB
C#

1 month ago
// <copyright file="FormGlobalOptions.cs" company="jindongfang">
// Copyright (c) jindongfang. All rights reserved.
// </copyright>
using System;
using System.Windows.Forms;
using DevExpress.XtraTreeList.Nodes;
using GeoSigma.SigmaDrawerUtil;
namespace PcgDrawR
{
/// <summary>
/// 全局配置窗口
/// </summary>
/// <seealso cref="DevExpress.XtraEditors.XtraForm" />
public partial class FormGlobalOptions : DevExpress.XtraEditors.XtraForm
{
private DrawerGlobalConfig globalConfig = null;
/// <summary>
/// Initializes a new instance of the <see cref="FormGlobalOptions"/> class.
/// </summary>
public FormGlobalOptions()
{
this.InitializeComponent();
this.trlDataItem.ClearNodes();
TreeListNode tnSelectConfig = this.trlDataItem.AppendNode(
new object[]
{
"范围选择",
}, -1, 0, 1, -1);
TreeListNode tnFillConfig = this.trlDataItem.AppendNode(
new object[]
{
"区域填充",
}, -1, 0, 1, -1);
// 这个功能细节有待讨论,先注释掉
// TreeListNode tnMeshColorEditor = this.trlDataItem.AppendNode(
// new object[]
// {
// "曲面颜色编辑",
// }, -1, 0, 1, -1);
this.globalConfig = DrawerGlobalConfig.Instance;
tnSelectConfig.Tag = this.globalConfig.RangSelectNode;
tnFillConfig.Tag = this.globalConfig.FillNode;
//tnMeshColorEditor.Tag = this.globalConfig.MeshColorEditNode;
}
private void FormGlobalOptions_Load(object sender, EventArgs e)
{
this.trlDataItem.FocusedNode = this.trlDataItem.Nodes[0];
this.propertyGridControl1.SelectedObject = this.trlDataItem.FocusedNode.Tag;
}
/// <summary>
/// 确定事件.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void btnOK_Click(object sender, EventArgs e)
{
this.globalConfig.Save();
this.DialogResult = DialogResult.OK;
}
/// <summary>
/// 取消事件.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void trlDataItem_SelectionChanged(object sender, EventArgs e)
{
}
private void trlDataItem_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
{
if (e.Node == null)
{
return;
}
object obj = e.Node.Tag;
if (obj != null)
{
this.propertyGridControl1.SelectedObject = obj;
}
else
{
this.propertyGridControl1.SelectedObject = obj;
}
}
}
}