private void LinkClicked(object sender, System.EventArgs e) { DXLinkLabel lbl = (DXLinkLabel)sender; Command cmd = lbl.Tag as Command; cmd.Invoke(); Close(); }
private void InitializeComponent() { this.Size = new Size(500, 500); this.Font = SystemInformation.MenuFont; this.BackColor = SystemColors.Control; this.ForeColor = SystemColors.ActiveCaption; this.Text = "City Details"; lblCity = new DXLabel(this.ControlHost, this); lblCity.Text = city.Name; lblCity.Location = new Point(50, 50); this.Controls.Add(lblCity); lblNextProjectHDR = new DXLabel(this.ControlHost, this); lblNextProjectHDR.Text = "Producing:"; lblNextProjectHDR.Location = new Point(10, 75); this.Controls.Add(lblNextProjectHDR); lblNextProject = new DXLinkLabel(this.ControlHost, this); lblNextProject.Text = city.NextImprovement.Name; lblNextProject.Location = new Point(100, 75); this.Controls.Add(lblNextProject); lblProgressHDR = new DXLabel(this.ControlHost, this); lblProgressHDR.Text = "Progress:"; lblProgressHDR.Location = new Point(10, 110); this.Controls.Add(lblProgressHDR); lblProgress = new DXLabel(this.ControlHost, this); lblProgress.Text = city.Shields.ToString() + "/" + city.NextImprovement.Cost.ToString(); lblProgress.Location = new Point(100, 110); this.Controls.Add(lblProgress); lblImprovements = new DXLabel(this.ControlHost, this); lblImprovements.Text = "Improvements:"; lblImprovements.Location = new Point(10, 145); this.Controls.Add(lblImprovements); lstImprovements = new DXListBox(this.ControlHost, this); lstImprovements.Location = new Point(100, 145); lstImprovements.Size = new Size(200, 300); this.Controls.Add(lstImprovements); btnDone = new DXButton(this.ControlHost, this); btnDone.Text = "Done"; btnDone.Location = new Point(400, 450); btnDone.Size = new Size(75, 25); btnDone.Click += new EventHandler(this.DonePressed); this.Controls.Add(btnDone); }
private void InitializeComponent() { Rectangle bounds = this.ControlHost.ScreenBounds; int buttonLocationX = bounds.Width / 2; buttonLocationX -= 100; this.Size = bounds.Size; this.Location = bounds.Location; this.BackColor = Color.DarkGoldenrod; this.BackColor2 = Color.LightGoldenrodYellow; this.Text = DirectXClientResources.GameTitle; //this.transitionSound = new SoundEffect(@"Sound\select.wav", this.ControlHost.Device); this.loadGameLabel = new DXLinkLabel(this.ControlHost, this); this.newGameLabel = new DXLinkLabel(this.ControlHost, this); this.quickStartLabel = new DXLinkLabel(this.ControlHost, this); this.tutorialLabel = new DXLinkLabel(this.ControlHost, this); this.optionsLabel = new DXLinkLabel(this.ControlHost, this); this.exitLabel = new DXLinkLabel(this.ControlHost, this); //New Game Label this.newGameLabel.Icon = Icons.NewIcon; this.newGameLabel.Text = DirectXClientResources.MainMenuNewGame; this.newGameLabel.Font = LabelFont; this.newGameLabel.ForeColor = Color.White; this.newGameLabel.HoverColor = Color.Yellow; this.newGameLabel.Location = new Point(buttonLocationX, 100); this.newGameLabel.TextAlignment = TextAlign.Left; this.newGameLabel.Click += new EventHandler(LinkClicked); this.newGameLabel.AutoSize = true; this.Controls.Add(this.newGameLabel); this.quickStartLabel.Icon = Icons.QuickStartIcon; this.quickStartLabel.Location = new Point(buttonLocationX, 150); this.quickStartLabel.Font = LabelFont; this.quickStartLabel.ForeColor = Color.White; this.quickStartLabel.HoverColor = Color.Yellow; this.quickStartLabel.Text = DirectXClientResources.MainMenuQuickStart; this.quickStartLabel.TextAlignment = TextAlign.Left; this.quickStartLabel.AutoSize = true; this.Controls.Add(this.quickStartLabel); this.tutorialLabel.Icon = Icons.HelpIcon; this.tutorialLabel.Text = DirectXClientResources.MainMenuTutorial; this.tutorialLabel.Font = LabelFont; this.tutorialLabel.TextAlignment = TextAlign.Left; this.tutorialLabel.ForeColor = Color.White; this.tutorialLabel.HoverColor = Color.Yellow; this.tutorialLabel.Location = new Point(buttonLocationX, 200); this.tutorialLabel.AutoSize = true; this.Controls.Add(this.tutorialLabel); //Load Game Label this.loadGameLabel.Location = new Point(buttonLocationX, 250); this.loadGameLabel.Icon = Icons.LoadIcon; this.loadGameLabel.Text = DirectXClientResources.MainMenuLoadGame; this.loadGameLabel.Font = LabelFont; this.loadGameLabel.HoverColor = Color.Yellow; this.loadGameLabel.ForeColor = Color.White; this.loadGameLabel.Click += new EventHandler(LinkClicked); this.loadGameLabel.TextAlignment = TextAlign.Left; this.loadGameLabel.AutoSize = true; this.Controls.Add(this.loadGameLabel); //Options Label this.optionsLabel.Location = new Point(buttonLocationX, 300); this.optionsLabel.Icon = Icons.CreditsIcon; this.optionsLabel.Text = DirectXClientResources.MainMenuOptions; this.optionsLabel.Font = LabelFont; this.optionsLabel.ForeColor = Color.White; this.optionsLabel.HoverColor = Color.Yellow; this.optionsLabel.TextAlignment = TextAlign.Left; this.optionsLabel.AutoSize = true; this.optionsLabel.Click += new EventHandler(LinkClicked); this.Controls.Add(this.optionsLabel); //quit label this.exitLabel.Location = new Point(buttonLocationX, 350); this.exitLabel.Icon = Icons.ExitGameIcon; this.exitLabel.Text = DirectXClientResources.MainMenuExitGame; this.exitLabel.Font = LabelFont; this.exitLabel.ForeColor = Color.White; this.exitLabel.HoverColor = Color.Yellow; this.exitLabel.TextAlignment = TextAlign.Left; this.exitLabel.AutoSize = true; this.exitLabel.Click += new EventHandler(LinkClicked); this.Controls.Add(this.exitLabel); }