public static GetKillCount ( int taskid ) : int | ||
taskid | int | |
Результат | int |
private void CreateTask(Task task) { lock (controlLock) { int y = taskControls.Count * (TaskSize + VerticalPadding); PictureBox pictureBox = new PictureBox(); pictureBox.Size = new Size(TaskSize, TaskSize); pictureBox.Image = task.GetImage(); if (pictureBox.Image.Width < pictureBox.Width && pictureBox.Image.Height < pictureBox.Height) { pictureBox.SizeMode = PictureBoxSizeMode.CenterImage; } else { pictureBox.SizeMode = PictureBoxSizeMode.Zoom; } pictureBox.Location = new Point(2, y); pictureBox.BackColor = Color.Transparent; int killCount = TaskManager.GetKillCount(task.id); Label label = new Label(); label.Text = killCount.ToString(); label.Location = new Point(TaskSize + 6, y); label.Size = new Size(this.Width - TaskSize - 4, TaskSize); label.BackColor = Color.Transparent; label.Font = font; label.TextAlign = ContentAlignment.MiddleCenter; label.ForeColor = killCount >= task.count ? StyleManager.TaskTrackerForeColorCompleted : StyleManager.TaskTrackerForeColor; this.Controls.Add(label); this.Controls.Add(pictureBox); trackedTasks.Add(task); taskControls.Add(task, new List <Control> { label, pictureBox }); this.parentHUD.Size = new Size(this.Size.Width, y + TaskSize); } }
public void InitializeSettings() { int x = 9, y = 9; int index = 0; foreach (var taskPair in StorageManager.taskList) { foreach (Task task in taskPair.Value) { index = task.id; PictureBox image = new PictureBox(); image.Size = new Size(48, 48); if (task.GetImage().Size.Width < 48 && task.GetImage().Size.Height < 48) { image.SizeMode = PictureBoxSizeMode.CenterImage; } else { image.SizeMode = PictureBoxSizeMode.Zoom; } image.Location = new Point(x, y); image.BackColor = Color.Transparent; image.Name = index.ToString(); image.Click += ToggleTrack; TextBox textBox = new TextBox(); textBox.BackColor = StyleManager.MainFormButtonColor; textBox.Font = StyleManager.MainFormLabelFontSmall; textBox.ForeColor = StyleManager.MainFormButtonForeColor; textBox.Location = new System.Drawing.Point(x + 50, y + 12); textBox.Size = new System.Drawing.Size(60, 23); textBox.TabIndex = index; textBox.Name = index.ToString(); textBox.Text = TaskManager.GetKillCount(task.id).ToString(); textBox.TextAlign = HorizontalAlignment.Right; textBox.TextChanged += ChangeTrackedCount; if (TaskManager.IsTracked(index)) { textBox.Enabled = true; image.Image = task.GetImage(); } else { textBox.Enabled = false; image.Image = task.GetImage().ToGrayscale(); } textBoxes.Add(index, textBox); this.Controls.Add(textBox); this.Controls.Add(image); buttonTasks.Add(index, task); y += 48; if (y > this.Height - 60) { y = 9; x += 120; } } } }