protected override void OnLoad(EventArgs e) { base.OnLoad(e); Alt.GUI.Temporary.Gwen.Control.PictureBox box = new Alt.GUI.Temporary.Gwen.Control.PictureBox(this); box.Dock = Alt.GUI.Temporary.Gwen.Pos.Fill; box.SizeMode = PictureBoxSizeMode.CenterImage; box.Image = Bitmap.FromFile("AltData/corazon.gif"); }
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.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(this); label.AutoSizeToContents = true; label.Text = //Description + "\n" +//"\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; m_Example_NotAvailable_PictureBox = new Alt.GUI.Temporary.Gwen.Control.PictureBox(this); m_Example_NotAvailable_PictureBox.Margin = Margin.Two; m_Example_NotAvailable_PictureBox.Dock = Pos.Fill; Bitmap screenshot = Screenshot; if (screenshot == null) { return; } m_Example_NotAvailable_PictureBox.Image = screenshot; if (this.ClientRectangle.Contains(new PointI(screenshot.PixelSize))) { m_Example_NotAvailable_PictureBox.SizeMode = PictureBoxSizeMode.CenterImage; } else { m_Example_NotAvailable_PictureBox.SizeMode = PictureBoxSizeMode.Normal; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); #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 Alt.GUI.Temporary.Gwen.Margin(0, 0, 0, 5); label.Font = Example_NotAvailable_ScreenShot.Font; #endif // GUI { m_Menu = new Alt.GUI.Temporary.Gwen.Control.MenuStrip(this); { Alt.GUI.Temporary.Gwen.Control.MenuItem root = filtersItem = m_Menu.AddItem("Filters"); { (noneFiltersItem = root.Menu.AddItem("None")).SetAction(noneFiltersItem_Click); root.Menu.AddDivider(); #if !SILVERLIGHT //TEMP (grayscaleFiltersItem = root.Menu.AddItem("Grayscale")).SetAction(grayscaleFiltersItem_Click); (sepiaFiltersItem = root.Menu.AddItem("Sepia")).SetAction(sepiaFiltersItem_Click); (invertFiltersItem = root.Menu.AddItem("Invert")).SetAction(invertFiltersItem_Click); (rotateChannelFiltersItem = root.Menu.AddItem("Rotate channel")).SetAction(rotateChannelFiltersItem_Click); (colorFiltersItem = root.Menu.AddItem("Color filtering")).SetAction(colorFiltersItem_Click); (rgbLinearFiltersItem = root.Menu.AddItem("Levels linear correction")).SetAction(rgbLinearFiltersItem_Click); root.Menu.AddDivider(); (hueModifierFiltersItem = root.Menu.AddItem("Hue modifier")).SetAction(hueModifierFiltersItem_Click); (saturationAdjustingFiltersItem = root.Menu.AddItem("Saturation adjusting")).SetAction(saturationAdjustingFiltersItem_Click); (brightnessAdjustingFiltersItem = root.Menu.AddItem("Brightness adjusting")).SetAction(brightnessAdjustingFiltersItem_Click); (contrastAdjustingFiltersItem = root.Menu.AddItem("Contrast adjusting")).SetAction(contrastAdjustingFiltersItem_Click); (hslFiltersItem = root.Menu.AddItem("HSL filtering")).SetAction(hslFiltersItem_Click); root.Menu.AddDivider(); //TEMP (yCbCrLinearFiltersItem = root.Menu.AddItem("YCbCr linear correction")).SetAction(yCbCrLinearFiltersItem_Click); (yCbCrFiltersItem = root.Menu.AddItem("YCbCr filtering")).SetAction(yCbCrFiltersItem_Click); root.Menu.AddDivider(); //TEMP (thresholdFiltersItem = root.Menu.AddItem("Threshold binarization")).SetAction(thresholdFiltersItem_Click); //TEMP (floydFiltersItem = root.Menu.AddItem("Floyd-Steinberg dithering")).SetAction(floydFiltersItem_Click); //TEMP (orderedDitheringFiltersItem = root.Menu.AddItem("Ordered dithering")).SetAction(orderedDitheringFiltersItem_Click); //TEMP root.Menu.AddDivider(); (convolutionFiltersItem = root.Menu.AddItem("Convolution")).SetAction(convolutionFiltersItem_Click); (sharpenFiltersItem = root.Menu.AddItem("Sharpen")).SetAction(sharpenFiltersItem_Click); (gaussianFiltersItem = root.Menu.AddItem("Gaussian blur")).SetAction(gaussianFiltersItem_Click); root.Menu.AddDivider(); //TEMP (differenceEdgesFiltersItem = root.Menu.AddItem("Difference edge detector")).SetAction(differenceEdgesFiltersItem_Click); //TEMP (homogenityEdgesFiltersItem = root.Menu.AddItem("Homogenity edge detector")).SetAction(homogenityEdgesFiltersItem_Click); //TEMP (sobelEdgesFiltersItem = root.Menu.AddItem("Sobel edge detector")).SetAction(sobelEdgesFiltersItem_Click); //TEMP root.Menu.AddDivider(); (jitterFiltersItem = root.Menu.AddItem("Jitter")).SetAction(jitterFiltersItem_Click); (oilFiltersItem = root.Menu.AddItem("Oil Painting")).SetAction(oilFiltersItem_Click); (textureFiltersItem = root.Menu.AddItem("Texture")).SetAction(textureFiltersItem_Click); #else root.Menu.AddItem("Image filters are not available in Silverlight yet"); #endif } root = sizeItem = m_Menu.AddItem("Size mode"); { sizeItem.Click += new EventHandler(sizeItem_Popup); (normalSizeItem = root.Menu.AddItem("Normal")).SetAction(normalSizeItem_Click); (stretchedSizeItem = root.Menu.AddItem("Stretched")).SetAction(stretchedSizeItem_Click); (centeredSizeItem = root.Menu.AddItem("Centered")).SetAction(centeredSizeItem_Click); } } pictureBox = new Alt.GUI.Temporary.Gwen.Control.PictureBox(this); pictureBox.DrawBorder = true; pictureBox.BorderColor = Color.DodgerBlue; pictureBox.Dock = Pos.Fill; } // set default size mode of picture box pictureBox.SizeMode = PictureBoxSizeMode.StretchImage; LoadImage(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // GUI { m_TopLabel = new Alt.GUI.Temporary.Gwen.Control.Label(this); m_TopLabel.AutoSizeToContents = true; m_TopLabel.Text = "Left click the image to draw passages (white), right click the image to draw walls (black)."; m_TopLabel.Dock = Pos.Top; m_TopLabel.TextColor = Color.Yellow; m_TopLabel.Margin = new Margin(0, 5, 0, 5); m_ControlsPanel = new Alt.GUI.Temporary.Gwen.Control.Base(this); m_ControlsPanel.Width = 139; m_ControlsPanel.Dock = Pos.Right; pbTerrain = new Alt.GUI.Temporary.Gwen.Control.PictureBox(this); pbTerrain.Dock = Pos.Fill; pbTerrain.ErrorImage = null; pbTerrain.Image = Bitmap.FromFile("AltData/AForge/FuzzyAGV_BG.gif"); pbTerrain.InitialImage = null; pbTerrain.SizeMode = PictureBoxSizeMode.Normal; // AutoSize; pbTerrain.MouseMove += new GUI.MouseEventHandler(pbTerrain_MouseMove); pbTerrain.MouseDown += new GUI.MouseEventHandler(pbTerrain_MouseDown); int groupBox_dy = -10; groupBox1 = new Alt.GUI.Temporary.Gwen.Control.GroupBox(m_ControlsPanel); { groupBox1.Location = new PointI(0, 0); groupBox1.Name = "groupBox1"; groupBox1.Size = new SizeI(139, 83); groupBox1.Text = "Sensor readings:"; lbl = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox1); label2 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox1); label1 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox1); lbl.Location = new PointI(0, 54 + groupBox_dy); lbl.AutoSizeToContents = true; lbl.Text = "Right (pixels):"; label2.Location = new PointI(0, 35 + groupBox_dy); label2.AutoSizeToContents = true; label2.Text = "Left (pixels):"; label1.Location = new PointI(0, 16 + groupBox_dy); label1.AutoSizeToContents = true; label1.Text = "Frontal (pixels):"; txtRight = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox1); txtLeft = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox1); txtFront = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox1); txtRight.Location = new PointI(100, 54 + groupBox_dy); txtRight.AutoSizeToContents = true; txtRight.Text = "0"; txtRight.TextAlign = ContentAlignment.MiddleLeft; txtLeft.Location = new PointI(100, 35 + groupBox_dy); txtLeft.AutoSizeToContents = true; txtLeft.Text = "0"; txtLeft.TextAlign = ContentAlignment.MiddleLeft; txtFront.Location = new PointI(100, 16 + groupBox_dy); txtFront.AutoSizeToContents = true; txtFront.Text = "0"; txtFront.TextAlign = ContentAlignment.MiddleLeft; } groupBox2 = new Alt.GUI.Temporary.Gwen.Control.GroupBox(m_ControlsPanel); { groupBox2.Location = new PointI(0, 94); groupBox2.Size = new SizeI(139, 45); groupBox2.Text = "Output:"; label3 = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox2); txtAngle = new Alt.GUI.Temporary.Gwen.Control.Label(groupBox2); label3.Location = new PointI(0, 16 + groupBox_dy); label3.AutoSizeToContents = true; label3.Text = "Angle (degrees):"; txtAngle.Location = new PointI(98, 16 + groupBox_dy); txtAngle.AutoSizeToContents = true; txtAngle.Text = "0,00"; txtAngle.TextAlign = ContentAlignment.MiddleLeft; } gbComandos = new Alt.GUI.Temporary.Gwen.Control.GroupBox(m_ControlsPanel); { gbComandos.Location = new PointI(0, 150); gbComandos.Size = new SizeI(139, 205); gbComandos.Text = "Tools:"; btnStep = new Alt.GUI.Temporary.Gwen.Control.Button(gbComandos); btnRun = new Alt.GUI.Temporary.Gwen.Control.Button(gbComandos); txtInterval = new Alt.GUI.Temporary.Gwen.Control.NumericUpDown(gbComandos); cbLasers = new Alt.GUI.Temporary.Gwen.Control.LabeledCheckBox(gbComandos); cbTrajeto = new Alt.GUI.Temporary.Gwen.Control.LabeledCheckBox(gbComandos); btnReset = new Alt.GUI.Temporary.Gwen.Control.Button(gbComandos); label4 = new Alt.GUI.Temporary.Gwen.Control.Label(gbComandos); btnStep.Location = new PointI(0, 109 + groupBox_dy); btnStep.Size = new SizeI(128, 23); btnStep.Text = "One Step"; btnStep.Click += new System.EventHandler(button3_Click); btnStep.NormalTextColor = Color.Blue; btnRun.Location = new PointI(0, 138 + groupBox_dy); btnRun.Size = new SizeI(128, 23); btnRun.Text = "Run"; btnRun.Click += new System.EventHandler(btnRun_Click); btnRun.NormalTextColor = Color.Green; txtInterval.Location = new PointI(0, 83 + groupBox_dy); txtInterval.Size = new SizeI(127, 20); txtInterval.Min = 1; txtInterval.Max = 100; txtInterval.Value = 20; cbLasers.IsChecked = true; cbLasers.Location = new PointI(0, 40 + groupBox_dy); cbLasers.Text = "Show Beams"; cbTrajeto.Location = new PointI(0, 16 + groupBox_dy); cbTrajeto.Text = "Track Path"; btnReset.Location = new PointI(0, 167 + groupBox_dy); btnReset.Size = new SizeI(128, 23); btnReset.Text = "Restart"; btnReset.Click += new System.EventHandler(btnReset_Click); btnReset.NormalTextColor = Color.Red * 0.8; label4.Location = new PointI(0, 65 + groupBox_dy); label4.AutoSizeToContents = true; label4.Text = "Move Interval (ms):"; } Bitmap robot = new Bitmap(10, 10); using (Graphics graphics = Graphics.FromImage(robot)) { graphics.FillCircle(Brushes.Blue, robot.PixelRectangle); } pbRobot = new Alt.GUI.Temporary.Gwen.Control.PictureBox(pbTerrain); pbRobot.Image = robot; pbRobot.Size = robot.PixelSize; } Angle = 0; OriginalMap = new Bitmap(pbTerrain.Image); InitialMap = new Bitmap(pbTerrain.Image); InitFuzzyEngine(); FirstInference = true; pbRobot.Top = InitialMap.PixelHeight - 55; pbRobot.Left = 60; InitialPos = pbRobot.Location; RunLabel = btnRun.Text; }
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_Top1 = new Base(this); { m_Top1.Dock = Pos.Top; m_Top1.Height = 30; loadDemoImage1ToolStripMenuItem = new Alt.GUI.Temporary.Gwen.Control.Button(m_Top1); loadDemoImage2ToolStripMenuItem = new Alt.GUI.Temporary.Gwen.Control.Button(m_Top1); loadDemoImage3ToolStripMenuItem = new Alt.GUI.Temporary.Gwen.Control.Button(m_Top1); loadDemoImage4ToolStripMenuItem = new Alt.GUI.Temporary.Gwen.Control.Button(m_Top1); loadDemoImage1ToolStripMenuItem.Text = "Load demo image 1"; loadDemoImage1ToolStripMenuItem.Click += new System.EventHandler(loadDemoImage1ToolStripMenuItem_Click); loadDemoImage1ToolStripMenuItem.Dock = Pos.Left; loadDemoImage1ToolStripMenuItem.AutoSizeToContents = true; loadDemoImage1ToolStripMenuItem.NormalTextColor = Color.Red * 0.8; loadDemoImage2ToolStripMenuItem.Text = "Load demo image 2"; loadDemoImage2ToolStripMenuItem.Click += new System.EventHandler(loadDemoImage2ToolStripMenuItem_Click); loadDemoImage2ToolStripMenuItem.Dock = Pos.Left; loadDemoImage2ToolStripMenuItem.Margin = new Margin(10, 0, 0, 0); loadDemoImage2ToolStripMenuItem.AutoSizeToContents = true; loadDemoImage2ToolStripMenuItem.NormalTextColor = Color.Brown; loadDemoImage3ToolStripMenuItem.Text = "Load demo image 3"; loadDemoImage3ToolStripMenuItem.Click += new System.EventHandler(loadDemoImage3ToolStripMenuItem_Click); loadDemoImage3ToolStripMenuItem.Dock = Pos.Left; loadDemoImage3ToolStripMenuItem.Margin = new Margin(10, 0, 0, 0); loadDemoImage3ToolStripMenuItem.AutoSizeToContents = true; loadDemoImage3ToolStripMenuItem.NormalTextColor = Color.Green; loadDemoImage4ToolStripMenuItem.Text = "Load demo image 4"; loadDemoImage4ToolStripMenuItem.Click += new System.EventHandler(loadDemoImage4ToolStripMenuItem_Click); loadDemoImage4ToolStripMenuItem.Dock = Pos.Left; loadDemoImage4ToolStripMenuItem.Margin = new Margin(10, 0, 0, 0); loadDemoImage4ToolStripMenuItem.AutoSizeToContents = true; loadDemoImage4ToolStripMenuItem.NormalTextColor = Color.Blue; } m_Top2 = new Alt.GUI.Temporary.Gwen.Control.Base(this); { m_Top2.Dock = Pos.Top; m_Top2.Height = 25; label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.AutoSizeToContents = true; label.Text = "Legend:"; label.Dock = Pos.Left; label.TextColor = Color.Orange; label.Margin = new Margin(0, 4, 0, 0); SizeI boxSize = new SizeI(m_Top2.Height, m_Top2.Height); Margin boxMargin = new Margin(10, 0, 0, 0); Margin labelMargin = new Margin(5, 4, 0, 0); // 1 label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.ClientBackColor = Color.Yellow; label.DrawBorder = true; label.BorderColor = Color.DodgerBlue; label.Dock = Pos.Left; label.Margin = boxMargin; label.Size = boxSize; label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.Dock = Pos.Left; label.Margin = labelMargin; label.AutoSizeToContents = true; label.Text = "Circles"; // 2 label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.ClientBackColor = Color.Red; label.DrawBorder = true; label.BorderColor = Color.DodgerBlue; label.Dock = Pos.Left; label.Margin = boxMargin; label.Size = boxSize; label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.Dock = Pos.Left; label.Margin = labelMargin; label.AutoSizeToContents = true; label.Text = "Quadrilaterals"; // 3 label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.ClientBackColor = Color.Brown; label.DrawBorder = true; label.BorderColor = Color.DodgerBlue; label.Dock = Pos.Left; label.Margin = boxMargin; label.Size = boxSize; label.SetToolTipText("Trapezoid, Parallelogram, Rectangle, Rhombus or Square"); label.MouseInputEnabled = true; label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.Dock = Pos.Left; label.Margin = labelMargin; label.AutoSizeToContents = true; label.Text = "Known quadrilaterals"; label.SetToolTipText("Trapezoid, Parallelogram, Rectangle, Rhombus or Square"); label.MouseInputEnabled = true; // 4 label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.ClientBackColor = Color.Blue; label.DrawBorder = true; label.BorderColor = Color.DodgerBlue; label.Dock = Pos.Left; label.Margin = boxMargin; label.Size = boxSize; label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.Dock = Pos.Left; label.Margin = labelMargin; label.AutoSizeToContents = true; label.Text = "Triangles"; // 5 label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.ClientBackColor = Color.Green; label.DrawBorder = true; label.BorderColor = Color.DodgerBlue; label.Dock = Pos.Left; label.Margin = boxMargin; label.Size = boxSize; label.SetToolTipText("Equilateral, Isosceles, Rectangled or Rectangled Isosceles Triangle"); label.MouseInputEnabled = true; label = new Alt.GUI.Temporary.Gwen.Control.Label(m_Top2); label.Dock = Pos.Left; label.Margin = labelMargin; label.AutoSizeToContents = true; label.Text = "Known triangles"; label.SetToolTipText("Equilateral, Isosceles, Rectangled or Rectangled Isosceles Triangle"); label.MouseInputEnabled = true; } pictureBox = new Alt.GUI.Temporary.Gwen.Control.PictureBox(this); pictureBox.Dock = Pos.Fill; pictureBox.SizeMode = PictureBoxSizeMode.CenterImage; } LoadDemo("coins.jpg"); }