Remontor/Remontor/FlowContainerWords.cs

105 lines
2.7 KiB
C#

using Remontor.History;
using Remontor.Setting;
using Remontor.Words;
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 static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Remontor
{
internal partial class FlowContainerWords : UserControl
{
private bool Showed = true;
private Size NormalSize;
public FlowContainerWords()
{
InitializeComponent();
NormalSize = this.Size;
WordsList.MainCategory = SGlobalSetting.LoadWords();
WordsTree.Nodes.AddRange(WordsList.ListNodes());
SGlobalSetting.settingExpand.ExpendAll(WordsTree.Nodes);
}
public void UpdateTree()
{
WordsTree.Nodes.Clear();
WordsTree.Nodes.AddRange(WordsList.ListNodes());
}
public void Save()
{
SGlobalSetting.settingExpand.SaveExpand(WordsTree.Nodes);
}
public bool HideBar(BarShow barShow)
{
if(barShow == BarShow.ShowWords)
{
this.Visible = true;
}
else
{
this.Visible = false;
}
return this.Visible;
}
public void UpdateHistory(List<HistoryItem> items)
{
}
private void TreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
System.Windows.Forms.TreeView tree = (System.Windows.Forms.TreeView)sender;
Rectangle BoundsNode = new Rectangle(e.Node.Bounds.X - 43, e.Node.Bounds.Y, e.Node.Bounds.Width + 43, e.Node.Bounds.Height);
if (e.Button == MouseButtons.Right)
{
if (BoundsNode.Contains(e.Location) && e.Node.Tag is WordsComp)
{
tree.SelectedNode = e.Node;
// cm_words.Show(tree.PointToScreen(e.Location));
}
else
{
tree.SelectedNode = null;
}
}
//tree.BeginUpdate();
// for (int i = 0; i < tree.Nodes.Count; i++)
// {
// treeView1_treeViewChangeRootCheckBox(tree.Nodes[i]);
// }
}
private void WordsTree_MouseClick(object sender, MouseEventArgs e)
{
System.Windows.Forms.TreeView tree = (System.Windows.Forms.TreeView)sender;
tree.SelectedNode = null;
}
}
}