K
Ken Allen
When I create and position a new button programmtically, the accelerator is
not being displayed when the form is displayed.
In the code below, the button is displayed simply as "Exit", not with the
"x" character underlined.
If I press alt-X, the button handler is processed.
Actually, some further testing reveals that the accelerator characters are
not always displayed when the form is first displayed, even if they are
placed there in the designer, at least under the conditions where there is
at least one button being added programmatically. When the ALT key is
pressed the first time, then the accelerators appear.
Is this a 'bug' or a 'feature'?
-ken
_Actions[buttonIndex] = new Button();
_Actions[buttonIndex].Size = new System.Drawing.Size(buttonWidth,
buttonHeight);
_Actions[buttonIndex].Location = new Point(xPosition, yPosition);
_Actions[buttonIndex].Name = "btnExit";
_Actions[buttonIndex].TabIndex = tabIndex++;
_Actions[buttonIndex].Text = "E&xit";
_Actions[buttonIndex].Click += new EventHandler(Exit_Click);
this.Controls.Add(_Actions[buttonIndex]);
not being displayed when the form is displayed.
In the code below, the button is displayed simply as "Exit", not with the
"x" character underlined.
If I press alt-X, the button handler is processed.
Actually, some further testing reveals that the accelerator characters are
not always displayed when the form is first displayed, even if they are
placed there in the designer, at least under the conditions where there is
at least one button being added programmatically. When the ALT key is
pressed the first time, then the accelerators appear.
Is this a 'bug' or a 'feature'?
-ken
_Actions[buttonIndex] = new Button();
_Actions[buttonIndex].Size = new System.Drawing.Size(buttonWidth,
buttonHeight);
_Actions[buttonIndex].Location = new Point(xPosition, yPosition);
_Actions[buttonIndex].Name = "btnExit";
_Actions[buttonIndex].TabIndex = tabIndex++;
_Actions[buttonIndex].Text = "E&xit";
_Actions[buttonIndex].Click += new EventHandler(Exit_Click);
this.Controls.Add(_Actions[buttonIndex]);