资源简介
最近在做Winform(C#)的项目,需要设置Textbox的背景颜色为透明,但是Textbox不支持透明的属性.在codeproject上找到了一个外国重写的类
代码片段和文件信息
/*
////////////////////////////////////////////////////////////
/// DISCLAIMER /////
/// READ BEFORE USING THIS CODE!! /////
/// THIS CODE CREATED AND OWNED /////
/// BY AARON DILLIARD. /////
////////////////////////////////////////////////////////////
Code in this disclaimer will apply to the source code
and all project data included with it or generated from it
including but not limited to project files .dll files .exe files.
This code is provided AS IS with no warranties.
By using/viewing this code you assume all responsibilities
for its use.
This code will not be duplicated in parts or in its
entirety without this disclaimer in tact and full credit
given to the creator Aaron Dilliard.
If any code is inherited from or based off of this code
this disclaimer must accompany any code directly copied
or “paraphrased“ from this code.
You will not sell this code in parts or in its entirety
under any circumstances. Any type of selling/financial
gain from this code is strictly prohibited unless
permission is given by the creator Aaron Dilliard.
Parts of the AlphaUtils Namespace are based off of concepts
from Bob Bradley‘s AlphaBlendTextBox.
By viewing or using this code you acknowledge that its creator
accepts no responsiblity or liablity for it whatsoever
and agree to this disclaimer.
If you do not agree do not view/use this code.
*/
#region CODE
#region Imports
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Collections;
using System.Threading;
using System.IO;
using System.Timers;
#endregion
#region AlphaUtils Namespace
namespace AlphaUtils
{
#region AlphaTextBox Class
///
/// Creates a TextBox that can have a Transparent Background.
///
public class AlphaTextBox:TextBox
{
public AlphaTextBox()
{
InitializeComponent();
}//default constructor
#region Private Globals
private delegate void SMDel(ref Message M);
private Container components;
private AlphaPanel APanel;
private Utilities TBUtils;
private Bitmap ClientRegionBitmap;
private PointF CaretPosition;
private System.Timers.Timer blinkCaretTimer;
private bool DrawCaret;
private bool SelectingText;
private Color InternalAlphaBackColor;
private bool InternalBGSet;
private int InternalAlphaAmount;
#endregion
#region Protected Globals
//This is a delegate so the AlphaPanel can
//pass mouse messages to the AlphaTextBox
protected internal Delegate STClientDel;
#endregion
#region Private Methods
private void InitializeComponent()
{
this.Setstyle(Controlstyles.SupportsTransparentBackColor true);
components=new Container();
STClientDel=new SMDel(this.DefWndProc);
TBUtils=new Utilities(STCli
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 53879 2006-02-17 12:34 AlphaTextBox.cs
相关资源
- C# 字符串多行显示/文本换行以textbo
- C# 文本编辑器之查找和替换功能实现
- C#自定义控件---实现带行数和标尺的
- RegexTextBox可验证文本框(.net c# winfo
- TestAutoTextBox.rar
- C#textbox下拉提示 textbox智能提示 te
- Lx-C#自定义控件---实现带行数和标尺的
- C#winform textbox 画边框和圆角
- C# TextBox 控件透明
- WPF richtextBox高亮显示指定文本.rar
- WPF自制RichTextBox文本编辑器
- c#实现从Excel导入数据到textbox中
- WPF TextBox一个缺陷的修改
- wpf textbox Placeholder Demo
- wpf TextBox 做密码输入框
- C# 几个textbox 里的值相加 赋值到 tex
- C# 在richtextbox中生成表格
- 跨线程日志输出到RichTextBox类库源代码
- wpf连接mysql
- C# RichTextBox 输入内容转自定义样式图
- winform 自动完成(智能提示autocomplet
- C# RichTextBox 常用操作(可插入图片/更
- C# wpf textbox 样式(水印)源码
- textbox右边加个小按钮
- richTextBox文本编辑框扩展
- asp.net 富文本编辑器控件(FreeTextBox)
- C# textbox 自动完成(智能提示)
- wpf autocomplate textbox 智能提示
- C# winform RichTextBox支持GIF
- DataGridView中的RichTextBox单元格
评论
共有 条评论