private void buttonSpecAny_Close_Click(object sender, EventArgs e) { ButtonSpecAny bsa = sender as ButtonSpecAny; KryptonTextBox tb = bsa.Owner as KryptonTextBox; tb.Text = null; }
private Control CreateUrlControl(ObjectData obj, Field field) { KryptonTextBox textBox = new KryptonTextBox(); textBox.Text = obj[field].ToString(); ButtonSpecAny button = new ButtonSpecAny(); button.Text = string.Empty; button.Image = Resources.folder2; if (((UrlProperty)field.Data).Type == UrlType.Select) { button.KryptonContextMenu = this.CreateUrlContextMenu(textBox); } else { button.Tag = field.Data; button.Click += new EventHandler(this.SelectUrlTextClick); } textBox.ButtonSpecs.Add(button); /*textBox.StateCommon.Border.Rounding = 4; * textBox.StateCommon.Border.Width = 2;*/ return(textBox); }
private void ComboBoxClearClick(object sender, EventArgs e) { ButtonSpecAny item = (ButtonSpecAny)sender; KryptonComboBox combo = (KryptonComboBox)item.Owner; combo.SelectedIndex = -1; }
public static void setPageCloseable(bool?closeable, KryptonPage page) { if (page == null) { throw new ArgumentNullException("page"); } if (closeable == null || !closeable.Value) { if (page.ButtonSpecs.Count > 0) { var close = page.ButtonSpecs[0]; close.Click -= Close_Click; page.ButtonSpecs.Remove(close); } } else { ButtonSpecAny close = new ButtonSpecAny() { Type = PaletteButtonSpecStyle.Close, ToolTipTitle = "关闭", ToolTipStyle = LabelStyle.ToolTip }; close.Click += Close_Click; page.ButtonSpecs.Add(close); } }
private void InsertNewPage() { KryptonPage newPage = new KryptonPage { Text = $"Query {navigator.Pages.Count}" }; newPage.Controls.Add(new SqlControl() { Dock = DockStyle.Fill }); ButtonSpecAny newButton = new ButtonSpecAny() { Image = Resources.add_16x16, }; newButton.Click += NewPageClick; newPage.ButtonSpecs.Add(newButton); newPage.KryptonContextMenu = rightClickContext; newPage.Tag = false; navigator.Pages.Insert(navigator.Pages.Count, newPage); navigator.SelectedPage = newPage; //Remove add button from the previous page. navigator.Pages[navigator.Pages.Count - 2].ButtonSpecs.Clear(); if (navigator.Pages.Count == 2) { navigator.Button.CloseButtonDisplay = ButtonDisplay.ShowEnabled; } }
/// <summary> /// Initialize a new instance of the DataGridViewButtonSpecClickEventArgs class. /// </summary> /// <param name="column">Reference to data grid view column.</param> /// <param name="cell">Reference to data grid view cell.</param> /// <param name="buttonSpec">Reference to button spec.</param> public DataGridViewButtonSpecClickEventArgs(DataGridViewColumn column, DataGridViewCell cell, ButtonSpecAny buttonSpec) { Column = column; Cell = cell; ButtonSpec = buttonSpec; }
private void OnClosePage(object sender, EventArgs e) { // Find the page this button is contained within ButtonSpecAny bsa = (ButtonSpecAny)sender; // Close the page CloseMemoPage((KryptonPage)bsa.Tag); }
private static void Close_Click(object sender, EventArgs e) { ButtonSpecAny close = sender as ButtonSpecAny; KryptonPage page = close.Owner as KryptonPage; KryptonNavigator tab = page.KryptonParentContainer as KryptonNavigator; remove(getTabItemModel(page), tab); }
private void SelectUrlTextClick(object sender, EventArgs e) { ButtonSpecAny button = (ButtonSpecAny)sender; UrlProperty prop = (UrlProperty)button.Tag; KryptonTextBox txt = button.Owner as KryptonTextBox; this.ShowSelectUrlDialog(txt, prop.Type); }
private void ClearFieldData(object sender, EventArgs e) { ButtonSpecAny b = (ButtonSpecAny)sender; KryptonDataGridViewComboBoxCell combo = (KryptonDataGridViewComboBoxCell)b.Owner; // FIXME: Значение очищается только после нажатия Enter или потери фокуса combo.Value = null; }
public KryptonFolderDialogTextBox() { ButtonSpecAny button = new ButtonSpecAny(); button.Text = "..."; button.Click += Button_Click; this.ButtonSpecs.Add(button); }
/// <summary> /// Make a clone of this object. /// </summary> /// <returns>New instance.</returns> public override object Clone() { ButtonSpecAny clone = (ButtonSpecAny)base.Clone(); clone.Visible = Visible; clone.Enabled = Enabled; clone.Checked = Checked; clone.Type = Type; return(clone); }
private void buttonSpecsAdd_Click(object sender, EventArgs e) { foreach (KryptonPage page in kryptonDockingManager.Pages) { // Create a button spec and make it a random style so we get a random image ButtonSpecAny bs = new ButtonSpecAny(); bs.Type = _buttonSpecStyles[_random.Next(_buttonSpecStyles.Length)]; page.ButtonSpecs.Add(bs); } }
private void addArrow_Click(object sender, EventArgs e) { if (kryptonNavigator.SelectedPage != null) { ButtonSpecAny bsa = new ButtonSpecAny(); bsa.Style = PaletteButtonStyle.Alternate; bsa.Type = PaletteButtonSpecStyle.ArrowRight; bsa.Tag = kryptonNavigator.SelectedPage; kryptonNavigator.SelectedPage.ButtonSpecs.Add(bsa); } }
private void addText_Click(object sender, EventArgs e) { if (kryptonNavigator.SelectedPage != null) { ButtonSpecAny bsa = new ButtonSpecAny(); bsa.Style = PaletteButtonStyle.Standalone; bsa.Text = DateTime.Now.Millisecond.ToString(); bsa.Tag = kryptonNavigator.SelectedPage; kryptonNavigator.SelectedPage.ButtonSpecs.Add(bsa); } }
public frmImportaEscritorNfe() { InitializeComponent(); ButtonSpecAny btnPastaPadrao = new ButtonSpecAny(); btnPastaPadrao.UniqueName = "btnPastaPadrao"; btnPastaPadrao.Image = HLP.GeraXml.UI.Properties.Resources.Pasta; btnPastaPadrao.Style = ComponentFactory.Krypton.Toolkit.PaletteButtonStyle.InputControl; btnPastaPadrao.Click += new EventHandler(btnPastaPadrao_Click); txtXml.txt.ButtonSpecs.Add(btnPastaPadrao); }
private void addContext_Click(object sender, EventArgs e) { if (kryptonNavigator.SelectedPage != null) { ButtonSpecAny bsa = new ButtonSpecAny(); bsa.Type = PaletteButtonSpecStyle.Context; bsa.Style = PaletteButtonStyle.Standalone; bsa.KryptonContextMenu = kryptonContextMenu; bsa.Tag = kryptonNavigator.SelectedPage; kryptonNavigator.SelectedPage.ButtonSpecs.Add(bsa); } }
private void frmConfiguracao_Load(object sender, EventArgs e) { try { ButtonSpecAny btnPastaPadrao = new ButtonSpecAny(); btnPastaPadrao.UniqueName = "btnPastaPadrao"; btnPastaPadrao.Image = HLP.GeraXml.UI.Properties.Resources.Pasta; btnPastaPadrao.Style = ComponentFactory.Krypton.Toolkit.PaletteButtonStyle.InputControl; btnPastaPadrao.Click += new System.EventHandler(btnPastas_Click); ButtonSpecAny btnPastaRelatorio = new ButtonSpecAny(); btnPastaRelatorio.UniqueName = "btnPastaRelatorio"; btnPastaRelatorio.Image = HLP.GeraXml.UI.Properties.Resources.Pasta; btnPastaRelatorio.Style = ComponentFactory.Krypton.Toolkit.PaletteButtonStyle.InputControl; btnPastaRelatorio.Click += new System.EventHandler(btnPastas_Click); ButtonSpecAny btnCaminhoLogo = new ButtonSpecAny(); btnCaminhoLogo.Image = HLP.GeraXml.UI.Properties.Resources.Pasta; btnCaminhoLogo.UniqueName = "btnCaminhoLogo"; btnCaminhoLogo.Style = ComponentFactory.Krypton.Toolkit.PaletteButtonStyle.InputControl; btnCaminhoLogo.Click += new System.EventHandler(btnPastas_Click); ButtonSpecAny btnCaminhoBanco = new ButtonSpecAny(); btnCaminhoBanco.UniqueName = "btnCaminhoBanco"; btnCaminhoBanco.Image = HLP.GeraXml.UI.Properties.Resources.Pasta; btnCaminhoBanco.Style = ComponentFactory.Krypton.Toolkit.PaletteButtonStyle.InputControl; btnCaminhoBanco.Click += new System.EventHandler(btnPastas_Click); ButtonSpecAny btnPastaPesquisar = new ButtonSpecAny(); btnPastaPadrao.UniqueName = "btnPastaPesquisar"; btnPastaPadrao.Image = HLP.GeraXml.UI.Properties.Resources.Pasta; btnPastaPadrao.Style = ComponentFactory.Krypton.Toolkit.PaletteButtonStyle.InputControl; btnPastaPadrao.Click += new System.EventHandler(btnPastas_Click); // txtCaminhoPadrao.txt.ReadOnly = true; txtCaminhoPadrao.txt.ButtonSpecs.Add(btnPastaPadrao); txtPastaEnviados.txt.ButtonSpecs.Add(btnPastaPadrao); //txtCaminhoPastaRelatorio.txt.ReadOnly = true; txtCaminhoPastaRelatorio.txt.ButtonSpecs.Add(btnPastaRelatorio); //txtCaminhoLogo.txt.ReadOnly = true; txtCaminhoLogo.txt.ButtonSpecs.Add(btnCaminhoLogo); //txtBancoDados.txt.ReadOnly = true; txtBancoDados.txt.ButtonSpecs.Add(btnCaminhoBanco); CarregarDados(); } catch (Exception ex) { new HLPexception(ex); } }
public frmLocalXml(string sCaminho) { InitializeComponent(); txtCaminho.Text = @sCaminho; ButtonSpecAny btnPesquisar = new ButtonSpecAny(); btnPesquisar.Image = HLP.GeraXml.UI.Properties.Resources.Pasta; btnPesquisar.Style = ComponentFactory.Krypton.Toolkit.PaletteButtonStyle.InputControl; btnPesquisar.Click += new System.EventHandler(btnPesquisar_Click); txtCaminho.txt.ButtonSpecs.Add(btnPesquisar); }
private Control CreateReferenceControl(ObjectData obj, Field field) { KryptonComboBox combo = new KryptonComboBox(); combo.DropDownStyle = ComboBoxStyle.DropDownList; ObjectClass c = ReferenceProperty.Get(field).Reference; ButtonSpecAny item; if (!string.IsNullOrEmpty(c.Form)) { item = new ButtonSpecAny(); item.Image = Resources.plus; item.Edge = PaletteRelativeEdgeAlign.Near; item.Style = PaletteButtonStyle.Standalone; //item.Style = PaletteButtonStyle.NavigatorStack; item.Click += new EventHandler(this.ComboBoxAddClick); combo.ButtonSpecs.Add(item); } item = new ButtonSpecAny(); item.Image = Resources.crest; item.Edge = PaletteRelativeEdgeAlign.Near; item.Style = PaletteButtonStyle.Standalone; //item.Style = PaletteButtonStyle.NavigatorStack; item.Click += new EventHandler(this.ComboBoxClearClick); combo.ButtonSpecs.Add(item); if (c != null) { foreach (ObjectData d in Data.Objects.GetData(c)) { combo.Items.Add(d); } if (obj[field] is ObjectData) { combo.SelectedItem = (ObjectData)obj[field]; } else { combo.SelectedIndex = -1; } } /*combo.StateCommon.ComboBox.Border.Rounding = 4; * combo.StateCommon.ComboBox.Border.Width = 2;*/ return(combo); }
private void ComboBoxAddClick(object sender, EventArgs e) { ButtonSpecAny item = (ButtonSpecAny)sender; KryptonComboBox combo = (KryptonComboBox)item.Owner; Field field = (Field)combo.Tag; ObjectClass c = ReferenceProperty.Get(field).Reference; ObjectData d = collection.Add(c, false); if (d != null) { combo.Items.Add(d); combo.SelectedItem = d; this.AddDataItem(field, d); } }
private void frmSelecionaConfigs_Load(object sender, EventArgs e) { txtXmlConfig.txt.ReadOnly = true; if (Pastas.PASTA_XML_CONFIG != null) { txtXmlConfig.Text = Pastas.PASTA_XML_CONFIG.ToString(); } ButtonSpecAny btnPesquisar = new ButtonSpecAny(); btnPesquisar.Image = HLP.GeraXml.UI.Properties.Resources.Pasta; btnPesquisar.Style = ComponentFactory.Krypton.Toolkit.PaletteButtonStyle.InputControl; btnPesquisar.Click += new System.EventHandler(btnCaminhoXml_Click); txtXmlConfig.txt.ButtonSpecs.Add(btnPesquisar); CarregaNomeArquivos(); }
private void btnLocalInstalador_Click(object sender, EventArgs e) { ButtonSpecAny btn = (ButtonSpecAny)sender; if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { if (btn.UniqueName == "btnLocalToPublish") { txtPastaToPublish.Text = folderBrowserDialog1.SelectedPath; CarregaVersao(); } else { txtPastaInstalador.Text = folderBrowserDialog1.SelectedPath; } } }
private KryptonPage CreateNewMemo(string text, string description, string memo, bool loaded) { // Define page name and images KryptonPage page = new KryptonPage(); page.Text = text; page.TextTitle = description; page.TextDescription = description; page.ImageSmall = MemoEditor.Properties.Resources.note16; page.ImageMedium = MemoEditor.Properties.Resources.note24; page.ImageLarge = MemoEditor.Properties.Resources.note32; // Place border between page and internal controls page.Padding = new Padding(5); // Use the tag to remember if the page was loaded or is new page.Tag = loaded; // Create a close button for the page ButtonSpecAny bsa = new ButtonSpecAny(); bsa.Tag = page; bsa.Type = PaletteButtonSpecStyle.Close; bsa.Click += new EventHandler(OnClosePage); page.ButtonSpecs.Add(bsa); // We use the rich text box as the memo editor KryptonRichTextBox rtb = new KryptonRichTextBox(); rtb.StateCommon.Border.Draw = InheritBool.False; rtb.Dock = DockStyle.Fill; rtb.Text = memo; rtb.Tag = page; // Need to know when the user makes a change to the memo text rtb.TextChanged += new EventHandler(kryptonRichTextBox_TextChanged); // Add rich text box as content page.Controls.Add(rtb); return(page); }
/// <summary> /// 获取规则文本框的方法 /// </summary> /// <returns></returns> private KryptonTextBox GetRuleTextBox(string text) { ButtonSpecAny bsa1 = new ButtonSpecAny(); ButtonSpecAny bsa2 = new ButtonSpecAny(); ButtonSpecAny bsa3 = new ButtonSpecAny(); // // buttonSpecAny1 // bsa1.Type = ComponentFactory.Krypton.Toolkit.PaletteButtonSpecStyle.Close; bsa1.UniqueName = "2600D6A1691343B72600D6A1691343B7"; bsa1.Click += new System.EventHandler(this.buttonSpecAny1_Click_1); // // buttonSpecAny8 // bsa2.Type = ComponentFactory.Krypton.Toolkit.PaletteButtonSpecStyle.ArrowLeft; bsa2.UniqueName = "81A6EAED0E4A49478AB7CCC0D19512A1"; bsa2.Click += new System.EventHandler(this.buttonSpecAny1_Click_2); // // buttonSpecAny9 // bsa3.Type = ComponentFactory.Krypton.Toolkit.PaletteButtonSpecStyle.ArrowRight; bsa3.UniqueName = "D44D64BE0EFF49C4C18C8DA6C886E6DD"; bsa3.Click += new System.EventHandler(this.buttonSpecAny1_Click_3); KryptonTextBox ktb = new KryptonTextBox(); ktb.AllowButtonSpecToolTips = true; ktb.ButtonSpecs.AddRange(new ComponentFactory.Krypton.Toolkit.ButtonSpecAny[] { bsa1, bsa2, bsa3 }); ktb.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); ktb.Location = new System.Drawing.Point(391, 96); ktb.Name = "ktb_module"; ktb.PaletteMode = ComponentFactory.Krypton.Toolkit.PaletteMode.Office2007Blue; ktb.ReadOnly = true; ktb.Size = new System.Drawing.Size(157, 23); ktb.TabIndex = 2; ktb.Visible = true; ktb.Text = text; return(ktb); }
private void navigator_CloseAction(object sender, CloseActionEventArgs e) { ButtonSpecAny newButton = new ButtonSpecAny() { Image = Resources.add_16x16, }; newButton.Click += NewPageClick; if (e.Index == 1) { navigator.Button.CloseButtonDisplay = ButtonDisplay.Hide; pgOne.ButtonSpecs.Add(newButton); } else { navigator.Pages[e.Index - 1].ButtonSpecs.Add(newButton); } }
private void CreateColumns() { foreach (ColumnProperty c in (List <ColumnProperty>) this.field.Data) { DataGridViewColumn col; if (c.Reference == null) { col = new KryptonDataGridViewTextBoxColumn(); } else { col = new KryptonDataGridViewComboBoxColumn(); KryptonDataGridViewComboBoxColumn colCombo = (KryptonDataGridViewComboBoxColumn)col; colCombo.DropDownStyle = ComboBoxStyle.DropDownList; ButtonSpecAny b = new ButtonSpecAny(); b.Type = PaletteButtonSpecStyle.Close; b.Edge = PaletteRelativeEdgeAlign.Near; b.Click += new EventHandler(this.ClearFieldData); colCombo.ButtonSpecs.Add(b); foreach (ObjectData od in this.database.Objects.GetData(c.Reference)) { colCombo.Items.Add(od.ToString()); } } col.Tag = c; col.Name = c.Name; col.HeaderText = c.Name; col.Width = c.Width; col.MinimumWidth = c.MinWidth; col.Visible = c.Visible; col.Resizable = c.Resizable ? DataGridViewTriState.True : DataGridViewTriState.False; col.Frozen = c.Frozen; col.DividerWidth = c.DividerWidth; col.AutoSizeMode = c.AutoSize ? DataGridViewAutoSizeColumnMode.Fill : DataGridViewAutoSizeColumnMode.None; col.FillWeight = c.FillWeight; this.grid.Columns.Add(col); } grid.StateCommon.Background.Color1 = Color.Transparent; }
protected void btnPastas_Click(object sender, EventArgs e) { ButtonSpecAny btn = (ButtonSpecAny)sender; if ( (btn.UniqueName.Equals("btnPastaPadrao")) || (btn.UniqueName.Equals("btnPastaRelatorio")) || (btn.UniqueName.Equals("btnPastaPesquisar"))) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { switch (btn.UniqueName) { case "btnPastaPadrao": txtCaminhoPadrao.Text = folderBrowserDialog1.SelectedPath; break; case "btnPastaRelatorio": txtCaminhoPastaRelatorio.Text = folderBrowserDialog1.SelectedPath; break; case "btnPastaPesquisar": txtPastaEnviados.Text = folderBrowserDialog1.SelectedPath; break; } } } else { if (openFileDialog1.ShowDialog() == DialogResult.OK) { switch (btn.UniqueName) { case "btnCaminhoLogo": txtCaminhoLogo.Text = openFileDialog1.FileName.ToString(); break; case "btnCaminhoBanco": txtBancoDados.Text = openFileDialog1.FileName.ToString(); break; } } } }
// ======================================== // constructor // ======================================== public MarkSelectTextBox() { ReadOnly = true; var bspec = new ButtonSpecAny(); bspec.Image = Resources.chevron_expand; bspec.Click += HandleSelectButtonSpecClick; ButtonSpecs.Add(bspec); bspec = new ButtonSpecAny(); bspec.Type = PaletteButtonSpecStyle.Close; bspec.Click += HandleCloseButtonSpecClick; ButtonSpecs.Add(bspec); TextBox.MouseClick += (se, ev) => { ShowMarkSelectForm(); }; TextBox.GotFocus += (se, ev) => { User32PI.HideCaret(TextBox.Handle); }; UpdateText(); }
protected KryptonPage CreatePage(string uniqueName, bool createCloseButton) { KryptonPage page = new KryptonPage("No data", null, uniqueName); page.TextTitle = "description"; page.TextDescription = "description"; if (createCloseButton) { var bsa = new ButtonSpecAny(); bsa.Tag = page; bsa.Type = PaletteButtonSpecStyle.Close; bsa.Click += (s, e) => { var closingPage = (KryptonPage)((ButtonSpecAny)s).Tag; //!!!!TEST: dockingManager.CloseRequest(new string[] { closingPage.UniqueName }); //dockableWorkspaceControl.ClosePage( closingPage ); }; page.ButtonSpecs.Add(bsa); } return(page); }