找回密码
 立即注册

QQ登录

只需一步,快速开始

chenfeng1029
金牌服务用户   /  发表于:2017-7-18 11:12  /   查看:3640  /  回复:5
为了方便,我想遍历inputpanel
for each vcontrol as control in inputpanel
if typeof vcontrol is inputtextbox then
   '这里提示inputtextbox是类型,无法这么写。
end if

next

不知道有什么方法可以遍历inputpanel控件。

5 个回复

倒序浏览
JeffryLI
葡萄城公司职员   /  发表于:2017-7-18 14:01:16
沙发
您好,遍历inputpanel需要去遍历它的controls属性,这里应该是TypeName来获取类型名称,还有一点是inputpanel的contors集合只是可读,不能修改的。希望能帮到您
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
chenfeng1029
金牌服务用户   /  发表于:2017-7-18 14:47:45
板凳
这个我清楚,我代码没有写全,是用inputpanel.controls。
for each vcontrol as control in inputpanel.controls
msgbox typename(vcontrol)

next
用什么方法可以判断inputpanel里面那些是inputtextbox?
回复 使用道具 举报
JeffryLI
葡萄城公司职员   /  发表于:2017-7-18 16:16:49
地板
chenfeng1029 发表于 2017-7-18 14:47
这个我清楚,我代码没有写全,是用inputpanel.controls。
for each vcontrol as control in inputpanel.co ...

您好,InputPanel,中的控件都是自动生成,类型名也已经变了,我刚才做了测试,获取的类名是
  1. vc.GetType()
  2. {Name = "a" FullName = "C1.Win.C1InputPanel.s+a"}
  3.     Assembly: {C1.Win.C1InputPanel.4, Version=4.0.20171.248, Culture=neutral, PublicKeyToken=79882d576c6336da}
  4.     AssemblyQualifiedName: "C1.Win.C1InputPanel.s+a, C1.Win.C1InputPanel.4, Version=4.0.20171.248, Culture=neutral, PublicKeyToken=79882d576c6336da"
  5.     Attributes: NestedPrivate | BeforeFieldInit
  6.     BaseType: {Name = "TextBoxWithTabHandling" FullName = "C1.Framework.TextBoxElement+TextBoxWithTabHandling"}
  7.     Cache: {System.RuntimeType.RuntimeTypeCache}
  8.     ContainsGenericParameters: false
  9.     CustomAttributes: Count = 0
  10.     DeclaredConstructors: {System.Reflection.ConstructorInfo[1]}
  11.     DeclaredEvents: {System.Reflection.EventInfo[0]}
  12.     DeclaredFields: {System.Reflection.FieldInfo[0]}
  13.     DeclaredMembers: {System.Reflection.MemberInfo[9]}
  14.     DeclaredMethods: {System.Reflection.MethodInfo[8]}
  15.     DeclaredNestedTypes: {System.Reflection.TypeInfo.<get_DeclaredNestedTypes>d__23}
  16.     DeclaredProperties: {System.Reflection.PropertyInfo[0]}
  17.     DeclaringMethod: “((System.RuntimeType)(vc.GetType())).DeclaringMethod”引发了类型“System.InvalidOperationException”的异常
  18.     DeclaringType: {Name = "s" FullName = "C1.Win.C1InputPanel.s"}
  19.     DomainInitialized: false
  20.     ForwardCallBinder: {System.OleAutBinder}
  21.     FullName: "C1.Win.C1InputPanel.s+a"
  22.     GUID: {0cb5df3e-f7ac-3aae-b550-e19fdb61be1b}
  23.     GenericCache: null
  24.     GenericParameterAttributes: “((System.RuntimeType)(vc.GetType())).GenericParameterAttributes”引发了类型“System.InvalidOperationException”的异常
  25.     GenericParameterPosition: “((System.RuntimeType)(vc.GetType())).GenericParameterPosition”引发了类型“System.InvalidOperationException”的异常
  26.     GenericTypeArguments: {System.Type[0]}
  27.     GenericTypeParameters: {System.Type[0]}
  28.     HasElementType: false
  29.     HasProxyAttribute: false
  30.     ImplementedInterfaces: {System.Type[20]}
  31.     InvocationFlags: INVOCATION_FLAGS_INITIALIZED
  32.     IsAbstract: false
  33.     IsAnsiClass: true
  34.     IsArray: false
  35.     IsAutoClass: false
  36.     IsAutoLayout: true
  37.     IsByRef: false
  38.     IsCOMObject: false
  39.     IsClass: true
  40.     IsConstructedGenericType: false
  41.     IsContextful: false
  42.     IsEnum: false
  43.     IsExplicitLayout: false
  44.     IsExportedToWindowsRuntime: false
  45.     IsGenericParameter: false
  46.     IsGenericType: false
  47.     IsGenericTypeDefinition: false
  48.     IsImport: false
  49.     IsInterface: false
  50.     IsLayoutSequential: false
  51.     IsMarshalByRef: true
  52.     IsNested: true
  53.     IsNestedAssembly: false
  54.     IsNestedFamANDAssem: false
  55.     IsNestedFamORAssem: false
  56.     IsNestedFamily: false
  57.     IsNestedPrivate: true
  58.     IsNestedPublic: false
  59.     IsNotPublic: false
  60.     IsPointer: false
  61.     IsPrimitive: false
  62.     IsPublic: false
  63.     IsSealed: false
  64.     IsSecurityCritical: true
  65.     IsSecuritySafeCritical: false
  66.     IsSecurityTransparent: false
  67.     IsSerializable: false
  68.     IsSpecialName: false
  69.     IsSzArray: false
  70.     IsUnicodeClass: false
  71.     IsValueType: false
  72.     IsVisible: false
  73.     IsWindowsRuntimeObject: false
  74.     MemberType: NestedType
  75.     MetadataToken: 33554678
  76.     Module (System.Reflection.MemberInfo): {C1.Win.C1InputPanel.4.dll}
  77.     Module: {C1.Win.C1InputPanel.4.dll}
  78.     Name: "a"
  79.     Namespace: "C1.Win.C1InputPanel"
  80.     NeedsReflectionSecurityCheck: true
  81.     ReflectedType: {Name = "s" FullName = "C1.Win.C1InputPanel.s"}
  82.     RemotingCache: {System.Runtime.Remoting.Metadata.RemotingTypeCachedData}
  83.     StructLayoutAttribute: {System.Runtime.InteropServices.StructLayoutAttribute}
  84.     TypeHandle: {System.RuntimeTypeHandle}
  85.     TypeInitializer: null
  86.     UnderlyingSystemType: {Name = "a" FullName = "C1.Win.C1InputPanel.s+a"}
  87.     m_cache: {1447572}
  88.     m_cachedData: {System.Runtime.Remoting.Metadata.RemotingTypeCachedData}
  89.     m_handle: {92461512}
  90.     m_invocationFlags: INVOCATION_FLAGS_INITIALIZED
  91.     m_keepalive: null
复制代码
,这个已经被重新构建了,所以可能需要从里面摘取有用的信息。
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
chenfeng1029
金牌服务用户   /  发表于:2017-7-18 17:45:00
5#
好吧。我自己另外想办法。
回复 使用道具 举报
JeffryLI
葡萄城公司职员   /  发表于:2017-7-18 17:56:10
6#
chenfeng1029 发表于 2017-7-18 17:45
好吧。我自己另外想办法。

好的,我也帮您在想想还有什么办法。
请点击评分,对我5分评价,谢谢!

葡萄城控件服务团队
官方网站: https://www.grapecity.com.cn/developer
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部