覆盖TabControl DrawItem VB.Net [英] Overrides TabControl DrawItem VB.Net

查看:116
本文介绍了覆盖TabControl DrawItem VB.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在vb.net上覆盖方法有问题



这里代码是:

Hi all,

I have a problem on overriding method on vb.net

Here''s the code :

Protected Overrides Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
       MsgBox("Draw Item")

   End Sub





它给我一个错误:

错误1 sub' 'TabControl1_DrawItem''无法声明''Overrides'',因为它不会覆盖a中的sub基类。 C:\ Users\satrio.budiharmawan\AppData\Local\Temporary Projects\sieg01\Form1.vb 39 29 sieg01



问题是,如何覆盖该方法?



It throw me error :
Error 1 sub ''TabControl1_DrawItem'' cannot be declared ''Overrides'' because it does not override a sub in a base class. C:\Users\satrio.budiharmawan\AppData\Local\Temporary Projects\sieg01\Form1.vb 39 29 sieg01

The question is, how do I overrides that method?

推荐答案

如果要覆盖DrawItem方法,则覆盖受保护覆盖Sub DrawItem ... ,但仅当您编写的类派生自TabControl时。

如果这是一个只需要为TabControl1创建处理程序的Form .DrawItem方法,然后从子定义中删除Overrides。 (第二点是我认为更有可能的。)
If you are overriding the DrawItem method you would override Protected Overrides Sub DrawItem..., but only if the class you are writing derives from TabControl.
If this is a Form where you simply want to create a handler for the TabControl1.DrawItem method, then just remove the Overrides from your sub definition. (This second point is what I think is more likely.)


这篇关于覆盖TabControl DrawItem VB.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆