Exemple #1
0
            private void CommandLink_Click(object sender, EventArgs e)
            {
                CommandLink commandLink = (CommandLink)sender;

                this.dialogResult = (TaskButton)commandLink.Tag;
                Close();
            }
Exemple #2
0
            private void InitCommandLinks()
            {
                SuspendLayout();

                if (this.commandLinks != null)
                {
                    foreach (CommandLink commandLink in this.commandLinks)
                    {
                        Controls.Remove(commandLink);
                        commandLink.Tag    = null;
                        commandLink.Click -= CommandLink_Click;
                        commandLink.Dispose();
                    }

                    this.commandLinks = null;
                }

                this.commandLinks = new CommandLink[this.taskButtons.Length];

                IButtonControl newAcceptButton = null;
                IButtonControl newCancelButton = null;

                for (int i = 0; i < this.commandLinks.Length; ++i)
                {
                    TaskButton  taskButton  = this.taskButtons[i];
                    CommandLink commandLink = new CommandLink();

                    commandLink.ActionText      = taskButton.ActionText;
                    commandLink.ActionImage     = taskButton.Image;
                    commandLink.AutoSize        = true;
                    commandLink.ExplanationText = taskButton.ExplanationText;
                    commandLink.Tag             = taskButton;
                    commandLink.Click          += CommandLink_Click;

                    this.commandLinks[i] = commandLink;
                    Controls.Add(commandLink);

                    if (this.acceptTaskButton == taskButton)
                    {
                        newAcceptButton = commandLink;
                    }

                    if (this.cancelTaskButton == taskButton)
                    {
                        newCancelButton = commandLink;
                    }
                }

                AcceptButton = newAcceptButton;
                CancelButton = newCancelButton;

                ResumeLayout();
            }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.documentStrip      = new PaintDotNet.DocumentStrip();
     this.documentListHeader = new PaintDotNet.HeaderLabel();
     this.hScrollBar         = new System.Windows.Forms.HScrollBar();
     this.saveButton         = new PaintDotNet.CommandLink();
     this.dontSaveButton     = new PaintDotNet.CommandLink();
     this.cancelButton       = new PaintDotNet.CommandLink();
     this.infoLabel          = new System.Windows.Forms.Label();
     this.SuspendLayout();
     //
     // documentStrip
     //
     this.documentStrip.BackColor               = System.Drawing.SystemColors.ButtonHighlight;
     this.documentStrip.DocumentClicked        += new EventHandler <Pair <DocumentWorkspace, DocumentClickAction> >(DocumentList_DocumentClicked);
     this.documentStrip.EnsureSelectedIsVisible = false;
     this.documentStrip.ManagedFocus            = true;
     this.documentStrip.Name                   = "documentList";
     this.documentStrip.ScrollOffset           = 0;
     this.documentStrip.ScrollOffsetChanged   += new EventHandler(DocumentList_ScrollOffsetChanged);
     this.documentStrip.ShowCloseButtons       = false;
     this.documentStrip.ShowScrollButtons      = false;
     this.documentStrip.TabIndex               = 0;
     this.documentStrip.ThumbnailUpdateLatency = 10;
     //
     // documentListHeader
     //
     this.documentListHeader.Name        = "documentListHeader";
     this.documentListHeader.RightMargin = 0;
     this.documentListHeader.TabIndex    = 1;
     this.documentListHeader.TabStop     = false;
     //
     // hScrollBar
     //
     this.hScrollBar.Name          = "hScrollBar";
     this.hScrollBar.TabIndex      = 2;
     this.hScrollBar.ValueChanged += new System.EventHandler(this.HScrollBar_ValueChanged);
     //
     // saveButton
     //
     this.saveButton.ActionImage = null;
     this.saveButton.AutoSize    = true;
     this.saveButton.Name        = "saveButton";
     this.saveButton.TabIndex    = 4;
     this.saveButton.Click      += new System.EventHandler(this.SaveButton_Click);
     //
     // dontSaveButton
     //
     this.dontSaveButton.ActionImage = null;
     this.dontSaveButton.AutoSize    = true;
     this.dontSaveButton.Name        = "dontSaveButton";
     this.dontSaveButton.TabIndex    = 5;
     this.dontSaveButton.Click      += new System.EventHandler(this.DontSaveButton_Click);
     //
     // cancelButton
     //
     this.cancelButton.ActionImage = null;
     this.cancelButton.AutoSize    = true;
     this.cancelButton.Name        = "cancelButton";
     this.cancelButton.TabIndex    = 6;
     this.cancelButton.Click      += new System.EventHandler(this.CancelButton_Click);
     //
     // infoLabel
     //
     this.infoLabel.Name     = "infoLabel";
     this.infoLabel.TabIndex = 7;
     //
     // UnsavedChangesDialog
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Dpi;
     this.ClientSize          = new System.Drawing.Size(490, 100);
     this.Controls.Add(this.infoLabel);
     this.Controls.Add(this.documentListHeader);
     this.Controls.Add(this.cancelButton);
     this.Controls.Add(this.hScrollBar);
     this.Controls.Add(this.dontSaveButton);
     this.Controls.Add(this.documentStrip);
     this.Controls.Add(this.saveButton);
     this.AcceptButton    = this.saveButton;
     this.CancelButton    = this.cancelButton;
     this.FormBorderStyle = FormBorderStyle.FixedDialog;
     this.Location        = new System.Drawing.Point(0, 0);
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "UnsavedChangesDialog";
     this.ShowInTaskbar   = false;
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Controls.SetChildIndex(this.saveButton, 0);
     this.Controls.SetChildIndex(this.documentStrip, 0);
     this.Controls.SetChildIndex(this.dontSaveButton, 0);
     this.Controls.SetChildIndex(this.hScrollBar, 0);
     this.Controls.SetChildIndex(this.cancelButton, 0);
     this.Controls.SetChildIndex(this.documentListHeader, 0);
     this.Controls.SetChildIndex(this.infoLabel, 0);
     this.ResumeLayout(false);
     this.PerformLayout();
 }