Change winform ToolTip backcolor

前端 未结 3 1930
萌比男神i
萌比男神i 2020-12-19 02:18

I am using a ToolTip control in my project. I want to set its backcolor red. I have changed ownerdraw property to true and backcolor to red. But no result. Any suggestion?

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 02:50

    Set these propeties:

    yourTooltip.OwnerDraw = true; 
    yourTooltip.BackColor = System.Drawing.Color.Red;
    

    then on the Draw event use this :

    private void yourTooltip_Draw(object sender, DrawToolTipEventArgs e)
    {
        e.DrawBackground();
        e.DrawBorder();
        e.DrawText();
    }
    

提交回复
热议问题