引用文本框添加背景图片,背景透明,文字渲染

博客探讨如何在引用文本框中添加背景图片并保持透明,同时解决滚动时图片抖动的问题,以实现良好的文字渲染效果。
摘要由CSDN通过智能技术生成

引用文本框添加背景图片,背景透明,文字渲染:

        public class DataGridView背景 : DataGridView
        {
            protected override void PaintBackground(Graphics 绘图画面, Rectangle 绘制背景, Rectangle 绘制区域)
            {
                string[] 景图 = "葫芦.ico,葫芦1.ico,葫芦3.ico,葫芦4.ico,葫芦5.ico,葫芦6.ico,葫芦7.ico,葫芦8.ico,葫芦10.ico".Split(',');
                base.PaintBackground(绘图画面, 绘制背景, 绘制区域);
                绘图画面.DrawImage(new Bitmap(@System.Environment.CurrentDirectory + "\\ICO\\" + 景图[DateTime.Now.Minute % 9]), 绘制区域);
                Rectangle 区域 = new Rectangle(绘制区域.X + 1, 绘制区域.Y + 1, 绘制区域.Width - 3, 绘制区域.Height - 3);
                绘图画面.DrawRectangle(Pens.Red, 区域);
            }
        }
        public class TextBox透明 : TextBox
        {
            [System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
            private static extern IntPtr LoadLibrary(string 文件名);
            protected override CreateParams CreateParams
            {
                get
                {
                    CreateParams 控件句柄 = base.CreateParams;
                    if (LoadLibrary("msftedit.dll") != IntPtr.Zero)
                    {
                        控件句柄.ExStyle |= 0x020; // transparent 当背景透明后文本框中的原有快捷菜单就不可用了.RichTextBox  
                        控件句柄.ClassName = "RICHEDIT50W";
                    }
                    return 控件句柄;
                }
            }
        }
        public class TextBox背景 : TextBox
        {
            const int WM_ERASEBKGND = 0x0014;
            private Image 背景图片;
            string[] 景图 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值