涂色 [英] applying color

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

问题描述

大家好,在我的项目中,我在运行时创建了N个标签,
当某些条件满足时,我将更改该标签控件的图像,但我无法更改该控件的图像
这是我用于该任务的编码


hi all, in my projcet i have created some N of labels at runtime,
when certain contion meet i ll change the image of that label control, but i can''t change image of that control
this is the coding i am using for that task


cb.Name = fmsrs.item("seatname")
                       For Each c As Control In Me.Controls
                           If TypeOf c Is Label Then
                               If cb.Name = c.Name Then
                                   p = p + 1
                                   ' c.Text = fmsrs.item("seattext")
                                   c.Enabled = False

                                   c.Font = New System.Drawing.Font("Times New Roman", 7.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
                                   c.ForeColor = Color.Yellow
                               Else
                               End If
                           End If





如何在上面的编码中将iamge放置在标签控制中:)





how can i place iamge for label contol''s in above coding :)

推荐答案

这将取决于您如何布置表格:

如果您的标签直接在表单上,​​则可以通过这种方式进行访问.

如果不是-如果它们在面板,组框,选项卡页或...等中,则它们不会直接添加到表单控件列表中.相反,您将需要递归检查表单上每个控件的控件"列表.
This is going to depend on how you have arranged your form:

If your labels are directly on the form, then you can access then that way.

If they aren''t - if they are in a panel, or a group box, or a tab page, or... etc. then they are not directly added to the form Controls list. Instead, you will need to recursively check the Controls list for each Control on your form.


这篇关于涂色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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