public SubsystemIcon() { InitializeComponent(); constraintLabels = new List <Label>(); // Set colors _mainColor = MagicColors.RandomColor(colorThreshold); _lightColor = Color.FromArgb(_mainColor.R + colorThreshold, _mainColor.G + colorThreshold, _mainColor.B + colorThreshold); _darkColor = Color.FromArgb(_mainColor.R - colorThreshold, _mainColor.G - colorThreshold, _mainColor.B - colorThreshold); BackColor = _mainColor; Title.ForeColor = _darkColor; addConstraintButton.ForeColor = _darkColor; // Set cursors _overCursorSetting = Cursors.Hand; _moveCursorSetting = Cursors.SizeAll; initHeight = Height; // Set control transparencies Title.MouseEnter += new EventHandler(SubsystemIcon_MouseEnter); Title.MouseLeave += new EventHandler(SubsystemIcon_MouseLeave); Title.MouseDown += new MouseEventHandler(Title_MouseDown); Title.MouseMove += new MouseEventHandler(SubsystemIcon_MouseMove); Title.MouseUp += new MouseEventHandler(SubsystemIcon_MouseUp); Title.MouseDoubleClick += new MouseEventHandler(SubsystemIcon_MouseDoubleClick); addConstraintButton.MouseClick += new MouseEventHandler(addConstraintButton_MouseClick); }
public AssetForm(AssetElement ae, Form parentWindow, TreeNode node) { // Creates a new asset form for a given asset element Node = node; Asset = ae; MdiParent = parentWindow; Initialize(); // Create subsystem icons for asset subsystems int currX = 32; int currY = 32; foreach (SubsystemElement sub in ae.Subsystems) { // Create new icon SubsystemIcon newIcon = new SubsystemIcon(); newIcon.MouseDown += new MouseEventHandler(drawingCanvas1.SubsystemClicked); newIcon.MouseMove += new MouseEventHandler(drawingCanvas1.newIcon_MouseMove); newIcon.subsystem = sub; newIcon.Location = new Point(currX, currY); newIcon.Parent = drawingCanvas1; newIcon.BringToFront(); int seed = (int)(DateTime.UtcNow.TimeOfDay.Ticks); Random random = new Random(seed); Thread.Sleep((int)(random.NextDouble() * 100)); newIcon.Shade = MagicColors.RandomColor(40); drawingCanvas1.SubsystemIcons.Add(newIcon); // Update location of icons currX += 64; currY = currY == 32 ? 128 : 32; } }
public GroundTrack(Form parent) { InitializeComponent(); speed = 0; MdiParent = parent; histories = new List <stateHistory>(); StartTime = 0.0f; EndTime = 100.0f; CurrTime = 50.0f; satellitePointRadius = 4; lastRender = DateTime.Now; // Reduce flickering - double buffer DoubleBuffered = true; // Create sample histories stateHistory h1 = new stateHistory(); stateHistory h2 = new stateHistory(); h1.name = "Test 1"; h2.name = "Test 2"; h2.color = MagicColors.RandomColor(h1.color, 0.25f); for (float t = 0.0f; t < 100.0; t += 1.0f) { h1.addPoint(t, 15.0f * (float)(Math.Sin(t / 50.0f)) + 10.0f, t + 200.0f, 500.0f); h2.addPoint(t, 7.0f * (float)(Math.Cos(t / 20.0f)) - 25.0f, t - 120.0f, 200.0f); } histories.Add(h1); histories.Add(h2); }
public stateHistory() { color = MagicColors.RandomColor(); history = new List <statePoint>(); name = "unknown satellite"; }