Guest User

Untitled

a guest
Aug 21st, 2016
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 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.             var RbtnArr_Planets = new RadioButton[Output.Length];
  21.            
  22.             for (int i = 0; i < Output.Length; i++) {
  23.                 RbtnArr_Planets[i] = new RadioButton();
  24.                 RbtnArr_Planets[i].Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
  25.                 RbtnArr_Planets[i].Location = new System.Drawing.Point(32, 30 + 24 * i);
  26.                 RbtnArr_Planets[i].Name = "rbtn_" + Output[i];
  27.                 RbtnArr_Planets[i].Size = new System.Drawing.Size(104, 24);
  28.                 RbtnArr_Planets[i].TabIndex = i;
  29.                 RbtnArr_Planets[i].TabStop = true;
  30.                 RbtnArr_Planets[i].Text = Output[i];
  31.                 RbtnArr_Planets[i].UseVisualStyleBackColor = true;
  32.                 grpPlanets.Controls.Add(RbtnArr_Planets[i]);               
  33.             }
  34.         }
  35.     }
  36. }
Add Comment
Please, Sign In to add comment