private static NListBoxItem CreateTestListBoxItem(NRichTextToHtmlExample example) { NListBoxItem item = new NListBoxItem(example.Title); item.Tag = example; return(item); }
private NGroupBox CreatePredefinedDocumentGroupBox() { const string DocxSuffix = "_docx"; NListBox testListBox = new NListBox(); string[] resourceName = NResources.Instance.GetResourceNames(); for (int i = 0, count = resourceName.Length; i < count; i++) { string resName = resourceName[i]; if (resName.EndsWith(DocxSuffix, StringComparison.Ordinal)) { // The current resource is a DOCX document, so add it to the list box string testName = resName.Substring(0, resName.Length - DocxSuffix.Length); testName = testName.Substring(testName.LastIndexOf('_') + 1); NListBoxItem item = new NListBoxItem(NStringHelpers.InsertSpacesBeforeUppersAndDigits(testName)); item.Tag = resName; testListBox.Items.Add(item); } } testListBox.Selection.Selected += OnListBoxItemSelected; testListBox.Selection.SingleSelect(testListBox.Items[1]); return(new NGroupBox("Predefined DOCX documents", testListBox)); }
private void OnAddButtonClick(NEventArgs args) { int index; string value = "0"; if (m_ListBox.Items.Count > 0) { NListBoxItem lastItem = m_ListBox.Items[m_ListBox.Items.Count - 1]; NLabel label = (NLabel)lastItem.GetDescendants(new NInstanceOfSchemaFilter(NLabel.NLabelSchema))[0]; value = label.Text; value = value.Remove(0, value.LastIndexOf(' ') + 1); } // Add an item with the calculated index index = Int32.Parse(value) + 1; NListBoxItem item = new NListBoxItem("Item " + index); item.Tag = index; m_ListBox.Items.Add(item); if (m_ListBox.Items.Count == 1) { m_RemoveAllButton.Enabled = true; } }
public override void Initialize() { base.Initialize(); nComboBox1.KeyPress += new KeyPressEventHandler(nComboBox1_KeyPress); m_ColorMode.Items.Add("Known Colors"); m_ColorMode.Items.Add("Web Colors"); m_ColorMode.Items.Add("System Colors"); m_ColorMode.SelectedIndex = 0; //init some items NListBoxItem item; for (int i = 0; i < 10; i++) { item = new NListBoxItem(); item.Text = "List item " + (i + 1).ToString(); item.ImageIndex = i; nComboBox1.Items.Add(item); nComboBox2.Items.Add(item); nComboBox4.Items.Add(item); } nComboBox2.Editable = true; m_PropertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(m_PropertyGrid_PropertyValueChanged); m_PropertyGrid.SelectedObject = nComboBox1.ListProperties; }
private void OnTestListBoxItemSelected(NSelectEventArgs <NListBoxItem> arg1) { NListBoxItem selectedItem = arg1.Item; if (selectedItem == null) { return; } NRichTextToHtmlExample example = selectedItem.Tag as NRichTextToHtmlExample; if (example == null) { return; } // Recreate the content of the Nevron rich text widget NDocumentBlock documentRoot = example.CreateDocument(); NRichTextDocument document = new NRichTextDocument(); document.Content = documentRoot; document.Evaluate(); m_RichText.Document = document; ExportToHtml(); }
private void OnListBoxItemDeselected(NSelectEventArgs <NListBoxItem> args) { NListBoxItem item = args.Item; int index = item.GetAggregationInfo().Index; m_EventsLog.LogEvent("Deselected Item: " + index.ToString()); }
internal void FillSkinCombo() { NSkinResourceInfo[] arrSkinInfo = m_MainForm.Config.AvailableSkins; if (arrSkinInfo == null) { return; } //add the "Use global skin" item NListBoxItem item = new NListBoxItem(); item.Text = "Use global skin"; this.skinCombo.Items.Add(item); int length = arrSkinInfo.Length; for (int i = 0; i < length; i++) { item = new NListBoxItem(); item.Text = arrSkinInfo[i].SkinDisplayName; item.Tag = arrSkinInfo[i].SkinResourceName; skinCombo.Items.Add(item); } skinCombo.SelectedIndex = 0; skinCombo.SelectedIndexChanged += new EventHandler(skinCombo_SelectedIndexChanged); }
public override void Initialize() { base.Initialize(); nColorListBox1.PopulateKnownColors(); nColorListBox2.PopulateWebColors(); nColorListBox3.PopulateSystemColors(); Color c; NListBoxItem item; nColorListBox4.BeginUpdate(); for (int i = 0; i < 256; i += 30) { for (int j = 0; j < 256; j += 30) { for (int k = 0; k < 256; k += 30) { c = Color.FromArgb(i, j, k); item = new NListBoxItem(c); item.Text = ColorTranslator.ToHtml(c); nColorListBox4.Items.Add(item); } } } nColorListBox4.EndUpdate(); }
public override void Initialize() { base.Initialize(); NTreeViewExUC.AddTestNodes(nTreeViewEx1, 10, 3); //init sample filters NFilter simpleFilter = new NTreeNodeTextFilter("Sample Tree Node 1", CommonStringOptions.Contains, true); NAndFilter compositeFilter = new NAndFilter(); compositeFilter.Add(new NTreeNodeTextFilter("Sample Tree Node 1", CommonStringOptions.Contains, true)); compositeFilter.Add(new NTreeNodeTextFilter("Depth: 0", CommonStringOptions.Contains, true)); NListBoxItem item = new NListBoxItem(); item.Text = "No Filter"; filterCombo.Items.Add(item); item = new NListBoxItem(simpleFilter); item.Text = "Simple Text Filter"; filterCombo.Items.Add(item); item = new NListBoxItem(compositeFilter); item.Text = "Composite 'And' Filter"; filterCombo.Items.Add(item); filterCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); m_XPBackgroundCheck.Checked = nTabControl1.DrawThemeBackground; m_TabStyleCombo.FillFromEnum(typeof(TabStyle), false); m_TabStyleCombo.SelectedItem = TabStyle.Standard; m_TabAlignCombo.FillFromEnum(typeof(TabAlign), false); m_TabAlignCombo.SelectedItem = TabAlign.Top; m_TextOrientationCombo.FillFromEnum(typeof(TextOrientation), false); m_TextOrientationCombo.SelectedItem = TextOrientation.Automatic; m_DefRenderer = new NTabControlRenderer(nTabControl1); m_CustomRenderer = new NCustomTabControlRenderer(nTabControl1); NListBoxItem item; item = new NListBoxItem(m_DefRenderer); item.Text = "Default Renderer"; m_RenderersCombo.Items.Add(item); item = new NListBoxItem(m_CustomRenderer); item.Text = "Custom Renderer"; m_RenderersCombo.Items.Add(item); m_RenderersCombo.SelectedIndex = 0; //nTabPage1.Text = "Long text tab page"; nTabControl1.HasClose = true; }
private void OnListBoxItemSelected(NSelectEventArgs <NListBoxItem> arg) { NListBoxItem selectedItem = arg.Item; switch (selectedItem.Text) { case EnglishLanguageName: // Load the English dictionary m_EnglishStream.Position = 0; NLocalizationDictionary.Instance.LoadFromStream(m_EnglishStream); break; case BulgarianLanguageName: // Load the Bulgarian dictionary m_BulgarianStream.Position = 0; NLocalizationDictionary.Instance.LoadFromStream(m_BulgarianStream); break; case GermanLanguageName: // Load the German dictionary m_GermanStream.Position = 0; NLocalizationDictionary.Instance.LoadFromStream(m_GermanStream); break; } // Recreate the Loan Calculator m_CalculatorHost.Content = CreateLoanCalculator(); }
public override void Initialize() { base.Initialize(); int count = 10; NListBoxItem item1, item2, item3, item4, item5; for (int i = 0; i < count; i++) { item1 = new NListBoxItem(i, "Item " + i, false); item2 = new NListBoxItem(i, "Item " + i, false); item3 = new NListBoxItem(i, "Item " + i, false); item4 = new NListBoxItem(i, "Item " + i, false); item5 = new NListBoxItem(i, "Item " + i, false); nListBox1.Items.Add(item1); nListBox2.Items.Add(item2); nListBox3.Items.Add(item3); nListBox4.Items.Add(item4); nListBox5.Items.Add(item5); } nListBox1.ImageList = MainForm.TestImages; nListBox2.ImageList = MainForm.TestImages; nListBox3.ImageList = MainForm.TestImages; nListBox4.ImageList = MainForm.TestImages; nListBox5.ImageList = MainForm.TestImages; m_CheckStyleCombo.ListProperties.ColumnOnLeft = false; m_CheckStyleCombo.FillFromEnum(typeof(CheckStyle), false); m_CheckStyleCombo.SelectedItem = CheckStyle.Standard; m_CheckStyleCombo.SelectedIndexChanged += new EventHandler(m_CheckStyleCombo_SelectedIndexChanged); }
public override void Initialize() { base.Initialize(); // no skin item NListBoxItem item = new NListBoxItem(); item.Text = "None"; item.Tag = null; skinCombo.Items.Add(item); try { NSkinResourceInfo[] arrSkinInfo = m_MainForm.Config.AvailableSkins; if (arrSkinInfo != null) { int length = arrSkinInfo.Length; for (int i = 0; i < length; i++) { item = new NListBoxItem(); item.Text = arrSkinInfo[i].SkinDisplayName; item.Tag = arrSkinInfo[i].SkinResourceName; skinCombo.Items.Add(item); } } } catch { } m_iSuspendUpdate++; enableSkinManagerCheck.Checked = NSkinManager.Instance.Enabled; m_iSuspendUpdate--; }
/// <summary> /// Called when a request has been completed. Updates the item for the request. /// </summary> /// <param name="request"></param> private void UpdateRequestListBoxItem(NHttpRequest request, NHttpResponse response) { // first clear the boder of all items for (int i = 0; i < m_RequestsListBox.Items.Count; i++) { m_RequestsListBox.Items[i].Border = null; } // highlight the completed item in red NListBoxItem item = m_Request2ListBoxItem[request]; item.Border = NBorder.CreateFilledBorder(NColor.LightCoral); // update the group box header NGroupBox groupBox = (NGroupBox)item.Content; NLabel headerLabel = (NLabel)groupBox.Header.Content; headerLabel.Text += " Response Status: " + response.Status.ToString() + ", Received In: " + (response.ReceivedAt - request.SentAt).TotalSeconds.ToString() + " seconds"; // Disable the Abort button (the first button of the item (first descentant of type button)) NButton abortButton = (NButton)item.GetFirstDescendant(NIsFilter <NNode, NButton> .Instance); abortButton.Enabled = false; // Enable the Headers Button (the last button of the item) NButton headersButton = (NButton)item.GetLastDescendant(NIsFilter <NNode, NButton> .Instance); headersButton.Tag = new object[] { request, response }; headersButton.Enabled = true; }
private void protectionListBox_CheckedChanged(object sender, Nevron.UI.WinForm.Controls.NListBoxItemCheckEventArgs e) { if (EventsHandlingPaused) { return; } NShape shape = (view.Selection.AnchorNode as NShape); if (shape == null) { return; } PauseEventsHandling(); for (int i = 0; i < protectionListBox.Items.Count; i++) { NListBoxItem item = protectionListBox.Items[i]; NAbilities protection = shape.Protection; if (item.Checked) { protection.Mask = protection.Mask | (AbilitiesMask)item.Tag; } else { protection.Mask = protection.Mask & ~(AbilitiesMask)item.Tag; } shape.Protection = protection; } document.SmartRefreshAllViews(); ResumeEventsHandling(); }
private void OnListBoxItemSelected(NSelectEventArgs <NListBoxItem> args) { m_RemoveSelectedButton.Enabled = true; NListBoxItem item = args.Item; m_EventsLog.LogEvent("Selected Item: " + item.Tag.ToString()); }
/// <summary> /// Appends (logs) the specified event description. /// </summary> /// <param name="eventStr"></param> public void LogEvent(string eventStr) { if (m_LogEventCheck.Checked) { NListBoxItem item = new NListBoxItem(m_nEventCounter + ". " + eventStr); m_EventsListBox.Items.Add(item); m_EventsListBox.EnsureVisible(item); m_nEventCounter++; } }
private NListBoxItem CreateListBoxItem(NImage icon, string languageName) { NPairBox pairBox = new NPairBox(icon, languageName, ENPairBoxRelation.Box1BeforeBox2); pairBox.Spacing = NDesign.VerticalSpacing; NListBoxItem item = new NListBoxItem(pairBox); item.Text = languageName; return(item); }
public override void Initialize() { base.Initialize(); Dock = DockStyle.Fill; m_SeparatorsCheck.Checked = m_StatusBar.Separators; Controls.Add(m_StatusBar); m_ControlCombo.Items.Add("(none)"); m_ControlCombo.Items.Add("TextBox"); m_ControlCombo.Items.Add("ComboBox"); m_ControlCombo.Items.Add("Button"); m_ControlCombo.Items.Add("NumericUpDown"); m_ControlCombo.Items.Add("CheckBox"); m_ControlCombo.Items.Add("RadioButton"); m_ControlCombo.Items.Add("ProgressBar"); m_BackColorButton.Color = m_StatusBar.BackColor; m_ForeColorButton.Color = m_StatusBar.Palette.ControlText; //populate autosize combobox m_AutoSizeCombo.FillFromEnum(typeof(StatusBarPanelAutoSize), false); m_AutoSizeCombo.SelectedIndex = 0; //populate alignment combobox m_AlignmentCombo.FillFromEnum(typeof(HorizontalAlignment), false); m_AlignmentCombo.SelectedIndex = 0; //populate borderstyle combobox m_BorderStyleCombo.FillFromEnum(typeof(BorderStyle3D), false); m_BorderStyleCombo.SelectedItem = BorderStyle3D.Flat; //populate gripperstyle combobox m_GripperStyleCombo.FillFromEnum(typeof(GripperStyle), false); m_GripperStyleCombo.SelectedItem = m_StatusBar.GripperStyle; //populate imageindex combobox NListBoxItem item; item = new NListBoxItem(-1, "(none)", false); m_ImageIndexCombo.Items.Add(item); m_ImageIndexCombo.ImageList = MainForm.TestImages; for (int i = 0; i < MainForm.TestImages.Images.Count; i++) { item = new NListBoxItem(i, i.ToString(), false); m_ImageIndexCombo.Items.Add(item); } }
private void OnRemoveAttributeButtonClick(NEventArgs arg) { NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(); dialog.SetupDialogWindow("Select an Attribute to Remove", false); NListBox listBox = new NListBox(); NElementInfo elementInfo = (NElementInfo)m_TreeView.SelectedItem.Tag; INIterator <NKeyValuePair <string, string> > iter = elementInfo.Attributes.GetIterator(); while (iter.MoveNext()) { listBox.Items.Add(new NListBoxItem(iter.Current.Key)); } NButtonStrip buttonStrip = new NButtonStrip(); buttonStrip.InitOKCancelButtonStrip(); NPairBox pairBox = new NPairBox(listBox, buttonStrip, ENPairBoxRelation.Box1AboveBox2); pairBox.Spacing = NDesign.VerticalSpacing; dialog.Content = pairBox; dialog.Opened += delegate(NEventArgs args) { listBox.Focus(); }; dialog.Closed += delegate(NEventArgs args) { if (dialog.Result == ENWindowResult.OK) { // Remove the selected attribute NListBoxItem selectedItem = listBox.Selection.FirstSelected; if (selectedItem != null) { string name = ((NLabel)selectedItem.Content).Text; elementInfo.Attributes.Remove(name); UpdateTreeViewItemText(m_TreeView.SelectedItem); if (elementInfo.Attributes.Count == 0) { m_RemoveAttributeButton.Enabled = false; } } } }; dialog.Open(); }
internal void InitDataSourceCombo() { NListBoxItem item; item = new NListBoxItem("None"); dataSourceCombo.Items.Add(item); item = new NListBoxItem("Array List"); dataSourceCombo.Items.Add(item); item = new NListBoxItem("Data Set"); dataSourceCombo.Items.Add(item); dataSourceCombo.SelectedIndex = 0; }
private LabelFitMode[] GetLabelFitModesFromListBox(NListBox listBox) { ArrayList arrFitModes = new ArrayList(); for (int i = 0; i < listBox.Items.Count; i++) { NListBoxItem item = listBox.Items[i]; if (item.Checked) { arrFitModes.Add((LabelFitMode)i); } } return((LabelFitMode[])arrFitModes.ToArray(typeof(LabelFitMode))); }
private void addBtn_Click(object sender, System.EventArgs e) { NRadioBoxElement box = new NRadioBoxElement(); m_arrButtons.Add(box); box.Text = "Test <b>Radio</b> Button " + m_arrButtons.Count; NListBoxItem item = new NListBoxItem(); item.Tag = box; item.Text = "Button " + m_arrButtons.Count; buttonsList.Items.Add(item); buttonProperties.SelectedObject = box; }
private void UpdateProtectionListBox() { NShape shape = (view.Selection.AnchorNode as NShape); if (shape == null) { protectionGroupBox.Enabled = false; return; } protectionGroupBox.Enabled = true; for (int i = 0; i < protectionListBox.Items.Count; i++) { NListBoxItem item = protectionListBox.Items[i]; item.Checked = shape.Protection.Contains((AbilitiesMask)item.Tag); } }
private void OnCountryDataBindingCreateItemNode(NCreateItemNodeEventArgs <NListBoxItem, NCountry> args) { NCountry country = args.Item; // Create a stack panel NStackPanel stack = new NStackPanel(); stack.Padding = new NMargins(3); stack.Tag = country; // Create the flag image box and the country name label NLabel countryLabel = new NLabel(country.Name); countryLabel.VerticalPlacement = ENVerticalPlacement.Center; countryLabel.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Bold); NImageBox imageBox = new NImageBox(country.Flag); imageBox.VerticalPlacement = ENVerticalPlacement.Center; imageBox.HorizontalPlacement = ENHorizontalPlacement.Left; NPairBox pairBox = new NPairBox(imageBox, countryLabel); pairBox.Spacing = 3; stack.Add(pairBox); // Create the capital label NLabel capitalLabel = new NLabel("Capital: " + country.Capital); stack.Add(capitalLabel); // Create the currency label NLabel currencyLabel = new NLabel("Currency: " + country.CurrencyName + ", " + country.CurrencyCode); stack.Add(currencyLabel); // Create a list box item to host the created widget NListBoxItem listBoxItem = new NListBoxItem(stack); listBoxItem.Text = country.Name; args.Node = listBoxItem; }
private void InitFormControls() { PauseEventsHandling(); // init the active tool combo activeToolCombo.Items.Clear(); NListBoxItem item; item = new NListBoxItem(0, "Pointer Tool", false); activeToolCombo.Items.Add(item); item = new NListBoxItem(2, "Create Ellipse", false); activeToolCombo.Items.Add(item); item = new NListBoxItem(16, "Pan Tool", false); activeToolCombo.Items.Add(item); item = new NListBoxItem(-1, "Custom Tool", false); activeToolCombo.Items.Add(item); // init the toolIndexToNamesMap toolIndexToNamesMap.Clear(); toolIndexToNamesMap[0] = new string[] { NDWFR.ToolCreateGuideline, NDWFR.ToolHandle, NDWFR.ToolMove, NDWFR.ToolSelector, NDWFR.ToolContextMenu, NDWFR.ToolKeyboard, NDWFR.ToolInplaceEdit }; toolIndexToNamesMap[1] = new string[] { NDWFR.ToolCreateEllipse }; toolIndexToNamesMap[2] = new string[] { NDWFR.ToolPan }; toolIndexToNamesMap[3] = new string[] { "Custom Tool" }; // by default select the pointer tool activeToolCombo.SelectedIndex = 0; ResumeEventsHandling(); }
/// <summary> /// Called when a request is about to be submitted. Adds a new entry in the requests list box. /// </summary> /// <param name="request"></param> private void CreateRequestListBoxItem(NHttpRequest request) { NGroupBox groupBox = new NGroupBox(new NLabel("URI: " + request.Uri.ToString())); groupBox.HorizontalPlacement = ENHorizontalPlacement.Fit; NStackPanel stack = new NStackPanel(); stack.HorizontalPlacement = ENHorizontalPlacement.Fit; groupBox.Content = stack; NStackPanel hstack = new NStackPanel(); hstack.Direction = ENHVDirection.LeftToRight; hstack.HorizontalPlacement = ENHorizontalPlacement.Fit; hstack.FillMode = ENStackFillMode.None; hstack.FitMode = ENStackFitMode.Equal; stack.Add(hstack); // create the abort button. // NOTE: the request is recorded in the button Tag NButton abortButton = new NButton("Abort"); abortButton.Click += new Function <NEventArgs>(OnAbortRequestButtonClick); abortButton.Tag = request; hstack.Add(abortButton); NButton headersButton = new NButton("View Response Headers"); headersButton.Click += new Function <NEventArgs>(OnViewResponseHeadersButtonClick); headersButton.Tag = request; headersButton.Enabled = false; hstack.Add(headersButton); // add item NListBoxItem item = new NListBoxItem(groupBox); item.BorderThickness = new NMargins(2); item.Border = null; m_RequestsListBox.Items.Add(item); m_Request2ListBoxItem.Add(request, item); }
internal void InitComboBoxContexts() { NComboBoxCommandContext c = new NComboBoxCommandContext(); c.Properties.ImageList = MainForm.TestImages; c.Properties.Text = "ComboBox"; c.Properties.ID = (int)Contexts.ComboBoxContext1; c.RangeID = 6; c.PrefferedWidth = 150; NListBoxItem item; for (int i = 0; i < 20; i++) { item = new NListBoxItem(i, "NListBoxItem " + i, false); c.Items.Add(item); } m_Manager.Contexts.Add(c); c = new NComboBoxCommandContext(); c.Properties.Text = "Editable ComboBox"; c.Properties.ImageList = MainForm.TestImages; c.Editable = true; c.Properties.ID = (int)Contexts.ComboBoxContext2; c.RangeID = 6; c.PrefferedWidth = 150; for (int i = 0; i < 20; i++) { item = new NListBoxItem(i, "NListBoxItem " + i, false); c.Items.Add(item); } m_Manager.Contexts.Add(c); c = new NFontComboBoxCommandContext(); c.Properties.Text = "Font Combo"; c.Properties.ID = (int)Contexts.ComboBoxContext3; c.RangeID = 6; c.PrefferedWidth = 200; m_Manager.Contexts.Add(c); }
void PopulateAvailableCommands() { m_AvailableCommandsCombo.Items.Clear(); //m_AvailableCommandsCombo.DropDownWidth = 300; NDockingFrameworkCommand[] commands = nDockManager1.Commander.Commands; int length = commands.Length; NDockingFrameworkCommand comm; NListBoxItem item; for (int i = 0; i < length; i++) { comm = commands[i]; item = new NListBoxItem(); item.Text = comm.Name + " - ID: " + comm.ID; item.Tag = comm; m_AvailableCommandsCombo.Items.Add(item); } }
protected override NWidget CreateExampleContent() { // Create a list box m_ListBox = new NListBox(); m_ListBox.HorizontalPlacement = ENHorizontalPlacement.Left; m_ListBox.PreferredSize = new NSize(200, 400); // Add some items for (int i = 0; i < 10; i++) { NListBoxItem item = new NListBoxItem("Item " + i.ToString()); item.Tag = i; m_ListBox.Items.Add(item); } // Hook to list box selection events m_ListBox.Selection.Selected += new Function <NSelectEventArgs <NListBoxItem> >(OnListBoxItemSelected); m_ListBox.Selection.Deselected += new Function <NSelectEventArgs <NListBoxItem> >(OnListBoxItemDeselected); return(m_ListBox); }