/// <summary> /// Initializes a new instance of the VaultPanel class. /// </summary> /// <param name="dragInfo">Instance of the ItemDragInfo</param> /// <param name="numberOfBags">Number of bags in this panel</param> /// <param name="panelSize">Main panel size</param> /// <param name="numberOfAutosortButtons">The number of AutoSort buttons associated with this panel.,</param> /// <param name="autoMoveLocation">The automovelocation for this panel.</param> public VaultPanel(ItemDragInfo dragInfo, int numberOfBags, Size panelSize, int numberOfAutosortButtons, AutoMoveLocation autoMoveLocation, IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; this.FontService = this.ServiceProvider.GetService <IFontService>(); this.UIService = this.ServiceProvider.GetService <IUIService>(); this.DragInfo = dragInfo; this.AutoMoveLocation = autoMoveLocation; this.Text = Resources.PlayerPanelNoVault; this.NoPlayerString = Resources.PlayerPanelNoVault; this.BackColor = Color.Transparent; this.DrawAsGroupBox = false; // Setup the offset to make room for the autosort button int autosortOffset = 0; if (numberOfAutosortButtons > 0) { autosortOffset = Convert.ToInt32(27.0F * UIService.Scale); } this.Size = new Size( (panelSize.Width * UIService.ItemUnitSize) + Convert.ToInt32(10.0F * UIService.Scale) + autosortOffset + BorderPad, (panelSize.Height * UIService.ItemUnitSize) + Convert.ToInt32(56.0F * UIService.Scale) + BorderPad); this.TabStop = false; this.Font = new Font(this.Font.FontFamily, this.Font.SizeInPoints * UIService.Scale, this.Font.Style); this.BagPanelOffset = 0; // bag panel starts with bag #0 this.BagSackPanel = new SackPanel(panelSize.Width, panelSize.Height, this.DragInfo, autoMoveLocation, this.ServiceProvider); this.BagSackPanel.SetLocation(new Point(autosortOffset + BorderPad, this.Size.Height - (this.BagSackPanel.Size.Height + BorderPad))); this.BagSackPanel.OnNewItemHighlighted += new EventHandler <SackPanelEventArgs>(this.NewItemHighlightedCallback); this.BagSackPanel.OnAutoMoveItem += new EventHandler <SackPanelEventArgs>(this.AutoMoveItemCallback); this.BagSackPanel.OnActivateSearch += new EventHandler <SackPanelEventArgs>(this.ActivateSearchCallback); this.BagSackPanel.OnItemSelected += new EventHandler <SackPanelEventArgs>(this.ItemSelectedCallback); this.BagSackPanel.OnClearAllItemsSelected += new EventHandler <SackPanelEventArgs>(this.ClearAllItemsSelectedCallback); this.BagSackPanel.OnResizeForm += new EventHandler <ResizeEventArgs>(this.ResizeFormCallback); this.Controls.Add(this.BagSackPanel); this.BagSackPanel.IsPlayerBagPanel = false; this.BagSackPanel.MaxSacks = numberOfBags; // Create the buttons this.bagButtons = new Collection <BagButtonBase>(); this.CreateBagButtons(numberOfBags); // Assume it's the trash panel if we are not autosorting it. if (numberOfAutosortButtons == 0) { this.BagSackPanel.SackType = SackType.Trash; } else { this.autoSortButtons = new Collection <AutoSortButton>(); for (int i = 0; i < numberOfAutosortButtons; ++i) { this.autoSortButtons.Insert(i, this.CreateAutoSortButton(i)); this.Controls.Add(this.autoSortButtons[i]); } this.BagSackPanel.SackType = SackType.Vault; } this.contextMenu = new ContextMenuStrip(); this.contextMenu.BackColor = Color.FromArgb(46, 41, 31); this.contextMenu.DropShadowEnabled = true; this.contextMenu.Font = FontService.GetFontAlbertusMT(9.0F * UIService.Scale); this.contextMenu.ForeColor = Color.FromArgb(200, 200, 200); this.contextMenu.Opacity = 0.80; this.contextMenu.ShowImageMargin = false; this.contextMenu.ItemClicked += new ToolStripItemClickedEventHandler(this.ContextMenuItemClicked); this.contextMenu.Renderer = new CustomProfessionalRenderer(); this.PropertyChanged += new PropertyChangedEventHandler(this.PropertyChangedCallback); this.Paint += new PaintEventHandler(this.PaintCallback); // to avoid flickering use double buffer and to force control to use OnPaint this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); }