コード例 #1
0
ファイル: TitleEdt.cs プロジェクト: khiemnv/chatApp
 public TitleEdt(bool showCmb = false)
 {
     m_edtPanel = new EditPanel(showCmb);
     this.Controls.Add(m_edtPanel.m_tlp);
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: khiemnv/KinhNikaya
        public Form1()
        {
            InitializeComponent();

            var menu   = new MenuStrip();
            var fileMI = new ToolStripMenuItem("&File");

            menu.Items.Add(fileMI);
            fileMI.DropDownItems.Add("&Open").Click    += (s, e) => { OnOpenDb(s, e); };
            fileMI.DropDownItems.Add("&Preview").Click += (s, e) => { PreviewTitle(s, e); };
            fileMI.DropDownItems.Add("&Export").Click  += (s, e) => { ExportSelected(s, e); };
            fileMI.DropDownItems.Add("&Find").Click    += (s, e) => { OpenFindWnd(); };
            this.MainMenuStrip = menu;

            var configMI = new ToolStripMenuItem("&Config");

            menu.Items.Add(configMI);
            configMI.DropDownItems.Add("&Font").Click += (s, e) => { MiFont_Click(s, e); };

            m_sc      = new SplitContainer();
            m_sc.Dock = DockStyle.Fill;
            Controls.Add(m_sc);

            //tree
            m_nodeDict = new Dictionary <string, Node>();

            m_tree = new TreeView();
            m_sc.Panel1.Controls.Add(m_tree);

            m_treeStyle = TreeStyle.check;
            initTree(); //set state imagine

            m_tree.Dock                  = DockStyle.Fill;
            m_tree.NodeMouseClick       += OnTreeNodeClick;
            m_tree.NodeMouseDoubleClick += OnTreeNodeDblClick;
            m_tree.Visible               = true;
            m_tree.Nodes.Add(new TreeNode()
            {
                Text = "None", SelectedImageIndex = 0
            });

            m_rsc = new SplitContainer()
            {
                Dock = DockStyle.Fill,
            };
#if use_rtb
            m_rtb      = new RichTextBox();
            m_rtb.Dock = DockStyle.Fill;
            m_rsc.Panel1.Controls.Add(m_rtb);
#else
#if use_gecko
            var wb = new Gecko.GeckoWebBrowser();
            //wb.LoadHtml("<html><body></body></html>", "http://blank");
#elif use_chromium
            var wb = new CefSharp.WinForms.ChromiumWebBrowser("");
#else
            var wb = new WebBrowser();
#endif
            wb.Dock = DockStyle.Fill;
            m_wb    = wb;
            m_rsc.Panel1.Controls.Add(m_wb);
#endif
            var edtPanel = new EditPanel();
            m_edtPanel = edtPanel;

            m_rsc.Panel2Collapsed = true;
            m_rsc.Panel2.Hide();
            m_rsc.Panel2.Controls.Add(edtPanel.m_tlp);

            m_sc.Panel2.Controls.Add(m_rsc);

            var bs = new BindingSource
            {
                DataSource = edtPanel.m_dataTable
            };
            edtPanel.m_dataTable.RowChanged += OnEditPar;
            edtPanel.OnHideEditor           += OnCloseEditor;
            bs.CurrentItemChanged           += Bs_CurrentItemChanged;
            bs.CurrentChanged += Bs_CurrentChanged;

            this.Controls.Add(menu);

            this.Load       += OnLoadForm;
            this.FormClosed += OnCloseForm;
        }