public bool CanResize(ResizeBar bar) { // Cannot resize when in prominent mode if (!_tabbedGroups.ResizeBarLock && (_tabbedGroups.ProminentLeaf == null)) { // Find position of this ResizeBar in the Controls collection int barIndex = _control.Controls.IndexOf(bar); // Convert from control to children indexing int beforeIndex = (barIndex - 1) / 2; TabGroupBase before = _children[beforeIndex]; TabGroupBase after = _children[beforeIndex + 1]; // If groups on both sides have no space then cannot resize there relative positions if (((before.Space <= 0m) && (after.Space <= 0m))) { return(false); } else { return(true); } } else { // Must exit prominent mode before resize can occur return(false); } }
protected void AllocateMandatorySizes(ref int[] positions, ref int barSpace, ref int space) { // Process each control for (int index = 0, child = 0; index < _control.Controls.Count; index++) { ResizeBar bar = _control.Controls[index] as ResizeBar; // Is this a resize bar control? if (bar != null) { // Length needed is dependant on direction positions[index] = bar.Length; // Add up how much space was allocated to ResizeBars barSpace += positions[index]; } else { Size minimal = _children[child++].MinimumSize; // Length needed is depends on direction if (_direction == Common.Direction.Vertical) { positions[index] = minimal.Height; } else { positions[index] = minimal.Width; } } // Reduce available space by that just allocated space -= positions[index]; } }
public GameInterface(GraphicsDevice device) { _screenHeight = device.Viewport.Height; _lifeBar = new ResizeBar(new Vector2(250, 650), @"Textures\lifebar", width: 300, maxLife: 400, life: 400); _waveBar = new ResizeBar(new Vector2(250, 680), @"Textures\wavebar", width: 300, maxLife: 300, life: 0); _towerIcons = new List <TowerIcon>(); TowerIcon towerIconFire = new TowerIcon(new Vector2(10, 650), @"Textures\button-fire-tower", "fire"); towerIconFire.Text = "Creer des tours de feu."; _towerIcons.Add(towerIconFire); TowerIcon towerIconEarth = new TowerIcon(new Vector2(60, 650), @"Textures\button-earth-tower", "earth"); towerIconEarth.Text = "Creer des tours de terre."; _towerIcons.Add(towerIconEarth); TowerIcon towerIconWater = new TowerIcon(new Vector2(110, 650), @"Textures\button-water-tower", "water"); towerIconWater.Text = "Creer des tours d'eau."; _towerIcons.Add(towerIconWater); TowerSelectedType = "fire"; _towerInformationBox = new TowerInformationsBox(); }
protected TabGroupBase Insert(int index, TabGroupBase group) { // Range check index if (index < 0) { throw new ArgumentOutOfRangeException("index", index, "Insert index must be at least 0"); } if (index >= _children.Count) { throw new ArgumentOutOfRangeException("index", index, "Cannot insert after end of current entries"); } // Remember reference _children.Insert(index, group); // Create a resizing bar ResizeBar bar = new ResizeBar(_direction, this); // Append resize bar between existing entries and new entry _control.Controls.Add(bar); // Append new group control _control.Controls.Add(group.GroupControl); // Inserting at start of collection? if (index == 0) { // Reposition the bar and group to start of collection _control.Controls.SetChildIndex(bar, 0); _control.Controls.SetChildIndex(group.GroupControl, 0); } else { // Find correct index taking into account number of resize bars int pos = index * 2 - 1; // Reposition the bar and Window to correct relative ordering _control.Controls.SetChildIndex(bar, pos++); _control.Controls.SetChildIndex(group.GroupControl, pos); } // Allocate space for the new child AllocateSpace(group); // Update child layout to reflect new proportional spacing values RepositionChildren(); // Mark layout as dirty if (_tabbedGroups.AutoCalculateDirty) { _tabbedGroups.Dirty = true; } return(group); }
public void EndResizeOperation(ResizeBar bar, int delta) { // Find position of this ResizeBar in the Controls collection int barIndex = _control.Controls.IndexOf(bar); // Convert from control to children indexing int beforeIndex = (barIndex - 1) / 2; // The Window relating to this bar must be the one before it in the collection TabGroupBase before = _children[beforeIndex]; // Is the Window being expanded DeltaGroupSpace(before, delta); }
protected TabGroupBase Add(TabGroupBase group) { // Remember reference _children.Add(group); // First group added to sequence? if (_children.Count == 1) { // Add new child control _control.Controls.Add(group.GroupControl); } else { // Create a resizing bar ResizeBar bar = new ResizeBar(_direction, this); // Append resize bar between existing entries and new entry _control.Controls.Add(bar); // Append new group control _control.Controls.Add(group.GroupControl); } if (!_tabbedGroups.Initializing) { // Allocate space for the new child AllocateSpace(group); // Update child layout to reflect new proportional spacing values RepositionChildren(); } // Mark layout as dirty if (_tabbedGroups.AutoCalculateDirty) { _tabbedGroups.Dirty = true; } return(group); }
public bool StartResizeOperation(ResizeBar bar, ref Rectangle screenBoundary) { // Find position of this ResizeBar in the Controls collection int barIndex = _control.Controls.IndexOf(bar); // Convert from control to children indexing int beforeIndex = (barIndex - 1) / 2; // Get groups before and after the resize bar TabGroupBase before = _children[beforeIndex]; TabGroupBase after = _children[beforeIndex + 1]; // Resizing boundary is defaulted to whole control area screenBoundary = _control.RectangleToScreen(_control.ClientRectangle); // Find screen rectangle for the groups either side of the bar Rectangle rectBefore = before.GroupControl.RectangleToScreen(before.GroupControl.ClientRectangle); Rectangle rectAfter = after.GroupControl.RectangleToScreen(after.GroupControl.ClientRectangle); // Reduce the boundary in the appropriate direction if (_direction == Common.Direction.Vertical) { screenBoundary.Y = rectBefore.Y + before.MinimumSize.Height; screenBoundary.Height -= screenBoundary.Bottom - rectAfter.Bottom; screenBoundary.Height -= after.MinimumSize.Height; } else { screenBoundary.X = rectBefore.X + before.MinimumSize.Width; screenBoundary.Width -= screenBoundary.Right - rectAfter.Right; screenBoundary.Width -= after.MinimumSize.Width; } // Allow resize operation to occur return(true); }
private void InitializeComponent() { this.showTimings = new System.Windows.Forms.CheckBox(); this.showSystemTraces = new System.Windows.Forms.CheckBox(); this.traceTextBox = new System.Windows.Forms.TextBox(); this.showTraces = new System.Windows.Forms.CheckBox(); this.GlassLabel1 = new Terrarium.Glass.GlassLabel(); this.GlassLabel2 = new Terrarium.Glass.GlassLabel(); this.GlassLabel3 = new Terrarium.Glass.GlassLabel(); this.closeButton = new Terrarium.Glass.GlassButton(); this.glassLabel4 = new Terrarium.Glass.GlassLabel(); this.glassLabel5 = new Terrarium.Glass.GlassLabel(); this.glassLabel6 = new Terrarium.Glass.GlassLabel(); this.resizeBar1 = new Terrarium.Forms.ResizeBar(); this.bottomPanel.SuspendLayout(); this.SuspendLayout(); // // titleBar // this.titleBar.Size = new System.Drawing.Size(488, 32); this.titleBar.Title = "Trace Window"; this.titleBar.CloseClicked += new System.EventHandler(this.CloseForm_Click); // // bottomPanel // this.bottomPanel.Controls.Add(this.resizeBar1); this.bottomPanel.Controls.Add(this.closeButton); this.bottomPanel.Gradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.bottomPanel.Gradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.bottomPanel.Location = new System.Drawing.Point(0, 352); this.bottomPanel.Size = new System.Drawing.Size(488, 40); // // showTimings // this.showTimings.BackColor = System.Drawing.Color.White; this.showTimings.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter; this.showTimings.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.showTimings.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.showTimings.Location = new System.Drawing.Point(136, 80); this.showTimings.Name = "showTimings"; this.showTimings.Size = new System.Drawing.Size(13, 13); this.showTimings.TabIndex = 1; this.showTimings.UseVisualStyleBackColor = false; // // showSystemTraces // this.showSystemTraces.BackColor = System.Drawing.Color.White; this.showSystemTraces.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter; this.showSystemTraces.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.showSystemTraces.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.showSystemTraces.Location = new System.Drawing.Point(16, 80); this.showSystemTraces.Name = "showSystemTraces"; this.showSystemTraces.Size = new System.Drawing.Size(13, 13); this.showSystemTraces.TabIndex = 1; this.showSystemTraces.UseVisualStyleBackColor = false; // // traceTextBox // this.traceTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.traceTextBox.BackColor = System.Drawing.Color.Black; this.traceTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.traceTextBox.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.traceTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.traceTextBox.Location = new System.Drawing.Point(11, 104); this.traceTextBox.Multiline = true; this.traceTextBox.Name = "traceTextBox"; this.traceTextBox.ReadOnly = true; this.traceTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.traceTextBox.Size = new System.Drawing.Size(469, 242); this.traceTextBox.TabIndex = 0; this.traceTextBox.WordWrap = false; // // showTraces // this.showTraces.BackColor = System.Drawing.Color.White; this.showTraces.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter; this.showTraces.Checked = true; this.showTraces.CheckState = System.Windows.Forms.CheckState.Checked; this.showTraces.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.showTraces.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.showTraces.Location = new System.Drawing.Point(256, 80); this.showTraces.Name = "showTraces"; this.showTraces.Size = new System.Drawing.Size(13, 13); this.showTraces.TabIndex = 2; this.showTraces.UseVisualStyleBackColor = false; this.showTraces.CheckedChanged += new System.EventHandler(this.showTraces_CheckedChanged); // // GlassLabel1 // this.GlassLabel1.AutoSize = true; this.GlassLabel1.BackColor = System.Drawing.Color.Transparent; this.GlassLabel1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold); this.GlassLabel1.ForeColor = System.Drawing.Color.White; this.GlassLabel1.Location = new System.Drawing.Point(32, 56); this.GlassLabel1.Name = "GlassLabel1"; this.GlassLabel1.NoWrap = false; this.GlassLabel1.Size = new System.Drawing.Size(80, 14); this.GlassLabel1.TabIndex = 2; this.GlassLabel1.Text = "System Events"; // // GlassLabel2 // this.GlassLabel2.AutoSize = true; this.GlassLabel2.BackColor = System.Drawing.Color.Transparent; this.GlassLabel2.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold); this.GlassLabel2.ForeColor = System.Drawing.Color.White; this.GlassLabel2.Location = new System.Drawing.Point(152, 56); this.GlassLabel2.Name = "GlassLabel2"; this.GlassLabel2.NoWrap = false; this.GlassLabel2.Size = new System.Drawing.Size(83, 14); this.GlassLabel2.TabIndex = 3; this.GlassLabel2.Text = "Engine Timings"; // // GlassLabel3 // this.GlassLabel3.AutoSize = true; this.GlassLabel3.BackColor = System.Drawing.Color.Transparent; this.GlassLabel3.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold); this.GlassLabel3.ForeColor = System.Drawing.Color.White; this.GlassLabel3.Location = new System.Drawing.Point(272, 56); this.GlassLabel3.Name = "GlassLabel3"; this.GlassLabel3.NoWrap = false; this.GlassLabel3.Size = new System.Drawing.Size(86, 14); this.GlassLabel3.TabIndex = 4; this.GlassLabel3.Text = "Creature Traces"; // // closeButton // this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.closeButton.BackColor = System.Drawing.Color.Transparent; this.closeButton.BorderColor = System.Drawing.Color.Black; this.closeButton.Depth = 4; this.closeButton.DisabledGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.closeButton.DisabledGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.closeButton.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.closeButton.ForeColor = System.Drawing.Color.White; this.closeButton.Highlight = false; this.closeButton.HighlightGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.closeButton.HighlightGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(192))))); this.closeButton.HoverGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); this.closeButton.HoverGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(216)))), ((int)(((byte)(0))))); this.closeButton.IsGlass = true; this.closeButton.Location = new System.Drawing.Point(387, 2); this.closeButton.Name = "closeButton"; this.closeButton.NormalGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.closeButton.NormalGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.closeButton.PressedGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(216)))), ((int)(((byte)(0))))); this.closeButton.PressedGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); this.closeButton.Size = new System.Drawing.Size(75, 36); this.closeButton.TabIndex = 16; this.closeButton.TabStop = false; this.closeButton.Text = "Close"; this.closeButton.UseStyles = true; this.closeButton.UseVisualStyleBackColor = false; this.closeButton.Click += new System.EventHandler(this.CloseForm_Click); // // glassLabel4 // this.glassLabel4.BackColor = System.Drawing.Color.Transparent; this.glassLabel4.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold); this.glassLabel4.ForeColor = System.Drawing.Color.White; this.glassLabel4.Location = new System.Drawing.Point(35, 80); this.glassLabel4.Name = "glassLabel4"; this.glassLabel4.NoWrap = false; this.glassLabel4.Size = new System.Drawing.Size(83, 17); this.glassLabel4.TabIndex = 15; this.glassLabel4.Text = "System Events"; // // glassLabel5 // this.glassLabel5.BackColor = System.Drawing.Color.Transparent; this.glassLabel5.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold); this.glassLabel5.ForeColor = System.Drawing.Color.White; this.glassLabel5.Location = new System.Drawing.Point(155, 80); this.glassLabel5.Name = "glassLabel5"; this.glassLabel5.NoWrap = false; this.glassLabel5.Size = new System.Drawing.Size(83, 17); this.glassLabel5.TabIndex = 16; this.glassLabel5.Text = "Engine Timings"; // // glassLabel6 // this.glassLabel6.BackColor = System.Drawing.Color.Transparent; this.glassLabel6.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold); this.glassLabel6.ForeColor = System.Drawing.Color.White; this.glassLabel6.Location = new System.Drawing.Point(275, 80); this.glassLabel6.Name = "glassLabel6"; this.glassLabel6.NoWrap = false; this.glassLabel6.Size = new System.Drawing.Size(108, 17); this.glassLabel6.TabIndex = 17; this.glassLabel6.Text = "Creature Traces"; // // resizeBar1 // this.resizeBar1.BackColor = System.Drawing.Color.Black; this.resizeBar1.Dock = System.Windows.Forms.DockStyle.Right; this.resizeBar1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.resizeBar1.ForeColor = System.Drawing.Color.White; this.resizeBar1.Location = new System.Drawing.Point(468, 0); this.resizeBar1.Name = "resizeBar1"; this.resizeBar1.Size = new System.Drawing.Size(20, 40); this.resizeBar1.TabIndex = 17; // // TraceWindow // this.BackColor = System.Drawing.Color.Peru; this.ClientSize = new System.Drawing.Size(488, 392); this.Controls.Add(this.glassLabel6); this.Controls.Add(this.glassLabel5); this.Controls.Add(this.glassLabel4); this.Controls.Add(this.traceTextBox); this.Controls.Add(this.showTraces); this.Controls.Add(this.showTimings); this.Controls.Add(this.showSystemTraces); this.Description = "Use this to view organism trace messages and various engine trace messages"; this.Name = "TraceWindow"; this.Title = "Trace Window"; this.Closing += new System.ComponentModel.CancelEventHandler(this.Form_Closing); this.Load += new System.EventHandler(this.Form_Load); this.Controls.SetChildIndex(this.bottomPanel, 0); this.Controls.SetChildIndex(this.titleBar, 0); this.Controls.SetChildIndex(this.showSystemTraces, 0); this.Controls.SetChildIndex(this.showTimings, 0); this.Controls.SetChildIndex(this.showTraces, 0); this.Controls.SetChildIndex(this.traceTextBox, 0); this.Controls.SetChildIndex(this.glassLabel4, 0); this.Controls.SetChildIndex(this.glassLabel5, 0); this.Controls.SetChildIndex(this.glassLabel6, 0); this.bottomPanel.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.timerAutoRefresh = new System.Windows.Forms.Timer(this.components); this.closeButton = new Terrarium.Glass.GlassButton(); this.refreshButton = new Terrarium.Glass.GlassButton(); this.dataGrid1 = new System.Windows.Forms.DataGrid(); this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle(); this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn5 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn10 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn6 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn9 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn7 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn8 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn12 = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxColumn11 = new System.Windows.Forms.DataGridTextBoxColumn(); this.resizeBar1 = new Terrarium.Forms.ResizeBar(); this.bottomPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); this.SuspendLayout(); // // titleBar // this.titleBar.Size = new System.Drawing.Size(434, 32); this.titleBar.Title = "Local Statistics"; this.titleBar.CloseClicked += new System.EventHandler(this.CloseForm_Click); // // bottomPanel // this.bottomPanel.Controls.Add(this.resizeBar1); this.bottomPanel.Controls.Add(this.closeButton); this.bottomPanel.Controls.Add(this.refreshButton); this.bottomPanel.Gradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.bottomPanel.Gradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.bottomPanel.Location = new System.Drawing.Point(0, 328); this.bottomPanel.Size = new System.Drawing.Size(434, 40); // // timerAutoRefresh // this.timerAutoRefresh.Enabled = true; this.timerAutoRefresh.Interval = 10000; this.timerAutoRefresh.Tick += new System.EventHandler(this.timerAutoRefresh_Tick); // // closeButton // this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.closeButton.BackColor = System.Drawing.Color.Transparent; this.closeButton.BorderColor = System.Drawing.Color.Black; this.closeButton.Depth = 4; this.closeButton.DisabledGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.closeButton.DisabledGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.closeButton.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.closeButton.ForeColor = System.Drawing.Color.White; this.closeButton.Highlight = false; this.closeButton.HighlightGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.closeButton.HighlightGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(192))))); this.closeButton.HoverGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); this.closeButton.HoverGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(216)))), ((int)(((byte)(0))))); this.closeButton.IsGlass = true; this.closeButton.Location = new System.Drawing.Point(338, 2); this.closeButton.Name = "closeButton"; this.closeButton.NormalGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.closeButton.NormalGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.closeButton.PressedGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(216)))), ((int)(((byte)(0))))); this.closeButton.PressedGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); this.closeButton.Size = new System.Drawing.Size(75, 36); this.closeButton.TabIndex = 11; this.closeButton.TabStop = false; this.closeButton.Text = "Close"; this.closeButton.UseStyles = true; this.closeButton.UseVisualStyleBackColor = false; this.closeButton.Click += new System.EventHandler(this.CloseForm_Click); // // refreshButton // this.refreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.refreshButton.BackColor = System.Drawing.Color.Transparent; this.refreshButton.BorderColor = System.Drawing.Color.Black; this.refreshButton.Depth = 4; this.refreshButton.DisabledGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.refreshButton.DisabledGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.refreshButton.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.refreshButton.ForeColor = System.Drawing.Color.White; this.refreshButton.Highlight = false; this.refreshButton.HighlightGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.refreshButton.HighlightGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(192))))); this.refreshButton.HoverGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); this.refreshButton.HoverGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(216)))), ((int)(((byte)(0))))); this.refreshButton.IsGlass = true; this.refreshButton.Location = new System.Drawing.Point(257, 2); this.refreshButton.Name = "refreshButton"; this.refreshButton.NormalGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.refreshButton.NormalGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(96)))), ((int)(((byte)(96)))), ((int)(((byte)(96))))); this.refreshButton.PressedGradient.Bottom = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(216)))), ((int)(((byte)(0))))); this.refreshButton.PressedGradient.Top = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); this.refreshButton.Size = new System.Drawing.Size(75, 36); this.refreshButton.TabIndex = 10; this.refreshButton.TabStop = false; this.refreshButton.Text = "Refresh"; this.refreshButton.UseStyles = true; this.refreshButton.UseVisualStyleBackColor = false; this.refreshButton.Click += new System.EventHandler(this.Refresh_Click); // // dataGrid1 // this.dataGrid1.AlternatingBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.dataGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGrid1.BackgroundColor = System.Drawing.Color.Gray; this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.dataGrid1.CaptionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.dataGrid1.CaptionForeColor = System.Drawing.Color.White; this.dataGrid1.CaptionVisible = false; this.dataGrid1.DataMember = ""; this.dataGrid1.FlatMode = true; this.dataGrid1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dataGrid1.ForeColor = System.Drawing.Color.Black; this.dataGrid1.GridLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.dataGrid1.HeaderBackColor = System.Drawing.Color.Gray; this.dataGrid1.HeaderForeColor = System.Drawing.Color.White; this.dataGrid1.Location = new System.Drawing.Point(12, 81); this.dataGrid1.Name = "dataGrid1"; this.dataGrid1.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.dataGrid1.Size = new System.Drawing.Size(410, 232); this.dataGrid1.TabIndex = 8; this.dataGrid1.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] { this.dataGridTableStyle1 }); // // dataGridTableStyle1 // this.dataGridTableStyle1.AlternatingBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(216)))), ((int)(((byte)(216)))), ((int)(((byte)(216))))); this.dataGridTableStyle1.BackColor = System.Drawing.Color.White; this.dataGridTableStyle1.DataGrid = this.dataGrid1; this.dataGridTableStyle1.ForeColor = System.Drawing.Color.Black; this.dataGridTableStyle1.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] { this.dataGridTextBoxColumn2, this.dataGridTextBoxColumn3, this.dataGridTextBoxColumn4, this.dataGridTextBoxColumn5, this.dataGridTextBoxColumn10, this.dataGridTextBoxColumn6, this.dataGridTextBoxColumn9, this.dataGridTextBoxColumn7, this.dataGridTextBoxColumn8, this.dataGridTextBoxColumn1, this.dataGridTextBoxColumn12, this.dataGridTextBoxColumn11 }); this.dataGridTableStyle1.HeaderBackColor = System.Drawing.Color.Gray; this.dataGridTableStyle1.HeaderForeColor = System.Drawing.Color.White; this.dataGridTableStyle1.MappingName = "History"; // // dataGridTextBoxColumn2 // this.dataGridTextBoxColumn2.Format = ""; this.dataGridTextBoxColumn2.FormatInfo = null; this.dataGridTextBoxColumn2.HeaderText = "Species"; this.dataGridTextBoxColumn2.MappingName = "SpeciesName"; this.dataGridTextBoxColumn2.ReadOnly = true; this.dataGridTextBoxColumn2.Width = 125; // // dataGridTextBoxColumn3 // this.dataGridTextBoxColumn3.Format = "d"; this.dataGridTextBoxColumn3.FormatInfo = null; this.dataGridTextBoxColumn3.HeaderText = "Population"; this.dataGridTextBoxColumn3.MappingName = "Population"; this.dataGridTextBoxColumn3.ReadOnly = true; this.dataGridTextBoxColumn3.Width = 75; // // dataGridTextBoxColumn4 // this.dataGridTextBoxColumn4.Format = "d"; this.dataGridTextBoxColumn4.FormatInfo = null; this.dataGridTextBoxColumn4.HeaderText = "Births"; this.dataGridTextBoxColumn4.MappingName = "BirthCount"; this.dataGridTextBoxColumn4.ReadOnly = true; this.dataGridTextBoxColumn4.Width = 50; // // dataGridTextBoxColumn5 // this.dataGridTextBoxColumn5.Format = "d"; this.dataGridTextBoxColumn5.FormatInfo = null; this.dataGridTextBoxColumn5.HeaderText = "Starved"; this.dataGridTextBoxColumn5.MappingName = "StarvedCount"; this.dataGridTextBoxColumn5.ReadOnly = true; this.dataGridTextBoxColumn5.Width = 75; // // dataGridTextBoxColumn10 // this.dataGridTextBoxColumn10.Format = "d"; this.dataGridTextBoxColumn10.FormatInfo = null; this.dataGridTextBoxColumn10.HeaderText = "Old Age"; this.dataGridTextBoxColumn10.MappingName = "OldAgeCount"; this.dataGridTextBoxColumn10.ReadOnly = true; this.dataGridTextBoxColumn10.Width = 75; // // dataGridTextBoxColumn6 // this.dataGridTextBoxColumn6.Format = "d"; this.dataGridTextBoxColumn6.FormatInfo = null; this.dataGridTextBoxColumn6.HeaderText = "Killed"; this.dataGridTextBoxColumn6.MappingName = "KilledCount"; this.dataGridTextBoxColumn6.ReadOnly = true; this.dataGridTextBoxColumn6.Width = 50; // // dataGridTextBoxColumn9 // this.dataGridTextBoxColumn9.Format = "d"; this.dataGridTextBoxColumn9.FormatInfo = null; this.dataGridTextBoxColumn9.HeaderText = "Sick"; this.dataGridTextBoxColumn9.MappingName = "SickCount"; this.dataGridTextBoxColumn9.ReadOnly = true; this.dataGridTextBoxColumn9.Width = 50; // // dataGridTextBoxColumn7 // this.dataGridTextBoxColumn7.Format = "d"; this.dataGridTextBoxColumn7.FormatInfo = null; this.dataGridTextBoxColumn7.HeaderText = "Errors"; this.dataGridTextBoxColumn7.MappingName = "ErrorCount"; this.dataGridTextBoxColumn7.ReadOnly = true; this.dataGridTextBoxColumn7.Width = 50; // // dataGridTextBoxColumn8 // this.dataGridTextBoxColumn8.Format = "d"; this.dataGridTextBoxColumn8.FormatInfo = null; this.dataGridTextBoxColumn8.HeaderText = "Timeouts"; this.dataGridTextBoxColumn8.MappingName = "TimeoutCount"; this.dataGridTextBoxColumn8.ReadOnly = true; this.dataGridTextBoxColumn8.Width = 50; // // dataGridTextBoxColumn1 // this.dataGridTextBoxColumn1.Format = "d"; this.dataGridTextBoxColumn1.FormatInfo = null; this.dataGridTextBoxColumn1.HeaderText = "Security Violations"; this.dataGridTextBoxColumn1.MappingName = "SecurityViolationCount"; this.dataGridTextBoxColumn1.ReadOnly = true; this.dataGridTextBoxColumn1.Width = 75; // // dataGridTextBoxColumn12 // this.dataGridTextBoxColumn12.Format = "d"; this.dataGridTextBoxColumn12.FormatInfo = null; this.dataGridTextBoxColumn12.HeaderText = "Teleported Here"; this.dataGridTextBoxColumn12.MappingName = "TeleportedToCount"; this.dataGridTextBoxColumn12.ReadOnly = true; this.dataGridTextBoxColumn12.Width = 75; // // dataGridTextBoxColumn11 // this.dataGridTextBoxColumn11.Format = "d"; this.dataGridTextBoxColumn11.FormatInfo = null; this.dataGridTextBoxColumn11.HeaderText = "Teleported Away"; this.dataGridTextBoxColumn11.MappingName = "TeleportedFromCount"; this.dataGridTextBoxColumn11.ReadOnly = true; this.dataGridTextBoxColumn11.Width = 75; // // resizeBar1 // this.resizeBar1.BackColor = System.Drawing.Color.Black; this.resizeBar1.Dock = System.Windows.Forms.DockStyle.Right; this.resizeBar1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.resizeBar1.ForeColor = System.Drawing.Color.White; this.resizeBar1.Location = new System.Drawing.Point(414, 0); this.resizeBar1.Name = "resizeBar1"; this.resizeBar1.Size = new System.Drawing.Size(20, 40); this.resizeBar1.TabIndex = 12; // // ReportStats // this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(434, 368); this.Controls.Add(this.dataGrid1); this.Description = "Every statistic except population is only counted from the start of this terrariu" + "m session. Population carries over between sessions."; this.Name = "ReportStats"; this.Title = "Population Statistics"; this.Controls.SetChildIndex(this.dataGrid1, 0); this.Controls.SetChildIndex(this.titleBar, 0); this.Controls.SetChildIndex(this.bottomPanel, 0); this.bottomPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); this.ResumeLayout(false); }
internal void Replace(TabGroupBase orig, TabGroupBase replace) { // Find array position of old item int origPos = _children.IndexOf(orig); // Transfer across the space occupied replace.RealSpace = orig.RealSpace; // Is this the only Window entry? if (_children.Count == 1) { // Remove Window from appearance // Use helper method to circumvent form Close bug ControlHelper.RemoveAt(_control.Controls, 0); } else { int pos = 0; // Calculate position of Window to remove if (origPos != 0) { pos = origPos * 2 - 1; } // Remove Window and bar // Use helper method to circumvent form Close bug ControlHelper.RemoveAt(_control.Controls, pos); ControlHelper.RemoveAt(_control.Controls, pos); } // Inserting at start of collection? if (origPos == 0) { if (_children.Count > 1) { // Create a resizing bar ResizeBar bar = new ResizeBar(_direction, this); // Append resize bar between existing entries and new entry _control.Controls.Add(bar); // Reposition the bar and group to start of collection _control.Controls.SetChildIndex(bar, 0); } // Append new group control _control.Controls.Add(replace.GroupControl); // Reposition the bar and group to start of collection _control.Controls.SetChildIndex(replace.GroupControl, 0); } else { // Create a resizing bar ResizeBar bar = new ResizeBar(_direction, this); // Append resize bar between existing entries and new entry _control.Controls.Add(bar); // Append new group control _control.Controls.Add(replace.GroupControl); // Find correct index taking into account number of resize bars int pos = origPos * 2 - 1; // Reposition the bar and Window to correct relative ordering _control.Controls.SetChildIndex(bar, pos++); _control.Controls.SetChildIndex(replace.GroupControl, pos); } // Update parentage replace.SetParent(this); // Replace the entry _children[origPos] = replace; // Update child layout to reflect new proportional spacing values RepositionChildren(); // Mark layout as dirty if (_tabbedGroups.AutoCalculateDirty) { _tabbedGroups.Dirty = true; } }
protected void CompactReduceSameDirection(TabbedGroups.CompactFlags flags) { bool changed = false; // Should we check for same direction sub-sequences? if ((flags & TabbedGroups.CompactFlags.ReduceSameDirection) != 0) { int count = _children.Count; for (int index = 0; index < count; index++) { // Only interested in sequence entries if (_children[index].IsSequence) { TabGroupSequence tgs = (TabGroupSequence)_children[index]; // Does it run in same direction as ourself? if (_direction == tgs.Direction) { // Remember how much space the base entry occupies Decimal temp = tgs.RealSpace; // Find the child control to be replaced int childPos = _control.Controls.IndexOf(tgs.GroupControl); // Need to remove a resize bar before the control? if (childPos > 0) { ControlHelper.RemoveAt(_control.Controls, childPos); } // Remove the actual control ControlHelper.RemoveAt(_control.Controls, childPos); // Remove the intermediate group _children.RemoveAt(index); // Reflect change in size count--; Decimal totalAllocated = 0m; // Add in each sub group in turn int subCount = tgs.Count; bool firstInsert = true; for (int subIndex = 0; subIndex < subCount; subIndex++) { TabGroupBase tgb = tgs[subIndex]; // What percentage of original space did it have? Decimal orig = tgb.RealSpace; // Give it the same proportion of new space Decimal update = Decimal.Round(temp / 100 * orig, SPACE_PRECISION); // Keep total actually allocated totalAllocated += update; // Use new proportion tgb.RealSpace = update; // Update parentage tgb.SetParent(this); // Does new child control need a resizing bar? if ((childPos > 0) && !firstInsert) { // Create a resizing bar ResizeBar bar = new ResizeBar(_direction, this); _control.Controls.Add(bar); _control.Controls.SetChildIndex(bar, childPos++); } // Add new child control in its place _control.Controls.Add(tgb.GroupControl); _control.Controls.SetChildIndex(tgb.GroupControl, childPos++); // Insert at current position _children.Insert(index, tgb); // Adjust variables to reflect increased size index++; count++; firstInsert = false; } // Assign any remainder to last group _children[index - 1].RealSpace += temp - totalAllocated; // Need controls repositioned changed = true; // Mark layout as dirty if (_tabbedGroups.AutoCalculateDirty) { _tabbedGroups.Dirty = true; } } } } } // Change in contents requires entries to be repositioned if (changed) { RepositionChildren(); } }
protected void RepositionChildren(ref int[] positions, Rectangle clientRect, int delta) { // Process each control for (int index = 0; index < _control.Controls.Count; index++) { // Delta length for this particular control int newDelta = positions[index]; ResizeBar bar = _control.Controls[index] as ResizeBar; if (bar != null) { if (_direction == Common.Direction.Vertical) { // Set new position bar.Location = new Point(clientRect.X, delta); bar.Width = clientRect.Width; bar.Height = newDelta; // Move delta down to next position delta += newDelta; } else { // Set new position bar.Location = new Point(delta, clientRect.Y); bar.Height = clientRect.Height; bar.Width = newDelta; // Move delta across to next position delta += newDelta; } } else { Control c = _control.Controls[index]; if (c != null) { if (newDelta == 0) { c.Hide(); } else { // Set new position/size based on direction if (_direction == Common.Direction.Vertical) { c.Location = new Point(clientRect.X, delta); c.Width = clientRect.Width; c.Height = newDelta; } else { c.Location = new Point(delta, clientRect.Y); c.Height = clientRect.Height; c.Width = newDelta; } if (!c.Visible) { c.Show(); } // Move delta to next position delta += newDelta; } } } } }