//evento para cerrar las pestañas private void TitusTabControl_TabButtonClicked(object sender, LidorSystems.IntegralUI.ObjectClickEventArgs e) { if (e.Object is LidorSystems.IntegralUI.Controls.CommandButton) { LidorSystems.IntegralUI.Controls.CommandButton btn = (LidorSystems.IntegralUI.Controls.CommandButton)e.Object; // Check whether the type of a button is a close button if (btn.Key == "TAB_CLOSE") { // Locate the tab in which the command button was clicked LidorSystems.IntegralUI.Containers.TabPage page = this.GetPageAt(e.Position); if (page != null) { // Depending on the action, you can determine whether you want to hide or dispose the tab switch (this.CloseAction) { case LidorSystems.IntegralUI.CloseAction.Hide: page.Hide(); break; default: TitusTab TTaux = (TitusTab)this.SelectedPage; //preguntamos si ha sido modificado el contenido para preguntar si desea guardar if (TTaux.EsModificado()) { switch (MessageBox.Show("Desea guardar el archivo", "Guardar archivo", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk)) { case DialogResult.Yes: guardarTab(); page.Remove(); break; case DialogResult.No: page.Remove(); break; default: break; } } else { page.Remove(); } break; } } } } }
private void initComponent(String texto) { //iniciamos la bandera para saber si ha sido guardado los datos this.modificado = false; //Inicializamos la gramatica y su lenguage para tener el parse Gramatica = new SBScriptGrammar(); language = new LanguageData(Gramatica); parser = new Parser(language); //creamos el textbox TBContenido = new IronyFCTB(); TBContenido.Grammar = Gramatica; TBContenido.Multiline = true; TBContenido.Text = texto; //TBContenido.ScrollBars = RichTextBoxScrollBars.Both; TBContenido.WordWrap = false; TBContenido.Dock = DockStyle.Fill; //configuramos el label panel = new Label(); panel.Dock = DockStyle.Bottom; panel.Text = "Linea: 1, Columna: 1"; panel.TextAlign = ContentAlignment.MiddleRight; //agregamos los eventos TBContenido.TextChanged += TBContenido_TextChanged; TBContenido.SelectionChanged += TBContenido_SelectionChanged; //agregamos los elementos this.Controls.Add(TBContenido); this.Controls.Add(panel); //creamos el boton cerrar LidorSystems.IntegralUI.Controls.CommandButton closeButton = new LidorSystems.IntegralUI.Controls.CommandButton(); closeButton.ImageIndex = 0; closeButton.Key = "TAB_CLOSE"; //agreagamos el boton al tab this.Buttons.Add(closeButton); this.UseParentButtons = false; }
private void InitComponent(String texto) { //iniciamos la bandera para saber si ha sido guardado los datos this.modificado = false; switch (this.Tipo) { case 0: { //Inicializamos la gramatica y su lenguage para tener el parse GramaticaOLC = new OLCGrammar(); language = new LanguageData(GramaticaOLC); parser = new Parser(language); //creamos el textbox TBContenido = new IronyFCTB() { Grammar = GramaticaOLC }; } break; case 1: { //Inicializamos la gramatica y su lenguage para tener el parse GramaticaTree = new TreeGrammar(); language = new LanguageData(GramaticaTree); parser = new Parser(language); //creamos el textbox TBContenido = new IronyFCTB() { Grammar = GramaticaTree }; } break; case 2: { //Inicializamos la gramatica y su lenguage para tener el parse Gramatica3D = new _3DGrammar(); language = new LanguageData(Gramatica3D); parser = new Parser(language); //creamos el textbox TBContenido = new IronyFCTB() { Grammar = Gramatica3D }; } break; } TBContenido.Multiline = true; TBContenido.Text = texto; //TBContenido.ScrollBars = RichTextBoxScrollBars.Both; TBContenido.WordWrap = false; TBContenido.Dock = DockStyle.Fill; //configuramos el label panel = new Label() { Dock = DockStyle.Bottom, Text = "Linea: 1, Columna: 1", TextAlign = ContentAlignment.MiddleRight }; //agregamos los eventos TBContenido.TextChanged += TBContenido_TextChanged; TBContenido.SelectionChanged += TBContenido_SelectionChanged; //agregamos los elementos this.Controls.Add(TBContenido); this.Controls.Add(panel); //creamos el boton cerrar LidorSystems.IntegralUI.Controls.CommandButton closeButton = new LidorSystems.IntegralUI.Controls.CommandButton() { ImageIndex = 0, Key = "TAB_CLOSE" }; //agreagamos el boton al tab this.Buttons.Add(closeButton); this.UseParentButtons = false; }