public MerchantUserControl(TableLayoutPanel gamePanel) { InitializeComponent(); this.gamePanel = gamePanel; this.BackColor = Color.Black; structure = new TableLayoutPanel(); structure.RowStyles.Clear(); structure.RowStyles.Add(new RowStyle(SizeType.Percent, 10.0f)); // Title structure.RowStyles.Add(new RowStyle(SizeType.Percent, 80.0f)); structure.RowStyles.Add(new RowStyle(SizeType.Percent, 5.0f)); // Help structure.RowStyles.Add(new RowStyle(SizeType.Percent, 5.0f)); // Merchant notifier lblTitle = this.DockFillLabel("lblTitle", Color.Red); lblTitle.Margin = new Padding(PaddingValue); lblTitle.TextAlign = ContentAlignment.MiddleCenter; descriptionList = new DescriptionList<Item>[2]; for (int i = 0; i < descriptionList.Length; i++) { descriptionList[i] = new DescriptionList<Item>(); descriptionList[i].KeyUp += OnKeyUp; descriptionList[i].Dock = DockStyle.Fill; var locI = i; descriptionList[i].Stringify = (item) => String.Format("[{0}] {1}", descriptionList[locI].Items.IndexOf(item), item.Name); descriptionList[i].Title = i == 0 ? "Your backpack" : "Merchant's warehouse"; descriptionList[i].HelpString = "W: Previous - S: Next - A: Previous Page - D: Next Page"; } var descriptionListPanel = new TableLayoutPanel(); descriptionListPanel.ColumnStyles.Clear(); descriptionListPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50.0f)); descriptionListPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50.0f)); descriptionListPanel.Margin = new Padding(PaddingValue); descriptionListPanel.Dock = DockStyle.Fill; lblHelp = this.DockFillLabel("lblHelp", Color.Yellow, new Font(FontFamily.GenericMonospace, charHelpSize)); lblHelp.Margin = new Padding(PaddingValue); lblHelp.TextAlign = ContentAlignment.MiddleCenter; singleLogMerchant = new SingleMessageLogUserControl(); singleLogMerchant.Dock = DockStyle.Fill; descriptionListPanel.Controls.Add(descriptionList[0], 0, 0); descriptionListPanel.Controls.Add(descriptionList[1], 1, 0); transparentPanel = new TransparentPanel(); transparentPanel.BackColor = Color.Transparent; //transparentPanel.Transparency = 128; transparentPanel.Paint += TransparentPanel_Paint; ; singleLogMerchant.KeyUp += OnKeyUp; structure.Controls.Add(lblTitle, 0, 0); structure.Controls.Add(descriptionListPanel, 0, 1); structure.Controls.Add(lblHelp, 0, 2); structure.Controls.Add(singleLogMerchant, 0, 3); this.Controls.Add(structure); this.Controls.Add(transparentPanel); HelpString = helpStrings[SelectedListIndex]; this.SelectedIndexChanged += (sender, e) => { HelpString = helpStrings[((IndexChangedEventArgs)e).Index]; }; initialWidth = Width; initialHeight = Height; initialTitleFontSize = lblTitle.Font.Size; initialHelpFontSize = lblHelp.Font.Size; structure.Parent.Resize += (sender, e) => Controll_FillParent(sender, e, structure); transparentPanel.Parent.Resize += (sender, e) => Controll_FillParent(sender, e, transparentPanel); transparentPanel.BringToFront(); }
public MerchantUserControl(TableLayoutPanel gamePanel) { InitializeComponent(); this.gamePanel = gamePanel; this.BackColor = Color.Black; structure = new TableLayoutPanel(); structure.RowStyles.Clear(); structure.RowStyles.Add(new RowStyle(SizeType.Percent, 10.0f)); // Title structure.RowStyles.Add(new RowStyle(SizeType.Percent, 80.0f)); structure.RowStyles.Add(new RowStyle(SizeType.Percent, 5.0f)); // Help structure.RowStyles.Add(new RowStyle(SizeType.Percent, 5.0f)); // Merchant notifier lblTitle = this.DockFillLabel("lblTitle", Color.Red); lblTitle.Margin = new Padding(PaddingValue); lblTitle.TextAlign = ContentAlignment.MiddleCenter; descriptionList = new DescriptionList <Item> [2]; for (int i = 0; i < descriptionList.Length; i++) { descriptionList[i] = new DescriptionList <Item>(); descriptionList[i].KeyUp += OnKeyUp; descriptionList[i].Dock = DockStyle.Fill; var locI = i; descriptionList[i].Stringify = (item) => String.Format("[{0}] {1}", descriptionList[locI].Items.IndexOf(item), item.Name); descriptionList[i].Title = i == 0 ? "Your backpack" : "Merchant's warehouse"; descriptionList[i].HelpString = "W: Previous - S: Next - A: Previous Page - D: Next Page"; } var descriptionListPanel = new TableLayoutPanel(); descriptionListPanel.ColumnStyles.Clear(); descriptionListPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50.0f)); descriptionListPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50.0f)); descriptionListPanel.Margin = new Padding(PaddingValue); descriptionListPanel.Dock = DockStyle.Fill; lblHelp = this.DockFillLabel("lblHelp", Color.Yellow, new Font(FontFamily.GenericMonospace, charHelpSize)); lblHelp.Margin = new Padding(PaddingValue); lblHelp.TextAlign = ContentAlignment.MiddleCenter; singleLogMerchant = new SingleMessageLogUserControl(); singleLogMerchant.Dock = DockStyle.Fill; descriptionListPanel.Controls.Add(descriptionList[0], 0, 0); descriptionListPanel.Controls.Add(descriptionList[1], 1, 0); transparentPanel = new TransparentPanel(); transparentPanel.BackColor = Color.Transparent; //transparentPanel.Transparency = 128; transparentPanel.Paint += TransparentPanel_Paint;; singleLogMerchant.KeyUp += OnKeyUp; structure.Controls.Add(lblTitle, 0, 0); structure.Controls.Add(descriptionListPanel, 0, 1); structure.Controls.Add(lblHelp, 0, 2); structure.Controls.Add(singleLogMerchant, 0, 3); this.Controls.Add(structure); this.Controls.Add(transparentPanel); HelpString = helpStrings[SelectedListIndex]; this.SelectedIndexChanged += (sender, e) => { HelpString = helpStrings[((IndexChangedEventArgs)e).Index]; }; initialWidth = Width; initialHeight = Height; initialTitleFontSize = lblTitle.Font.Size; initialHelpFontSize = lblHelp.Font.Size; structure.Parent.Resize += (sender, e) => Controll_FillParent(sender, e, structure); transparentPanel.Parent.Resize += (sender, e) => Controll_FillParent(sender, e, transparentPanel); transparentPanel.BringToFront(); }