详解c#Winform程序的toolStripButton自定义背景应用示例源码


当前第2页 返回上一页

实现代码如下:

1

2

3

4

5

6

7

8

9

10

11

12

ToolStripButton tsb = (ToolStripButton)sender;

 

Rectangle rectButton = tsb.Bounds;

Point p = toolStrip1.PointToClient(Control.MousePosition);

if (rectButton.Contains(p))

{

    e.Graphics.Clear(SystemColors.ControlText);

    if (tsb.Image != null)

    {

        e.Graphics.DrawImage(tsb.Image, new Point((e.ClipRectangle.Width - tsb.Image.Width) / 2, (e.ClipRectangle.Height - tsb.Image.Height) / 2));

    }

}

以上就是详解c#Winform程序的toolStripButton自定义背景应用示例源码的详细内容!

返回前面的内容

相关阅读 >>

C#中关于new的用法以及和override的区别分析详解

几个优秀的java和C#代码转换工具

通达oa 使用C#的socket编程来其替代原有操作的示例代码分享

C#_调用封装的一个类实现导出excel表格的功能

C# system.drawing.region类的方法使用(图解)

最新使用C#生成二维码方案,详解及实例 ( qrcoder )

详细介绍C#时间戳和js时间戳互转方法的代码分享

C# 7.0 语言新特性

具体介绍C#将指定网页添加到收藏夹的方法

C#使用newtonsoft的json.net进行对象的序列化与反序列化

更多相关阅读请进入《C#》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...