public Example_AForge_TexturesDemo(Base parent) : base(parent) { // GUI { m_TopPanel = new Alt.GUI.Temporary.Gwen.Control.Base(this); { m_TopPanel.Dock = Pos.Top; m_TopPanel.Height = 20; m_TopPanel.Margin = new Margin(0, 0, 0, 10); label1 = new Alt.GUI.Temporary.Gwen.Control.Label(m_TopPanel); texturesCombo = new Alt.GUI.Temporary.Gwen.Control.ComboBox(m_TopPanel); regenerateButton = new Alt.GUI.Temporary.Gwen.Control.Button(m_TopPanel); label1.AutoSizeToContents = true; label1.Dock = Pos.Left; label1.Text = "Texture:"; label1.Margin = new Margin(0, 2, 0, 0); texturesCombo.AddItem("Clouds").UserData = 0; texturesCombo.AddItem("Marble").UserData = 1; texturesCombo.AddItem("Wood").UserData = 2; texturesCombo.AddItem("Labyrinth").UserData = 3; texturesCombo.AddItem("Textile").UserData = 4; texturesCombo.Dock = Pos.Left; texturesCombo.ItemSelected += texturesCombo_SelectedIndexChanged; texturesCombo.Margin = new Margin(5, 0, 0, 0); regenerateButton.Dock = Pos.Left; regenerateButton.Text = "Regenerate"; regenerateButton.Click += regenerateButton_Click; regenerateButton.Margin = new Margin(10, 0, 0, 0); regenerateButton.NormalTextColor = Color.Green; } pictureBox = new Alt.GUI.Temporary.Gwen.Control.PictureBox(this); pictureBox.Dock = Pos.Fill; pictureBox.DrawBorder = true; pictureBox.BorderColor = Color.DodgerBlue; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); { Alt.GUI.Temporary.Gwen.Control.ComboBox combo = new Alt.GUI.Temporary.Gwen.Control.ComboBox(this); combo.SetPosition(50, 50); combo.Width = 200; combo.AddItem("Option One", "one"); combo.AddItem("Number Two", "two"); combo.AddItem("Door Three", "three"); combo.AddItem("Four Legs", "four"); combo.AddItem("Five Birds", "five"); combo.ItemSelected += OnComboSelect; } { // Empty.. Alt.GUI.Temporary.Gwen.Control.ComboBox combo = new Alt.GUI.Temporary.Gwen.Control.ComboBox(this); combo.SetPosition(50, 80); combo.Width = 200; } { // Empty.. Alt.GUI.Temporary.Gwen.Control.ComboBox combo = new Alt.GUI.Temporary.Gwen.Control.ComboBox(this); combo.SetPosition(50, 110); combo.Width = 200; for (int i = 0; i < 500; i++) { combo.AddItem(String.Format("Option {0}", i)); } combo.ItemSelected += OnComboSelect; } }
protected void CreateFontPanel() { // Font m_FontPanel = new Base(this); m_FontPanel.Dock = Pos.Bottom; m_FontPanel.Margin = new Margin(0, 10, 0, 0); // Font Family Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(m_FontPanel); label.AutoSizeToContents = true; label.Dock = Pos.Top; label.Margin = new Margin(0, 0, 0, 3); label.Text = "Font Family:"; FontFamily[] families = (new InstalledFontCollection()).Families; m_FontFamily = new Alt.GUI.Temporary.Gwen.Control.ComboBox(m_FontPanel); m_FontFamily.Dock = Pos.Top; m_FontFamily.Margin = new Margin(0, 0, 0, 7); foreach (FontFamily family in families) { Alt.GUI.Temporary.Gwen.Control.MenuItem item = m_FontFamily.AddItem(family.Name); item.Tag = family; m_FamilyMenus.Add(family.Name, item); } m_FontFamily.ItemSelected += OnFontFamilySelect; // Font Style label = new Alt.GUI.Temporary.Gwen.Control.Label(m_FontPanel); label.AutoSizeToContents = true; label.Dock = Pos.Top; label.Margin = new Margin(0, 0, 0, 3); label.Text = "Font Style:"; m_FontStyle = new Alt.GUI.Temporary.Gwen.Control.ComboBox(m_FontPanel); m_FontStyle.Dock = Pos.Top; m_FontStyle.ItemSelected += OnFontStyleSelect; // Set font style OnFontFamilySelect(null); }
Alt.GUI.Temporary.Gwen.Control.MenuItem AddFontStyle(FontFamily family, FontStyle style) { if (!family.IsStyleAvailable(style)) { return(null); } Alt.GUI.Temporary.Gwen.Control.MenuItem item = m_FontStyle.AddItem(style.ToString()); item.Tag = style; m_FontStyle.SelectedItem = item; m_FontStyleMenus.Add(style, item); return(item); }
void FillEdgeColorTypeListBox() { foreach (Alt.GUI.PieChart.EdgeColorType ect in //Enum.GetValues(typeof(Alt.Sketch.Ext.PieChart.EdgeColorType)) EnumHelper.GetValues <Alt.GUI.PieChart.EdgeColorType>() ) { Alt.GUI.Temporary.Gwen.Control.MenuItem item = comboBoxEdgeType.AddItem(ect.ToString(), ect.ToString()); item.Tag = ect; if (ect == Alt.GUI.PieChart.EdgeColorType.EnhancedContrast)//DarkerThanSurface) { comboBoxEdgeType.SelectedItem = item; } } }
public Example_AForge_BlobsExplorer(Base parent) : base(parent) { #if SILVERLIGHT || UNITY_WEBPLAYER Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(this); label.AutoSizeToContents = true; label.Text = //Description + "\n" + "(This example is not available in this Demo, please download SDK)"; "THIS EXAMPLE IS NOT AVAILABLE IN THIS DEMO,\nPLEASE DOWNLOAD AltGUI SDK"; label.TextColor = Color.Orange * 1.2; label.Dock = Pos.Top; label.Margin = new Margin(0, 0, 0, 5); label.Font = Example_NotAvailable_ScreenShot.Font; #endif // GUI { Alt.GUI.Temporary.Gwen.Control.StatusBar status = new Alt.GUI.Temporary.Gwen.Control.StatusBar(this); { status.ShouldDrawBackground = false; blobsCountLabel = new Alt.GUI.Temporary.Gwen.Control.Label(status); blobsCountLabel.AutoSizeToContents = true; status.AddControl(blobsCountLabel, false); } m_BottomPanel = new Alt.GUI.Temporary.Gwen.Control.Base(this); { m_BottomPanel.Dock = Pos.Bottom; m_BottomPanel.Height = 210; } m_TopPanel = new Alt.GUI.Temporary.Gwen.Control.Base(this); { m_TopPanel.Dock = Pos.Top; m_TopPanel.Height = 30; highlightTypeCombo = new Alt.GUI.Temporary.Gwen.Control.ComboBox(m_TopPanel); highlightTypeCombo.AddItem("Convex Hull").UserData = 0; highlightTypeCombo.AddItem("Left/Right Edges").UserData = 1; highlightTypeCombo.AddItem("Top/Bottom Edges").UserData = 2; highlightTypeCombo.AddItem("Quadrilateral").UserData = 3; highlightTypeCombo.Location = new PointI(0, 0); highlightTypeCombo.Width = 133; highlightTypeCombo.ItemSelected += new GwenEventHandler(highlightTypeCombo_SelectedIndexChanged); showRectangleAroundSelectionCheck = new LabeledCheckBox(m_TopPanel); showRectangleAroundSelectionCheck.Location = new PointI(143, 1); showRectangleAroundSelectionCheck.Text = "Show rectangle around selection"; showRectangleAroundSelectionCheck.Width += 10; showRectangleAroundSelectionCheck.CheckedChanged += new System.EventHandler(showRectangleAroundSelectionCheck_CheckedChanged); } blobsBrowser = new BlobsBrowser(this); blobsBrowser.Dock = Pos.Fill; blobsBrowser.Highlighting = BlobsExplorer.BlobsBrowser.HightlightType.ConvexHull; #if !SILVERLIGHT && !UNITY_WEBPLAYER blobsBrowser.BlobSelected += new BlobsExplorer.BlobSelectionHandler(blobsBrowser_BlobSelected); #endif } }
public Example_AForge_Animat(Base parent) : base(parent) { // GUI { m_TopPanel = new Base(this); { m_TopPanel.Dock = Pos.Top; m_TopPanel.Height = 30; Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(m_TopPanel); label.Location = new PointI(0, 2); label.AutoSizeToContents = true; label.TextColor = Color.LightGreen; label.Text = "Map"; label = new Alt.GUI.Temporary.Gwen.Control.Label(m_TopPanel); label.Location = new PointI(33, 2); label.Text = "World size:"; label.AutoSizeToContents = true; worldSizeBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(m_TopPanel); worldSizeBox.Location = new PointI(102, 0); worldSizeBox.ReadOnly = true; worldSizeBox.Width = 40; loadButton1 = new Alt.GUI.Temporary.Gwen.Control.Button(m_TopPanel); loadButton1.Location = new PointI(160, 0); loadButton1.Width = 80; loadButton1.Text = "Sample 1"; loadButton1.Click += new System.EventHandler(loadButton1_Click); loadButton1.NormalTextColor = Color.Red * 0.8; loadButton2 = new Alt.GUI.Temporary.Gwen.Control.Button(m_TopPanel); loadButton2.Location = new PointI(250, 0); loadButton2.Width = 80; loadButton2.Text = "Sample 2"; loadButton2.Click += new System.EventHandler(loadButton2_Click); loadButton2.NormalTextColor = Color.Brown; loadButton3 = new Alt.GUI.Temporary.Gwen.Control.Button(m_TopPanel); loadButton3.Location = new PointI(340, 0); loadButton3.Width = 80; loadButton3.Text = "Test 1"; loadButton3.Click += new System.EventHandler(loadButton3_Click); loadButton3.NormalTextColor = Color.Green; loadButton4 = new Alt.GUI.Temporary.Gwen.Control.Button(m_TopPanel); loadButton4.Location = new PointI(430, 0); loadButton4.Width = 80; loadButton4.Text = "Test 2"; loadButton4.Click += new System.EventHandler(loadButton4_Click); loadButton4.NormalTextColor = Color.Blue; loadButton5 = new Alt.GUI.Temporary.Gwen.Control.Button(m_TopPanel); loadButton5.Location = new PointI(520, 0); loadButton5.Width = 80; loadButton5.Text = "Test 3"; loadButton5.Click += new System.EventHandler(loadButton5_Click); loadButton5.NormalTextColor = Color.Violet * 0.8; } m_RightPanel = new Base(this); { m_RightPanel.Dock = Pos.Right; m_RightPanel.Width = 140; m_RightPanel.Margin = new Margin(5, 0, 0, 0); Alt.GUI.Temporary.Gwen.Control.GroupBox groupBox = new Alt.GUI.Temporary.Gwen.Control.GroupBox(m_RightPanel); { groupBox.Location = new PointI(0, 0); groupBox.Size = new SizeI(140, 363); groupBox.Text = "Settings"; Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox); label.Location = new PointI(0, 10); label.AutoSizeToContents = true; label.Text = "Learning algorithm:"; algorithmCombo = new Alt.GUI.Temporary.Gwen.Control.ComboBox(groupBox); algorithmCombo.Location = new PointI(0, 30); algorithmCombo.Width = 130; algorithmCombo.AddItem("Q-Learning").UserData = 0; algorithmCombo.AddItem("Sarsa").UserData = 1; label = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox); label.Location = new PointI(0, 65); label.AutoSizeToContents = true; label.Text = "Initial exploration rate:"; explorationRateBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox); explorationRateBox.Location = new PointI(0, 85); explorationRateBox.Width = 130; label = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox); label.Location = new PointI(0, 110); label.AutoSizeToContents = true; label.Text = "Initial learning rate:"; learningRateBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox); learningRateBox.Location = new PointI(0, 130); learningRateBox.Width = 130; label = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox); label.Location = new PointI(0, 155); label.AutoSizeToContents = true; label.Text = "Learning iterations:"; iterationsBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox); iterationsBox.Location = new PointI(0, 175); iterationsBox.Width = 130; label = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox); label.Location = new PointI(0, 210); label.AutoSizeToContents = true; label.Text = "Move reward:"; moveRewardBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox); moveRewardBox.Location = new PointI(0, 230); moveRewardBox.Width = 130; moveRewardBox.ReadOnly = true; label = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox); label.Location = new PointI(0, 255); label.AutoSizeToContents = true; label.Text = "Wall reward:"; wallRewardBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox); wallRewardBox.Location = new PointI(0, 275); wallRewardBox.Width = 130; wallRewardBox.ReadOnly = true; label = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox); label.Location = new PointI(0, 300); label.AutoSizeToContents = true; label.Text = "Goal reward:"; goalRewardBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox); goalRewardBox.Location = new PointI(0, 320); goalRewardBox.Width = 130; goalRewardBox.ReadOnly = true; } groupBox = new Alt.GUI.Temporary.Gwen.Control.GroupBox(m_RightPanel); { groupBox.Location = new PointI(0, 380); groupBox.Size = new SizeI(140, 173); groupBox.Text = "Learning"; Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox); label.Location = new PointI(0, 10); label.AutoSizeToContents = true; label.Text = "Iteration:"; iterationBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox); iterationBox.Location = new PointI(0, 30); iterationBox.Width = 130; iterationBox.ReadOnly = true; startLearningButton = new Alt.GUI.Temporary.Gwen.Control.Button(groupBox); startLearningButton.Location = new PointI(5, 70); startLearningButton.Width = 120; startLearningButton.Text = "Start"; startLearningButton.Click += new System.EventHandler(startLearningButton_Click); startLearningButton.NormalTextColor = Color.Green; stopButton = new Alt.GUI.Temporary.Gwen.Control.Button(groupBox); stopButton.Location = new PointI(5, 100); stopButton.Width = 120; stopButton.Text = "Stop"; stopButton.Click += new System.EventHandler(stopButton_Click); stopButton.NormalTextColor = Color.Red; showSolutionButton = new Alt.GUI.Temporary.Gwen.Control.Button(groupBox); showSolutionButton.Location = new PointI(5, 130); showSolutionButton.Width = 120; showSolutionButton.Text = "Show solution"; showSolutionButton.Click += new System.EventHandler(showSolutionButton_Click); showSolutionButton.NormalTextColor = Color.Blue; } } cellWorld = new CellWorld(this); cellWorld.Coloring = null; cellWorld.Map = null; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Alt.GUI.Temporary.Gwen.Control.Label label; #if SILVERLIGHT || UNITY_WEBPLAYER label = new Alt.GUI.Temporary.Gwen.Control.Label(this); label.AutoSizeToContents = true; label.Text = //Description + "\n" + "(This example is not available in this Demo, please download SDK)"; "THIS EXAMPLE IS NOT AVAILABLE IN THIS DEMO,\nPLEASE DOWNLOAD AltGUI SDK"; label.TextColor = Color.Orange * 1.2; label.Dock = Pos.Top; label.Margin = new Margin(0, 0, 0, 5); label.Font = Example_NotAvailable_ScreenShot.Font; #endif // GUI { m_TopPanel = new Base(this); { m_TopPanel.Dock = Pos.Top; m_TopPanel.Height = 30; label = new Alt.GUI.Temporary.Gwen.Control.Label(m_TopPanel); label.Location = new PointI(0, 2); label.AutoSizeToContents = true; label.TextColor = Color.LightGreen; label.Text = "Map"; label1 = new Alt.GUI.Temporary.Gwen.Control.Label(m_TopPanel); citiesCountBox = new Alt.GUI.Temporary.Gwen.Control.NumericUpDown(m_TopPanel); generateMapButton = new Alt.GUI.Temporary.Gwen.Control.Button(m_TopPanel); label1.Location = new PointI(33, 2); label1.Text = "Cities:"; label1.AutoSizeToContents = true; citiesCountBox.Location = new PointI(75, 1); citiesCountBox.Width = 50; citiesCountBox.Min = 5; citiesCountBox.Max = 50; citiesCountBox.Increment = 10; generateMapButton.Location = new PointI(135, 0); generateMapButton.Text = "Generate"; generateMapButton.AutoSizeToContents = true; generateMapButton.Click += new System.EventHandler(generateMapButton_Click); generateMapButton.NormalTextColor = Color.Blue; } m_RightPanel = new Base(this); { m_RightPanel.Dock = Pos.Right; m_RightPanel.Width = 140; m_RightPanel.Margin = new Margin(5, 0, 0, 0); groupBox2 = new Alt.GUI.Temporary.Gwen.Control.GroupBox(m_RightPanel); { groupBox2.Location = new PointI(0, 0); groupBox2.Size = new SizeI(140, 223); groupBox2.Text = "Settings"; greedyCrossoverBox = new Alt.GUI.Temporary.Gwen.Control.LabeledCheckBox(groupBox2); label5 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox2); iterationsBox = new Alt.GUI.Temporary.Gwen.Control.NumericUpDown(groupBox2); label4 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox2); selectionBox = new Alt.GUI.Temporary.Gwen.Control.ComboBox(groupBox2); label3 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox2); populationSizeBox = new Alt.GUI.Temporary.Gwen.Control.NumericUpDown(groupBox2); label2 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox2); label2.Location = new PointI(0, 10); label2.AutoSizeToContents = true; label2.Text = "Population size:"; populationSizeBox.Location = new PointI(0, 30); populationSizeBox.Width = 130; populationSizeBox.Min = 10; populationSizeBox.Max = 100; populationSizeBox.Increment = 10; label3.Location = new PointI(0, 60); label3.AutoSizeToContents = true; label3.Text = "Selection method:"; selectionBox.AddItem("Elite").UserData = 0; selectionBox.AddItem("Rank").UserData = 1; selectionBox.AddItem("Roulette").UserData = 2; selectionBox.Location = new PointI(0, 80); selectionBox.Width = 130; greedyCrossoverBox.Location = new PointI(0, 115); greedyCrossoverBox.Text = "Greedy crossover"; label4.Location = new PointI(0, 145); label4.Size = new SizeI(60, 16); label4.Text = "Iterations:"; iterationsBox.Location = new PointI(0, 165); iterationsBox.Width = 130; iterationsBox.Min = 0; iterationsBox.Max = 100000; iterationsBox.Increment = 100; label5.Location = new PointI(0, 185); label5.AutoSizeToContents = true; label5.Text = "( 0 - inifinity )"; } groupBox3 = new Alt.GUI.Temporary.Gwen.Control.GroupBox(m_RightPanel); { groupBox3.Location = new PointI(0, 230); groupBox3.Size = new SizeI(140, 122); groupBox3.Text = "Current iteration"; pathLengthBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox3); label7 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox3); currentIterationBox = new Alt.GUI.Temporary.Gwen.Control.TextBox(groupBox3); label6 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox3); label6.Location = new PointI(0, 10); label6.AutoSizeToContents = true; label6.Text = "Iteration:"; currentIterationBox.Location = new PointI(0, 30); currentIterationBox.ReadOnly = true; currentIterationBox.Width = 130; currentIterationBox.Text = ""; label7.Location = new PointI(0, 60); label7.AutoSizeToContents = true; label7.Text = "Path length:"; pathLengthBox.Location = new PointI(0, 80); pathLengthBox.ReadOnly = true; pathLengthBox.Width = 130; pathLengthBox.Text = ""; } startButton = new Alt.GUI.Temporary.Gwen.Control.Button(m_RightPanel); stopButton = new Alt.GUI.Temporary.Gwen.Control.Button(m_RightPanel); startButton.Location = new PointI(5, 370); startButton.Width = 130; startButton.Text = "Start"; startButton.Click += new System.EventHandler(startButton_Click); startButton.NormalTextColor = Color.Green; stopButton.Enabled = false; stopButton.Location = new PointI(5, 395); stopButton.Width = 130; stopButton.Text = "Stop"; stopButton.Click += new System.EventHandler(stopButton_Click); stopButton.NormalTextColor = Color.Red * 0.8; } mapControl = new Chart(this); mapControl.Dock = Pos.Fill; } // set up map control mapControl.RangeX = new Range(0, 1000); mapControl.RangeY = new Range(0, 1000); mapControl.AddDataSeries("map", Color.Red, Chart.SeriesType.Dots, 5, false); mapControl.AddDataSeries("path", Color.Blue, Chart.SeriesType.Line, 1, false); // greedyCrossoverBox.IsChecked = greedyCrossover; UpdateSettings(); GenerateMap(); }