更改evey标签页的背景颜色 [英] Change the backcolor of evey tab page

查看:120
本文介绍了更改evey标签页的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim TControl As Control

If (TypeOf TControl Is TabControl) Then

   If (TypeOf TControl Is TabPage) Then
    TControl.BackColor = color.red 
    End If
  End If





我尝试过:



我需要像这样上厕所

tab(I).page(J)。 backcolor = color.red

但不能正常工作......



What I have tried:

well i need to loo like this
tab(I).page(J). backcolor = color.red
but thins not working ...

推荐答案

我并不感到惊讶:查看TabPage的层次结构图和TabControl:

TabPage类(System.Windows.Forms) [ ^ ]

I'm not surprised: Look at the hierarchy charts for TabPage and TabControl:
TabPage Class (System.Windows.Forms)[^]
System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.Control
        System.Windows.Forms.ScrollableControl
          System.Windows.Forms.Panel
            System.Windows.Forms.TabPage



TabControl类(System.Windows .Forms) [ ^ ]


TabControl Class (System.Windows.Forms)[^]

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.Control
        System.Windows.Forms.TabControl



两者都来自Control,但两者都不是从另一个派生的。

所以如果 TypeOf TControl TabPage 那么它不是 TabControl ,反之亦然。你的行:


Both are derived from Control, but neither is derived from the other.
So if TypeOf TControl is TabPage then it isn't a TabControl, and vice versa. Your line:

TControl.BackColor = color.red 

永远不会执行。


这篇关于更改evey标签页的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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