private void InitializeComponent() { _includePathLabel = new Label(); _includePathListView = new PathListView(); _excludePathLabel = new Label(); _excludePathListView = new PathListView(); _artistsListLabel = new Label(); _artistsRichTextBox = new RichTextBox(); _regexLabel = new Label(); _regexListView = new EditableListView(); _startButton = new Button(); _progressBar = new ProgressBar(); _stepLabel = new CurrentMaxValueLabel(); _includePathLabel.Location = new Point(0, 0); _includePathLabel.Size = new Size(LayoutGUI.AdditionalsPathListViewWidth, 15); _includePathLabel.TextAlign = ContentAlignment.MiddleLeft; _includePathLabel.AutoSize = false; _includePathListView.Location = new Point(_includePathLabel.Location.X, _includePathLabel.Location.X + _includePathLabel.Size.Height); _includePathListView.Size = new Size(LayoutGUI.AdditionalsPathListViewWidth, LayoutGUI.AdditionalsPathListViewHeight); _includePathListView.HeaderStyle = ColumnHeaderStyle.None; _includePathListView.View = View.Details; _includePathListView.PathType = PathType.Folder; _includePathListView.PathStatus = PathStatus.Exist; _excludePathLabel.Location = new Point(_includePathListView.Size.Width + LayoutGUI.DistanceBetweenControls * 2, _includePathLabel.Location.Y); _excludePathLabel.Size = _includePathLabel.Size; _excludePathLabel.TextAlign = ContentAlignment.MiddleLeft; _excludePathLabel.AutoSize = false; _excludePathListView.Location = new Point(_excludePathLabel.Location.X, _excludePathLabel.Location.Y + _excludePathLabel.Size.Height); _excludePathListView.Size = _includePathListView.Size; _excludePathListView.HeaderStyle = ColumnHeaderStyle.None; _excludePathListView.View = View.Details; _excludePathListView.PathType = PathType.Folder; _excludePathListView.PathStatus = PathStatus.Exist; _artistsListLabel.Location = new Point(_includePathListView.Location.X, _includePathListView.Location.Y + _includePathListView.Size.Height); _artistsListLabel.Size = _includePathLabel.Size; _artistsListLabel.TextAlign = ContentAlignment.MiddleLeft; _artistsListLabel.AutoSize = true; _artistsRichTextBox.Location = new Point(_artistsListLabel.Location.X, _artistsListLabel.Location.Y + _artistsListLabel.Size.Height); _artistsRichTextBox.Size = _includePathListView.Size; _artistsRichTextBox.ReadOnly = true; _regexLabel.Location = new Point(_excludePathListView.Location.X, _excludePathListView.Location.Y + _excludePathListView.Size.Height); _regexLabel.Size = _excludePathLabel.Size; _regexLabel.Text = "regex"; _regexLabel.TextAlign = ContentAlignment.MiddleLeft; _regexLabel.AutoSize = true; _regexListView.Location = new Point(_excludePathListView.Location.X, _regexLabel.Location.Y + _regexLabel.Size.Height); _regexListView.Size = _artistsRichTextBox.Size; _regexListView.HeaderStyle = ColumnHeaderStyle.None; _regexListView.View = View.Details; _regexListView.ValidateFunc = obj => RegexUtils.IsValidRegex(obj.ToString()); _startButton.Location = new Point(0, _artistsRichTextBox.Location.Y + _artistsRichTextBox.Size.Height); _startButton.Size = new Size(LayoutGUI.AdditionalsPathListViewWidth, 30); _startButton.Click += (sender, args) => Task.Run(ShowArtists); _progressBar.Location = new Point(0, _startButton.Location.Y + _startButton.Size.Height); _progressBar.Size = new Size(LayoutGUI.AdditionalsFormWidth, 10); _progressBar.Step = 1; _progressBar.Style = ProgressBarStyle.Continuous; _stepLabel.Location = new Point(_regexListView.Location.X, _startButton.Location.Y); _stepLabel.Size = new Size(LayoutGUI.AdditionalsFormWidth - _regexListView.Location.X, _startButton.Size.Height); _stepLabel.AutoSize = false; _stepLabel.TextAlign = ContentAlignment.MiddleLeft; _stepLabel.Font = new Font(Font.Name, Font.Size + 3); _stepLabel.DisplayType = MathUtils.DisplayType.ValueAndPercent; _stepLabel.PercentFractionalCount = 2; MinimizeBox = false; MaximizeBox = false; ShowInTaskbar = false; AutoScaleDimensions = new SizeF(7F, 15F); ClientSize = new Size(LayoutGUI.AdditionalsFormWidth, LayoutGUI.AdditionalsFormHeight); AutoScaleMode = AutoScaleMode.Font; FormBorderStyle = FormBorderStyle.FixedDialog; Controls.Add(_includePathLabel); Controls.Add(_includePathListView); Controls.Add(_excludePathLabel); Controls.Add(_excludePathListView); Controls.Add(_regexLabel); Controls.Add(_regexListView); Controls.Add(_artistsListLabel); Controls.Add(_artistsRichTextBox); Controls.Add(_startButton); Controls.Add(_progressBar); Controls.Add(_stepLabel); Icon = ImageUtils.IconFromImage(Images.Line.Tech); }
private void InitializeComponent() { _searchQueryLabel = new Label(); _downloadPathLabel = new Label(); _searchQueryTextBox = new SearchQueryTextBox(); _downloadPathTextBox = new DerpiAdvancedPathTextBox(); _downloadProgressBar = new ProgressBar(); _logRichTextBox = new LoggerRichTextBox(); _startDownloadButton = new Button(); _removeOrRestartDownloadButton = new Button(); _pauseResumeButton = new Button(); _downloadValueLabel = new CurrentMaxValueLabel(); _helpToolTip = new HelpToolTip(); SuspendLayout(); _searchQueryLabel.Location = new Point(2, -3); _searchQueryLabel.Size = new Size(200, 20); _searchQueryLabel.AutoSize = false; _searchQueryLabel.TextAlign = ContentAlignment.MiddleLeft; _downloadPathLabel.Location = new Point(2, 40); _downloadPathLabel.Size = new Size(200, 20); _downloadPathLabel.AutoSize = false; _downloadPathLabel.TextAlign = ContentAlignment.MiddleLeft; _searchQueryTextBox.Location = new Point(5, 18); _searchQueryTextBox.Size = new Size(330, 22); _searchQueryTextBox.Multiline = false; _searchQueryTextBox.TextAlign = HorizontalAlignment.Left; _searchQueryTextBox.AutoSize = false; _searchQueryTextBox.TextChanged += (sender, args) => OnTextChanged(); _downloadPathTextBox.Location = new Point(3, 60); _downloadPathTextBox.Size = new Size(332, 22); _downloadPathTextBox.AutoSize = false; _downloadPathTextBox.PathType = PathType.File; _downloadPathTextBox.UpdateAvailableFormatingParts(typeof(Json.Image)); _downloadPathTextBox.TextChanged += (sender, args) => OnTextChanged(); _downloadPathTextBox.Text = Globals.CurrentDownloadPath; _downloadPathTextBox.PathBeenSelected += str => _downloadPathTextBox.Text = Path.Combine(str, Globals.CurrentDownloadFileName.GetValue()); _startDownloadButton.Location = new Point(3, 90); _startDownloadButton.Size = new Size(302, 25); _startDownloadButton.TextAlign = ContentAlignment.MiddleCenter; _startDownloadButton.Click += OnStartDownloadButton_Click; _pauseResumeButton.Location = new Point(_startDownloadButton.Location.X, _startDownloadButton.Location.Y); _pauseResumeButton.Size = new Size(_startDownloadButton.Size.Width, _startDownloadButton.Size.Height); _pauseResumeButton.TextAlign = ContentAlignment.MiddleCenter; _pauseResumeButton.Visible = false; _pauseResumeButton.Enabled = false; _pauseResumeButton.Click += OnPauseResumeButton_Click; _removeOrRestartDownloadButton.Location = new Point(304, 90); _removeOrRestartDownloadButton.Size = new Size(30, 30); _removeOrRestartDownloadButton.Click += OnRemoveOrRestartDownloadButtonClick; _logRichTextBox.Size = new Size(200, 75); _logRichTextBox.Location = new Point(340, 15); _logRichTextBox.Font = new Font(Font.Name, Font.Size - 1); _logRichTextBox.BorderStyle = BorderStyle.Fixed3D; _logRichTextBox.Reversed = false; _downloadProgressBar.Size = new Size(_startDownloadButton.Size.Width - 3, 5); _downloadProgressBar.Location = new Point(5, 115); _downloadProgressBar.Style = ProgressBarStyle.Continuous; _downloadValueLabel.Size = new Size(_logRichTextBox.Size.Width, 30); _downloadValueLabel.Location = new Point(_logRichTextBox.Location.X, _logRichTextBox.Location.Y + _logRichTextBox.Size.Height); _downloadValueLabel.AutoSize = false; _downloadValueLabel.Visible = false; _downloadValueLabel.TextAlign = ContentAlignment.MiddleLeft; _downloadValueLabel.Font = new Font(Font.Name, Font.Size + 3); _downloadValueLabel.DisplayType = MathUtils.DisplayType.ValueAndPercent; _downloadValueLabel.PercentFractionalCount = 2; Controls.Add(_searchQueryLabel); Controls.Add(_downloadPathLabel); Controls.Add(_searchQueryTextBox); Controls.Add(_downloadPathTextBox); Controls.Add(_startDownloadButton); Controls.Add(_removeOrRestartDownloadButton); Controls.Add(_pauseResumeButton); Controls.Add(_logRichTextBox); Controls.Add(_downloadValueLabel); Controls.Add(_downloadProgressBar); AcceptButton = _startDownloadButton; Globals.APIKey.Changed += OnTextChanged; ResumeLayout(); }
public PageControl() { ControlsList = new EventQueueList <T>(); Size size = new Size(100, ButtonHeight); PreviousPageButton = new Button { Size = size }; NextPageButton = new Button { Size = size }; PageValueLabel = new CurrentMaxValueLabel { TextAlign = ContentAlignment.MiddleCenter, Separator = "\\" }; PageValueLabel.SizeChanged += (sender, args) => SetSizeAndPosition(); PageValueLabel.FontChanged += (sender, args) => SetLabelSize(); PageValueLabel.TextChanged += (sender, args) => SetLabelSize(); CurrentPageChanged += OnPageChanged; PreviousPageButton.Click += (sender, args) => { if (ModifierKeys == Keys.Shift) { CurrentPage = MinimumPage; return; } CurrentPage--; }; NextPageButton.Click += (sender, args) => { if (ModifierKeys == Keys.Shift) { CurrentPage = MaximumPage - 1; return; } CurrentPage++; }; ControlsList.OnAdd += AddToControls; ControlsList.OnRemove += RemoveFromControls; PositionChanged += SetSizeAndPosition; AligmentChanged += SetSizeAndPosition; ClientSizeChanged += (sender, args) => SetSizeAndPosition(); Controls.Add(PreviousPageButton); Controls.Add(NextPageButton); Controls.Add(PageValueLabel); OnPageChanged(); }