/// <summary>
        /// 初始化手动输入的数据表格配置
        /// </summary>
        private void initInputDataViewConf()
        {
            RedrawDataTable dataView = new RedrawDataTable();

            dataView.ColumnSortMode          = false;
            dataView.IsShowLineNumber        = true;
            dataView.CellDefaultHeight       = 24;
            dataView.ColumnHeadDefaultHeight = 24;
            dataView.Location                 = new Point(操作区_容器.Location.X, 操作区_容器.Bottom + 5);
            dataView.AllowUserToAddRows       = false;
            dataView.AllowUserToResizeRows    = false;
            dataView.AllowUserToResizeColumns = false;
            dataView.BringToFront();
            dataView.Width               = 操作区_容器.ClientSize.Width;
            dataView.Height              = 项区容器.ClientSize.Height - (dataView.Location.Y - 项区容器.Location.X);
            dataView.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
            dataView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataView.Anchor              = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;

            inputDGV = dataView;
            // 记录到状态栏中
            Control c = UIComponentFactory.getSingleControl(DefaultNameEnum.TOOL_START);

            if (c != null && c is RedrawStatusBar)
            {
                RedrawStatusBar bar = (RedrawStatusBar)c;
                bar.SetSourceControl(dataView);
            }
            this.Controls.Add(dataView);
        }
        /// <summary>
        /// 实例化状态栏
        /// </summary>
        /// <returns></returns>
        private StatusStrip initMainStrtusBar()
        {
            Control     ccc         = UIComponentFactory.getSingleControl(DefaultNameEnum.TOOL_START, true);
            StatusStrip statusStrip = null;

            if (ccc != null && ccc is StatusStrip)
            {
                statusStrip = (StatusStrip)ccc;
            }
            return(statusStrip);
        }
        /// <summary>
        /// 初始化主容器
        /// </summary>
        /// <returns></returns>
        private ToolStripContainer initMainContainer()
        {
            Control            ccc       = UIComponentFactory.getSingleControl(DefaultNameEnum.MAIN_CONTAINER, true);
            ToolStripContainer container = null;

            if (ccc != null && ccc is ToolStripContainer)
            {
                container = (ToolStripContainer)ccc;
            }
            return(container);
        }
        /// <summary>
        /// 初始化主Tab容器
        /// </summary>
        /// <returns>该Tab容器</returns>
        private TabControl initMainTab()
        {
            // 获取主Tab容器
            TabControl tab = null;
            Control    ccc = UIComponentFactory.getSingleControl(DefaultNameEnum.TAB_CONTENT, true);

            if (ccc != null && ccc is TabControl)
            {
                tab = (TabControl)ccc;
            }
            return(tab);
        }
示例#5
0
 // 鼠标移入事件
 protected override void OnMouseEnter(EventArgs e)
 {
     // 绑定右键菜单
     if (IsBindingTextRightMenu && this.ContextMenuStrip == null)
     {
         Control ccc = UIComponentFactory.getSingleControl(DefaultNameEnum.TEXT_RIGHT_MENU, true);
         if (ccc != null && ccc is ContextMenuStrip)
         {
             this.ContextMenuStrip = (ContextMenuStrip)ccc;
         }
     }
     // 设置状态栏
     base.OnMouseEnter(e);
 }
示例#6
0
        /// <summary>
        /// 初始化数据表格配置
        /// </summary>
        private void initDataViewConf()
        {
            RedrawDataTable dataView = new RedrawDataTable();

            dataView.CellDefaultHeight       = cellDefHeight;
            dataView.ColumnHeadDefaultHeight = colHeadersHeight;
            dataView.Location = new Point(操作区容器.Location.X, 操作区容器.Bottom + 5);
            dataView.Size     = new Size(操作区容器.Width, 项区容器.Bottom - dataView.Location.Y);
            redrawDataTable   = dataView;
            // 记录到状态栏中
            Control c = UIComponentFactory.getSingleControl(DefaultNameEnum.TOOL_START);

            if (c != null && c is RedrawStatusBar)
            {
                RedrawStatusBar bar = (RedrawStatusBar)c;
                bar.SetSourceControl(dataView);
            }
            // 加入到容器中
            this.Controls.Add(redrawDataTable);
        }
        // 状态栏的双击事件对应关系
        private Dictionary <string, Delegate> doubleClickEventBinding()
        {
            Dictionary <string, Delegate> toolBindingDic = new Dictionary <string, Delegate>();

            toolBindingDic.Add(StrutsStripDataLib.ItemName.总字符数, new methodDelegate((Control con) => {
                if (con == null)
                {
                    MessageBox.Show("无法获取控件");
                }
                // 获取控件
                if (con is TextBox)
                {
                    TextBox t = (TextBox)con;
                    CharsStatistics.openCharsStatistics(t);
                }
                return(null);
            }));
            toolBindingDic.Add(StrutsStripDataLib.ItemName.总行数, new methodDelegate((Control con) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.ROW_GOTO_FORM, false);
                ff.ShowDialog();
                return(null);
            }));
            toolBindingDic.Add(StrutsStripDataLib.ItemName.行列数, new methodDelegate((Control con) => {
                if (con == null)
                {
                    MessageBox.Show("无法获取控件");
                }
                // 获取控件
                if (con is TextBox)
                {
                    TextBox t = (TextBox)con;
                    CharsStatistics.openCharsStatistics(t);
                }
                return(null);
            }));
            toolBindingDic.Add(StrutsStripDataLib.ItemName.中字符数, new methodDelegate((Control con) => {
                if (con == null)
                {
                    MessageBox.Show("无法获取控件");
                }
                // 获取控件
                if (con is TextBox)
                {
                    TextBox t = (TextBox)con;
                    CharsStatistics.openCharsStatistics(t);
                }
                return(null);
            }));
            toolBindingDic.Add(StrutsStripDataLib.ItemName.编码, new methodDelegate((Control con) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.SET_CODING_FORM, false);
                ff.ShowDialog();
                return(null);
            }));
            toolBindingDic.Add(StrutsStripDataLib.ItemName.大小写状态, new methodDelegate((Control con) => {
                // 开辟新线程执行方法
                ControlsUtils.AsynchronousMethod(this, 1, delegate {
                    ToolStripLabel lable = (ToolStripLabel)this.Items[StrutsStripDataLib.ItemName.大小写状态];
                    byte[] bs            = new byte[256];
                    //判断当前大小写1为大写
                    WindowsApiUtils.GetKeyboardState(bs);
                    if (bs[0x14].Equals(1))  // 判断当前为大写
                    //设置为小写
                    {
                        WindowsApiUtils.SetCapitalState(false);
                        lable.Text = "小写";
                    }
                    else
                    {
                        WindowsApiUtils.SetCapitalState(true);
                        lable.Text = "大写";
                    }
                });
                return(null);
            }));
            toolBindingDic.Add(StrutsStripDataLib.ItemName.只读状态, new methodDelegate(setTextReadOnly));
            return(toolBindingDic);
        }
示例#8
0
        /// <summary>
        /// 顶部菜单选项对应的执行类
        /// </summary>
        /// <param name="t">需要操作的文本框</param>
        /// <returns>Dictionary的对应关系,key为右键菜单选项的name,value为委托类</returns>
        private Dictionary <string, Delegate> eventBinding()
        {
            Dictionary <string, Delegate> toolBindingDic = new Dictionary <string, Delegate>();

            toolBindingDic.Add(this.打开Item.Name, new methodDelegate(TopMenuEventMet.openFileMethod));
            toolBindingDic.Add(this.另存为Item.Name, new methodDelegate(TopMenuEventMet.saveFileMethod));
            toolBindingDic.Add(this.保存Item.Name, new methodDelegate(TopMenuEventMet.saveOrSaveas));
            toolBindingDic.Add(this.用记事本打开Item.Name, new methodDelegate(TopMenuEventMet.notepadOpenFile));
            toolBindingDic.Add(this.退出Item.Name, new methodDelegate(TopMenuEventMet.exitProgram));

            toolBindingDic.Add(this.撤销Item.Name, new methodDelegate(TopMenuEventMet.cancelTextBoxCache));
            toolBindingDic.Add(this.恢复Item.Name, new methodDelegate(TopMenuEventMet.restoreTextBoxCache));

            toolBindingDic.Add(this.全选Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] != null)
                {
                    TextBox t = (TextBox)data[typeof(TextBox)];
                    TextBoxUtils.TextBoxAllSelect(t);
                }
                else
                {
                    MessageBox.Show("无法获取文本框");
                }
                return(null);
            }));
            toolBindingDic.Add(this.剪切Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] != null)
                {
                    TextBox t = (TextBox)data[typeof(TextBox)];
                    TextBoxUtils.TextBoxCuttingText(t);
                }
                else
                {
                    MessageBox.Show("无法获取文本框");
                }
                return(null);
            }));
            toolBindingDic.Add(this.制Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] != null)
                {
                    TextBox t = (TextBox)data[typeof(TextBox)];
                    TextBoxUtils.TextBoxCopyText(t);
                }
                else
                {
                    MessageBox.Show("无法获取文本框");
                }
                return(null);
            }));
            toolBindingDic.Add(this.粘贴Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] != null)
                {
                    TextBox t = (TextBox)data[typeof(TextBox)];
                    TextBoxUtils.TextBoxAddTag(t, TextBoxTagKey.TEXTBOX_EMPTY_NOT_CACHED, true);
                    TextBoxUtils.TextBoxPasteText(t);
                }
                else
                {
                    MessageBox.Show("无法获取文本框");
                }
                return(null);
            }));
            toolBindingDic.Add(this.除Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] != null &&
                    data[typeof(TextBox)] is TextBox)
                {
                    TextBox t = (TextBox)data[typeof(TextBox)];
                    TextBoxUtils.TextBoxDeleteText(t);
                }
                else
                {
                    MessageBox.Show("无法获取文本框");
                }
                return(null);
            }));
            toolBindingDic.Add(this.查找替换Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.FIND_REPLACE_FORM, true);
                ff.Activate();
                ff.Show();
                return(null);
            }));
            toolBindingDic.Add(this.转到行Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.ROW_GOTO_FORM, false);
                ff.Activate();
                ff.ShowDialog();
                return(null);
            }));
            toolBindingDic.Add(this.统计字符Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.CHARS_STATISTICS, false);
                ff.Activate();
                ff.ShowDialog();
                return(null);
            }));
            toolBindingDic.Add(this.时间日期Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] != null &&
                    data[typeof(TextBox)] is TextBox)
                {
                    TextBox t = (TextBox)data[typeof(TextBox)];
                    TextBoxUtils.TextBoxInsertDate(t);
                }
                else
                {
                    MessageBox.Show("无法获取文本框");
                }
                return(null);
            }));

            toolBindingDic.Add(this.置顶Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                ToolStripMenuItem item = (ToolStripMenuItem)data[typeof(ToolStripMenuItem)];
                Form f    = UIComponentFactory.getSingleForm(DefaultNameEnum.ROOT_FORM_NAME);
                f.TopMost = item.Checked;
                return(null);
            }));
            toolBindingDic.Add(this.自动换行Item.Name, new methodDelegate(TopMenuEventMet.isAutoLine));
            toolBindingDic.Add(this.状态栏Item.Name, new methodDelegate(TopMenuEventMet.isStartBarDisplay));

            toolBindingDic.Add(this.字符串工具_分割字符_Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.SPLIT_CHARS_FORM, true);
                ff.Show();
                //SplitCharsForm ff = SplitCharsForm.initPrototypeForm(false);
                //MainTabControlUtils.AddControlsToPage((TabControl)UIComponentFactory.getSingleControl(DefaultNameEnum.TAB_CONTENT),
                //    (TabPage)UIComponentFactory.getPrototypeControl(DefaultNameEnum.TAB_PAGE_NAME), ff, true, true);
                return(null);
            }));
            toolBindingDic.Add(this.字符串工具_添加字符_Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.ADD_CHARS_FORM, true);
                ff.Show();
                //AddCharsForm ff = AddCharsForm.initPrototypeForm(false);
                //MainTabContent.addControlsToPage(ff, true, true);
                return(null);
            }));

            toolBindingDic.Add(this.代码工具_java_生成JAVA实体类.Name, new methodDelegate((Dictionary <Type, object> data) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.CREAD_JAVA_ENTITY, true);
                ff.Show();
                //MainTabControlUtils.AddControlsToPage((TabControl)UIComponentFactory.getSingleControl(DefaultNameEnum.TAB_CONTENT),
                //   (TabPage)UIComponentFactory.getPrototypeControl(DefaultNameEnum.TAB_PAGE_NAME), ff, true, true);
                return(null);
            }));

            toolBindingDic.Add(this.首选项Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                SetUpMain setUpMain = new SetUpMain();
                setUpMain.ShowDialog();
                return(null);
            }));

            toolBindingDic.Add(字体_设置字体Item.Name, new methodDelegate(TopMenuEventMet.fontDialogMethod));
            toolBindingDic.Add(字体_恢复默认Item.Name, new methodDelegate(TopMenuEventMet.textBoxFontReset));
            // 实例化关于窗体
            toolBindingDic.Add(this.关于Item.Name, new methodDelegate((Dictionary <Type, object> data) => {
                Form ff = UIComponentFactory.getSingleForm(DefaultNameEnum.THEREOF_FORM, false);
                ff.ShowDialog();
                return(null);
            }));
            return(toolBindingDic);
        }
示例#9
0
 // 文本框鼠标移入事件
 private void Textbox_MouseEnter(object sender, EventArgs e)
 {
     TextBox textBox = (TextBox)sender;
     // 绑定右键菜单
     Control ccc = UIComponentFactory.getSingleControl(DefaultNameEnum.TEXT_RIGHT_MENU, true);
 }