这段代码怎么不能实现?

chinaonl 2006-11-10 09:48:28
Public Class Class1
Inherits TextBox
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
e.Graphics.DrawRectangle(Pens.Black, 0, 0, Me.Width, Me.Height)
End Sub
End Class

我的意思是从TEXTBOX中继承下来,重写它的ONPAINT,为什么这段代码不能实现它还是以原来的样式显示出来,这是为什么。
...全文
80 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
sx_lxh 2006-11-10
  • 打赏
  • 举报
回复
Public Class Class1
Inherits TextBox
Public Sub New()
setstyle(ControlStyles.UserPaint,True)
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
e.Graphics.DrawRectangle(Pens.Black, 0, 0, Me.Width, Me.Height)
End Sub
End Class

16,556

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧