internal Control GetControl() { switch (m_ControlCombo.SelectedIndex) { case 0: return(null); case 1: NTextBox tb = new NTextBox(); tb.Text = "NTextBox"; return(tb); case 2: NComboBox cb = new NComboBox(); cb.ImageList = MainForm.TestImages; for (int i = 0; i < 20; i++) { cb.Items.Add(new NListBoxItem(i, "Item " + (i + 1), false)); } return(cb); case 3: NButton b = new NButton(); b.Text = "Test Button"; return(b); case 4: NNumericUpDown ud = new NNumericUpDown(); return(ud); case 5: NCheckBox chb = new NCheckBox(); chb.Text = "NCheckBox"; chb.TransparentBackground = true; return(chb); case 6: NRadioButton rb = new NRadioButton(); rb.Text = "NRadioButton"; rb.TransparentBackground = true; return(rb); case 7: NProgressBar bar = new NProgressBar(); bar.Properties.Style = Nevron.UI.WinForm.Controls.ProgressBarStyle.Gradient; bar.Properties.Value = 60; return(bar); } return(null); }
public static string GetXml(object obj, bool showProgress = false) { NProgressBar pb = null; if (showProgress) { pb = GetProgressBar(); prevBar = pb; } var xml = new XmlSerializer(obj.GetType()); if (pb != null) { pb.OnTimerTick += onPbInv; pb.Increment(20); } string tempPath = Path.GetTempFileName(); if (pb != null) { pb.Increment(20); } StreamWriter mem = new StreamWriter(tempPath); mem.AutoFlush = true; xml.Serialize(mem, obj); mem.Close(); if (pb != null) { pb.Increment(20); } var reader = new StreamReader(tempPath); var str = reader.ReadToEnd(); reader.Close(); if (pb != null) { pb.Increment(20); } File.Delete(tempPath); if (pb != null) { pb.Increment(20); } //if(pb != null) //{ // pb.FindForm().Close(); //} return(str); }
static NProgressBar GetProgressBar() { Form f = new Form(); f.FormBorderStyle = FormBorderStyle.None; f.Size = new Size(300, 50); f.Text = "Progress..."; NProgressBar pb = new NProgressBar(); pb.Parent = f; pb.Dock = DockStyle.Fill; pb.Show(); pb.Minimum = 0; pb.Maximum = 100; f.Show(Form.ActiveForm); return(pb); }
protected override NWidget CreateExampleContent() { NStackPanel stack = new NStackPanel(); stack.HorizontalPlacement = ENHorizontalPlacement.Left; stack.VerticalPlacement = ENVerticalPlacement.Top; // Horizontal progress bar m_HorizontalProgressBar = new NProgressBar(); m_HorizontalProgressBar.Style = ENProgressBarStyle.Horizontal; m_HorizontalProgressBar.Value = DefaultProgress; m_HorizontalProgressBar.PreferredSize = new NSize(300, 30); m_HorizontalProgressBar.VerticalPlacement = ENVerticalPlacement.Top; stack.Add(new NGroupBox("Horizontal", m_HorizontalProgressBar)); // Vertical progress bar m_VerticalProgressBar = new NProgressBar(); m_VerticalProgressBar.Style = ENProgressBarStyle.Vertical; m_VerticalProgressBar.Value = DefaultProgress; m_VerticalProgressBar.PreferredSize = new NSize(30, 300); m_VerticalProgressBar.HorizontalPlacement = ENHorizontalPlacement.Left; stack.Add(new NGroupBox("Vertical", m_VerticalProgressBar)); // Circular progress bar - 50% rim m_CircularProgressBar1 = new NProgressBar(); m_CircularProgressBar1.Style = ENProgressBarStyle.Circular; m_CircularProgressBar1.Value = DefaultProgress; m_CircularProgressBar1.PreferredSize = new NSize(150, 150); // Circular progress bar - 100% rim m_CircularProgressBar2 = new NProgressBar(); m_CircularProgressBar2.Style = ENProgressBarStyle.Circular; m_CircularProgressBar2.Value = DefaultProgress; m_CircularProgressBar2.RimWidthPercent = 100; m_CircularProgressBar2.PreferredSize = new NSize(150, 150); NPairBox pairBox = new NPairBox(m_CircularProgressBar1, m_CircularProgressBar2); pairBox.Spacing = 30; stack.Add(new NGroupBox("Circular", pairBox)); return(stack); }
private NStackPanel CreateRangeBased() { NStackPanel stack = new NStackPanel(); stack.VerticalSpacing = 10; NNumericUpDown numericUpDown = new NNumericUpDown(); stack.Add(numericUpDown); NSlider slider = new NSlider(); stack.Add(slider); NProgressBar progressBar = new NProgressBar(); progressBar.PreferredHeight = 20; progressBar.Value = 40; stack.Add(progressBar); return(stack); }