G
Guest
Hello,
I'm trying to generate on the fly a toolbar with some buttons.
Unfortunately, even if I install the SP3, toolbar buttons does not display,
only gray squares appear.
Here is my code (the getimage is a method I developped and seems to be
working):
private const int BUTTON_WIDTH = 62;
public static ToolBar CreateToolBar(
Form f,
params string[] buttonText
)
{
ToolBar tb = new ToolBar();
tb.ImageList = new ImageList();
tb.ImageList.ImageSize = new Size(BUTTON_WIDTH, 20);
foreach(string s in buttonText)
tb.ImageList.Images.Add(
GetImage(s)
);
for(int i=0; i<buttonText.Length ; i++)
{
ToolBarButton tbb = new ToolBarButton();
tbb.ImageIndex = i;
tb.Buttons.Add(
tbb
);
}
f.Controls.Add(tb);
return tb;
}
I'm trying to generate on the fly a toolbar with some buttons.
Unfortunately, even if I install the SP3, toolbar buttons does not display,
only gray squares appear.
Here is my code (the getimage is a method I developped and seems to be
working):
private const int BUTTON_WIDTH = 62;
public static ToolBar CreateToolBar(
Form f,
params string[] buttonText
)
{
ToolBar tb = new ToolBar();
tb.ImageList = new ImageList();
tb.ImageList.ImageSize = new Size(BUTTON_WIDTH, 20);
foreach(string s in buttonText)
tb.ImageList.Images.Add(
GetImage(s)
);
for(int i=0; i<buttonText.Length ; i++)
{
ToolBarButton tbb = new ToolBarButton();
tbb.ImageIndex = i;
tb.Buttons.Add(
tbb
);
}
f.Controls.Add(tb);
return tb;
}