Кодируйте эквивалентный + = присвоение на событие

То, что необходимо сделать, установлено свойство выравнивания progressbar для исправления. Тогда установите LayoutStyle StatusStrip к HorizontalStackWithOverflow.

    private void InitializeComponent()
    {
        this.statusStrip1 = new System.Windows.Forms.StatusStrip();
        this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
        this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
        this.statusStrip1.SuspendLayout();
        this.SuspendLayout();
        // 
        // statusStrip1
        // 
        this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    this.toolStripStatusLabel1,
    this.toolStripProgressBar1});
        this.statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
        this.statusStrip1.Location = new System.Drawing.Point(0, 250);
        this.statusStrip1.Name = "statusStrip1";
        this.statusStrip1.Size = new System.Drawing.Size(467, 22);
        this.statusStrip1.TabIndex = 0;
        this.statusStrip1.Text = "statusStrip1";
        // 
        // toolStripStatusLabel1
        // 
        this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
        this.toolStripStatusLabel1.Size = new System.Drawing.Size(117, 17);
        this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
        // 
        // toolStripProgressBar1
        // 
        this.toolStripProgressBar1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
        this.toolStripProgressBar1.Name = "toolStripProgressBar1";
        this.toolStripProgressBar1.Size = new System.Drawing.Size(100, 16);

    }

    private System.Windows.Forms.StatusStrip statusStrip1;
    private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
    private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;
5
задан Matt 3 August 2009 в 21:05
поделиться

1 ответ

Событие определяет набор методов, включая «добавить» и «удалить» (так же, как свойство определяет «получить» и «установить»). к этому эффективно:

obj.add_SomeEvent(handler);

Внутренне событие могло делать что угодно; есть 2 распространенных случая:

  • события с полем делегата (включая «подобные поля» события)
  • реализации EventHandlerList

С делегатом он эффективно использует Delegate.Combine :

handler = Delegate.Combine(handler, value);

В EventHandlerList есть ключевой объект:

Events.AddHandler(EventKey, value);
10
ответ дан 13 December 2019 в 22:13
поделиться
Другие вопросы по тегам:

Похожие вопросы: