2022年用户自定义控件-透明文本框收集 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年用户自定义控件-透明文本框收集 .pdf》由会员分享,可在线阅读,更多相关《2022年用户自定义控件-透明文本框收集 .pdf(19页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、透明文本框来源:http:/ 只能下载*.dll 的文件,没有代码,所以特意发出源代码。using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Data;using System.Windows.Forms;using System.Drawing.Imaging;namespace ZBobb /AlphaBlendTextBox:A.Net textbox that can be translucent to the background./(C)
2、2003 Bob Bradley/ZB AlphaBlendTextBox:System.Windows.Forms.TextBox#region private variablesprivate uPictureBox myPictureBox;privatebool myUpToDate=false;privatebool myCaretUpToDate=false;名师资料总结-精品资料欢迎下载-名师精心整理-第 1 页,共 19 页 -private Bitmap myBitmap;private Bitmap myAlphaBitmap;privateint myFontHeight
3、=10;private System.Windows.Forms.Timer myTimer1;privatebool myCaretState=true;privatebool myPaintedFirstTime=false;private Color myBackColor=Color.White;privateint myBackAlpha=10;/Required designer variable./private System.ComponentModel.Container components=null;#endregion/end private variables#reg
4、ion public methods and overridespublicAlphaBlendTextBox()/This call is required by the Windows.Forms Form Designer.InitializeComponent();/TODO:Add any initialization after the InitializeComponent callthis.BackColor=myBackColor;this.SetStyle(ControlStyles.UserPaint,false);this.SetStyle(ControlStyles.
5、AllPaintingInWmPa名师资料总结-精品资料欢迎下载-名师精心整理-第 2 页,共 19 页 -int,true);this.SetStyle(ControlStyles.DoubleBuffer,true);myPictureBox=new uPictureBox();this.Controls.Add(myPictureBox);myPictureBox.Dock=DockStyle.Fill;protectedoverridevoid OnResize(EventArgs e)base.OnResize(e);this.myBitmap=new Bitmap(this.Cli
6、entRectangle.Width,this.ClientRectangle.Height);/(this.Width,this.Height);this.myAlphaBitmap=new Bitmap(this.ClientRectangle.Width,this.ClientRectangle.Height);/(this.Width,this.Height);myUpToDate=false;this.Invalidate();/Some of these should be moved to the WndProc laterprotectedoverridevoid OnKeyD
7、own(KeyEventArgs e)base.OnKeyDown(e);myUpToDate=false;this.Invalidate();protectedoverridevoid OnKeyUp(KeyEventArgs e)名师资料总结-精品资料欢迎下载-名师精心整理-第 3 页,共 19 页 -base.OnKeyUp(e);myUpToDate=false;this.Invalidate();protectedoverridevoid OnKeyPress(KeyPressEventArgs e)base.OnKeyPress(e);myUpToDate=false;this.I
8、nvalidate();protectedoverridevoid OnMouseUp(MouseEventArgs e)base.OnMouseUp(e);this.Invalidate();protectedoverridevoid OnGiveFeedback(GiveFeedbackEventArgs gfbevent)base.OnGiveFeedback(gfbevent);myUpToDate=false;this.Invalidate();protectedoverridevoid OnMouseLeave(EventArgs e)/found this code to fin
9、d the current cursor location/at http:/ 4 页,共 19 页 -Point ptCursor=Cursor.Position;Form f=this.FindForm();ptCursor=f.PointToClient(ptCursor);if(!this.Bounds.Contains(ptCursor)base.OnMouseLeave(e);protectedoverridevoid OnChangeUICues(UICuesEventArgs e)base.OnChangeUICues(e);myUpToDate=false;this.Inva
10、lidate();/-protectedoverridevoid OnGotFocus(EventArgs e)base.OnGotFocus(e);myCaretUpToDate=false;myUpToDate=false;this.Invalidate();myTimer1=new System.Windows.Forms.Timer(ponents);myTimer1.Interval=(int)win32.GetCaretBlinkTime();/usually around 500;myTimer1.Tick+=new EventHandler(myTimer1_Tick);myT
11、imer1.Enabled=true;名师资料总结-精品资料欢迎下载-名师精心整理-第 5 页,共 19 页 -protectedoverridevoid OnLostFocus(EventArgs e)base.OnLostFocus(e);myCaretUpToDate=false;myUpToDate=false;this.Invalidate();myTimer1.Dispose();/-protectedoverridevoid OnFontChanged(EventArgs e)if(this.myPaintedFirstTime)this.SetStyle(ControlStyl
12、es.UserPaint,false);base.OnFontChanged(e);if(this.myPaintedFirstTime)this.SetStyle(ControlStyles.UserPaint,true);myFontHeight=GetFontHeight();myUpToDate=false;this.Invalidate();protectedoverridevoid OnTextChanged(EventArgs e)base.OnTextChanged(e);名师资料总结-精品资料欢迎下载-名师精心整理-第 6 页,共 19 页 -myUpToDate=false
13、;this.Invalidate();protectedoverridevoid WndProc(refMessage m)base.WndProc(ref m);/need to rewrite as a big switchif(m.Msg=win32.WM_PAINT)myPaintedFirstTime=true;if (!myUpToDate|!myCaretUpToDate)GetBitmaps();myUpToDate=true;myCaretUpToDate=true;if (myPictureBox.Image!=null)myPictureBox.Image.Dispose
14、();myPictureBox.Image=(Image)myAlphaBitmap.Clone();elseif (m.Msg=win32.WM_HSCROLL|m.Msg=win32.WM_VSCROLL)myUpToDate=false;this.Invalidate();elseif (m.Msg=win32.WM_LBUTTONDOWN|m.Msg=win32.WM_RBUTTONDOWN 名师资料总结-精品资料欢迎下载-名师精心整理-第 7 页,共 19 页 -|m.Msg=win32.WM_LBUTTONDBLCLK/|m.Msg=win32.WM_MOUSELEAVE /*)m
15、yUpToDate=false;this.Invalidate();elseif (m.Msg=win32.WM_MOUSEMOVE)if (m.WParam.ToInt32()!=0)/shift key or other buttons myUpToDate=false;this.Invalidate();/System.Diagnostics.Debug.WriteLine(Pro:+m.Msg.ToString(X);/Clean up any resources being used./protectedoverridevoid Dispose(bool disposing)if(d
16、isposing)/this.BackColor=Color.Pink;if (components!=null)名师资料总结-精品资料欢迎下载-名师精心整理-第 8 页,共 19 页 -components.Dispose();base.Dispose(disposing);#endregion/end public method and overrides#region public property overridespublicnew BorderStyle BorderStyle get returnbase.BorderStyle;set if (this.myPaintedFir
17、stTime)this.SetStyle(ControlStyles.UserPaint,false);base.BorderStyle=value;if (this.myPaintedFirstTime)this.SetStyle(ControlStyles.UserPaint,true);this.myBitmap=null;this.myAlphaBitmap=null;myUpToDate=false;this.Invalidate();publicnew Color BackColor get 名师资料总结-精品资料欢迎下载-名师精心整理-第 9 页,共 19 页 -returnCo
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年用户自定义控件-透明文本框收集 2022 用户 自定义 控件 透明 文本框 收集
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内