I have a bunch of buttons created on a winforms c# app. I have created them using the following code
int s = 0;//28 buttons
        ButtonNameArray barray = new ButtonNameArray();
        frontPanelButtons fpb = new frontPanelButtons();
        int xLoc = fpb.xLoc(fpb);
        int yLoc = fpb.yLoc(fpb);
        for (int i = 0; i < 7; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                Button btn = new Button();
                btn.Name = barray.getName(btn.Name, s);
                btn.Text = barray.getText(btn.Text, s);
                btn.Width = fpb.btnWide(fpb);
                btn.Height = fpb.btnHigh(fpb);
                btn.Location = new System.Drawing.Point(xLoc, yLoc);
                Controls.Add(btn);
                xLoc += 100;
                s++;
            }
            yLoc += 31;
            xLoc = fpb.xLoc(fpb);
        }
And I would like to add a unique tooltip to each button but can't figure out how to do it. Could anyone please supply help/the answer? Many thanks.
A tooltip control can be either active or inactive. When it is active, the tooltip text appears when the mouse pointer is on a tool. When it is inactive, the tooltip text does not appear, even if the pointer is on a tool. The TTM_ACTIVATE message activates and deactivates a tooltip control.
//...
ToolTip ttip = new ToolTip();
for (int i = 0; i < 7; i++) {
    for (int j = 0; j < 4; j++) {
        Button btn = new Button();
        // ...
        ttip.SetToolTip(btn, "Some text on my tooltip.");
    }
}
//...
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With