Advertisement
Guest User

Untitled

a guest
Aug 20th, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using System.Linq;
  6.  
  7. namespace Planets
  8. {
  9.     public partial class MainForm : Form
  10.     {
  11.         public MainForm()
  12.         {
  13.             InitializeComponent();
  14.            
  15.             string[] Output = _planets.PlanetsList
  16.                 .Select(s => s.Planet)
  17.                 .Distinct()
  18.                 .ToArray();
  19.            
  20.             for (int i = 0; i < Output.Length; i++)
  21.             {
  22.                 var rbtn = new RadioButton();
  23.                 rbtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
  24.                 rbtn.Location = new System.Drawing.Point(32, 30 + 24 * i);
  25.                 rbtn.Name = Output[i] + "_rbtn";
  26.                 rbtn.Size = new System.Drawing.Size(104, 24);
  27.                 rbtn.TabIndex = i;
  28.                 rbtn.TabStop = true;
  29.                 rbtn.Text = Output[i];
  30.                 rbtn.UseVisualStyleBackColor = true;
  31.                 grpPlanets.Controls.Add(rbtn);             
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement