2019-08-29 21:45:32 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Toolbox.Library.Forms;
|
|
|
|
|
|
2019-08-29 22:33:23 +02:00
|
|
|
|
namespace LayoutBXLYT
|
2019-08-29 21:45:32 +02:00
|
|
|
|
{
|
2019-08-30 01:01:47 +02:00
|
|
|
|
public partial class LayoutProperties : LayoutDocked
|
2019-08-29 21:45:32 +02:00
|
|
|
|
{
|
2019-09-04 00:58:58 +02:00
|
|
|
|
private UserDataEditor userDataEditor;
|
|
|
|
|
|
2019-08-29 21:45:32 +02:00
|
|
|
|
public LayoutProperties()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2019-09-04 00:58:58 +02:00
|
|
|
|
stTabControl1.myBackColor = FormThemes.BaseTheme.FormBackColor;
|
|
|
|
|
|
|
|
|
|
userDataEditor = new UserDataEditor();
|
|
|
|
|
userDataEditor.Dock = DockStyle.Fill;
|
|
|
|
|
tabPage2.Controls.Add(userDataEditor);
|
2019-09-05 22:24:03 +02:00
|
|
|
|
|
|
|
|
|
BackColor = FormThemes.BaseTheme.FormBackColor;
|
|
|
|
|
ForeColor = FormThemes.BaseTheme.FormForeColor;
|
2019-08-29 21:45:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-30 01:01:47 +02:00
|
|
|
|
public void Reset()
|
|
|
|
|
{
|
2019-08-31 00:53:45 +02:00
|
|
|
|
stPropertyGrid1.LoadProperty(null);
|
2019-08-30 01:01:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-02 21:26:26 +02:00
|
|
|
|
public void UpdateProperties()
|
|
|
|
|
{
|
|
|
|
|
stPropertyGrid1.UpdateProperties();
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-04 20:10:17 +02:00
|
|
|
|
public void LoadProperties(object prop, Action propChanged)
|
|
|
|
|
{
|
|
|
|
|
LoadPropertyTab("Properties", prop, propChanged);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-29 22:33:23 +02:00
|
|
|
|
public void LoadProperties(BasePane prop, Action propChanged)
|
2019-08-29 21:45:32 +02:00
|
|
|
|
{
|
2019-08-31 00:53:45 +02:00
|
|
|
|
LoadPropertyTab("Pane", prop, propChanged);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadPropertyTab(string text, object prop, Action propChanged)
|
|
|
|
|
{
|
2019-09-04 00:58:58 +02:00
|
|
|
|
userDataEditor.Reset();
|
|
|
|
|
if (prop is IUserDataContainer)
|
|
|
|
|
LoadUserData((IUserDataContainer)prop);
|
|
|
|
|
|
2019-08-31 00:53:45 +02:00
|
|
|
|
DoubleBufferedTabPage page = new DoubleBufferedTabPage();
|
|
|
|
|
page.Enabled = false;
|
|
|
|
|
page.Text = text;
|
|
|
|
|
stPropertyGrid1.LoadProperty(prop, propChanged);
|
|
|
|
|
}
|
2019-08-29 21:45:32 +02:00
|
|
|
|
|
2019-09-04 00:58:58 +02:00
|
|
|
|
private void LoadUserData(IUserDataContainer container)
|
|
|
|
|
{
|
|
|
|
|
if (container.UserData != null && container.UserData.Entries != null)
|
|
|
|
|
userDataEditor.LoadUserData(container.UserData.Entries);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-31 00:53:45 +02:00
|
|
|
|
class DoubleBufferedTabPage : System.Windows.Forms.TabPage
|
|
|
|
|
{
|
|
|
|
|
public DoubleBufferedTabPage()
|
2019-08-29 21:45:32 +02:00
|
|
|
|
{
|
2019-08-31 00:53:45 +02:00
|
|
|
|
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
|
2019-08-29 21:45:32 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-31 00:53:45 +02:00
|
|
|
|
private void stTabControl1_TabIndexChanged(object sender, EventArgs e)
|
2019-08-29 21:45:32 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|