社区
C++ Builder
帖子详情
Label1的Caption颜色的问题。
hwchwc
2004-08-23 02:09:00
表AA的FONT_C字段(字符型)有一记录的值是Red,想让LABEL1上的文字的颜色为Red:
Label1->Font->Color=sjhjDataModule->IBQuery->FieldByName("FONT_C")->AsString;
这样写有错误?该如何写!但
Label1->Font->Color=Red;就可以。
...全文
98
2
打赏
收藏
Label1的Caption颜色的问题。
表AA的FONT_C字段(字符型)有一记录的值是Red,想让LABEL1上的文字的颜色为Red: Label1->Font->Color=sjhjDataModule->IBQuery->FieldByName("FONT_C")->AsString; 这样写有错误?该如何写!但 Label1->Font->Color=Red;就可以。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
arraden
2004-08-23
打赏
举报
回复
楼上说了
ccrun.com
2004-08-23
打赏
举报
回复
Label1->Font->Color = StringToColor(sjhjDataModule->IBQuery->FieldByName("FONT_C")->AsString);
VB 利用拖动条滑块实现 RGB 调色板调色实例.rar
VB调色板,HScroll1,RGB的应用实例,利用三个滑块(拖动条)来分别调整RGB三基色,本源码可学习一下滑块的使用、
颜色
的渲染等。当用户改变拖动条的时候,会改变对应事件处理程序,每一个事件程序分别代表了对RGB分量的调节,如下: Private Sub HScroll1_Change()
Label
2.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label
7.
Caption
= HScroll1.Value End Sub Private Sub HScroll2_Change()
Label
2.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label
8.
Caption
= HScroll1.Value End Sub Private Sub HScroll3_Change()
Label
2.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label
8.
Caption
= HScroll1.Value End Sub 请下载本源码查看更多代码。
VByk识别答题卡
颜色
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Private Declare Function GetCursorPos Lib "user32" (lpPoint As pointapi) As Long Private Declare Function CreateDCA& Lib "gdi32" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As Long) Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long Private Type pointapi X As Long Y As Long End Type Private Sub Command1_Click() Dim a As Long Dim p As pointapi a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) GetCursorPos p Me.BackColor = GetPixel(a, p.X, p.Y) Command1.
Caption
= GetPixel(a, p.X, p.Y) DeleteDC a End Sub Private Sub Command2_Click() 'Shell "C:\WINDOWS\Pbrush.exe c:\9.bmp", 1 'SendKeys ("%{f}") 'SendKeys ("%{F4}") 'SendKeys ("%{F4}") 'SendKeys ("%{F4}") 'SendKeys ("%{F4}") 'SendKeys ("%{F4}") 'SendKeys ("%a") 'SendKeys ("%{F4}") 'SendKeys ("%{F4}") 'SendKeys ("%{F4}") 'SendKeys ("%{F4}") 'SendKeys ("%{F4}") End Sub Private Sub Command3_Click() Dim a As Long Dim p As pointapi a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) GetCursorPos p
Label
3.
Caption
= GetPixel(a, Text2.Text, Text3.Text)
Label
4.
Caption
= GetPixel(a, Text4.Text, Text5.Text) End Sub Private Sub Command4_Click() Form2.Show End Sub Private Sub Command5_Click() Cls For i = 1 To 85 Print ti(i) Next i End Sub Private Sub Command6_Click() Dim a As Long Dim p As pointapi a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) GetCursorPos p Public kaohao, haowei(10), kh(10, 10) As Integer Public kemu As String 10: '读取答题卡信息点作标 Dim fileso As New Scripting.FileSystemObject Dim ts As TextStream Set ts = fileso.OpenTextFile("\\teacher\记录$\a卡zuobiao.txt", ForReading, 1) '识别a 卡 X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then GoTo 100 '如果是b卡则专到100执行 '识别科目 X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then kemu = "综文" X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then kemu = "数学" X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then kemu = "外语" X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then kemu = "理综" '识别10位考号 For i = 0 To 10 For j = 0 To 10 X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then haowei(i) = j Next j Next i For i = 0 To 10 kaohao = kaohao & haowei(i) Next '识别80道判断题 For i = 1 To 80 X = ts.ReadLine Y = ts.ReadLine a(i) = GetPixel(a, X, Y) X = ts.ReadLine Y = ts.ReadLine b(i) = GetPixel(a, X, Y) X = ts.ReadLine Y = ts.ReadLine c(i) = GetPixel(a, X, Y) X = ts.ReadLine Y = ts.ReadLine d(i) = GetPixel(a, X, Y) If ti(i) = a(i) * 1 + b(i) * 2 + c(i) * 4 + d(i) * 8 Then fenshu = fenshu + 1 Next i 100: '识别b卡 Set ts = fileso.OpenTextFile("\\teacher\记录$\b卡zuobiao.txt", ForReading, 1) '识别b卡 X = ts.ReadLine Y = ts.ReadLine 'If GetPixel(a, x, y) = 0 Then GoTo 100 '如果是a卡则专到50执行 '识别科目 X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then kemu = "综文" X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then kemu = "数学" X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then kemu = "外语" X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then kemu = "理综" '识别10位考号 For i = 0 To 10 For j = 0 To 10 X = ts.ReadLine Y = ts.ReadLine If GetPixel(a, X, Y) = 0 Then haowei(i) = j Next j Next i For i = 0 To 10 kaohao = kaohao & haowei(i) Next '识别80道判断题 For i = 1 To 80 X = ts.ReadLine Y = ts.ReadLine a(i) = GetPixel(a, X, Y) X = ts.ReadLine Y = ts.ReadLine b(i) = GetPixel(a, X, Y) X = ts.ReadLine Y = ts.ReadLine c(i) = GetPixel(a, X, Y) X = ts.ReadLine Y = ts.ReadLine d(i) = GetPixel(a, X, Y) If ti(i) = a(i) * 1 + b(i) * 2 + c(i) * 4 + d(i) * 8 Then fenshu = fenshu + 1 Next i Set shuju = zhuce.OpenTextFile("\\teacher\记录$\fenshu.txt", ForAppending, True) shuju.WriteLine xingming shuju.WriteLine xuehao shuju.WriteLine fenshu shuju.WriteLine kemu If fenshu = 0 Then GoTo 500 '如果部分为0则专到结束 shuju.WriteLine "@@@@@@@@@@" GoTo 10 500: MsgBox "识别结束,请查看\\teacher\记录$\fenshu.txt" End Sub Private Sub Command7_Click() Dim a As Long Dim p As pointapi a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) 'GetCursorPos p 'Me.BackColor = GetPixel(a, p.X, p.Y) 'Command1.
Caption
= GetPixel(a, p.X, p.Y) For j = 1 To Int(Text6.Width / 22) For i = 1 To Int(Text6.Height / 22) X = i Y = j m = m + 1 'a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) 'GetCursorPos p If GetPixel(a, X, Y) > 0 Then Print " "; If GetPixel(a, X, Y) = 0 Then Print "a"; Print ""; ';If m > 15 Then Print: m = 0 Next i Print Next j 'Dim a As Long 'Dim p As pointapi 'Me.BackColor = GetPixel(a, p.X, p.Y) 'Command1.
Caption
= GetPixel(a, p.X, p.Y)
Label
1.
Caption
= X
Label
2.
Caption
= Y DeleteDC a End Sub Private Sub Command8_Click() End End Sub Private Sub Form_Load() Set Image1 = LoadPicture("c:\9.bmp") 'Shell "C:\WINDOWS\Pbrush.exe c:\9.bmp", 1 End Sub Private Sub Image1_Click() Dim a As Long Dim p As pointapi a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) GetCursorPos p Me.BackColor = GetPixel(a, p.X, p.Y) Command1.
Caption
= GetPixel(a, p.X, p.Y)
Label
1.
Caption
= p.X
Label
2.
Caption
= p.Y DeleteDC a Dim fileso As New Scripting.FileSystemObject Dim ts As TextStream Set ts = fileso.OpenTextFile("\\teacher\记录$\zuobiao.txt", ForAppending, 1) ts.Write " x:" ts.Write
Label
1.
Caption
For i = 0 To 5 - Len(
Label
1.
Caption
) ts.Write " " Next i ts.Write " y:" ts.Write
Label
2.
Caption
For i = 0 To 5 - Len(
Label
2.
Caption
) ts.Write " " Next i ts.WriteLine End Sub Private Sub Text1_DblClick() Cls Text6.Text = Text1.Text End Sub Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) Cls Text6.Text = Text1.Text Dim a As Long Dim p As pointapi a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) 'GetCursorPos p 'Me.BackColor = GetPixel(a, p.X, p.Y) 'Command1.
Caption
= GetPixel(a, p.X, p.Y) jc = Text6.Width / 16 ic = Text6.Height / 16 For j = 1 To Int(Text6.Width / jc) For i = 1 To Int(Text6.Height / ic) X = i Y = j m = m + 1 'a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) 'GetCursorPos p If GetPixel(a, X, Y) > 0 Then Print " "; If GetPixel(a, X, Y) = 0 Then Print "a"; Print ""; ';If m > 15 Then Print: m = 0 Next i Print Next j 'Dim a As Long 'Dim p As pointapi 'Me.BackColor = GetPixel(a, p.X, p.Y) 'Command1.
Caption
= GetPixel(a, p.X, p.Y)
Label
1.
Caption
= X
Label
2.
Caption
= Y DeleteDC a End Sub Private Sub Text6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim a As Long Dim p As pointapi a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) GetCursorPos p Me.BackColor = GetPixel(a, p.X, p.Y) Command1.
Caption
= GetPixel(a, p.X, p.Y) DeleteDC a End Sub Private Sub Text7_Change() Cls End Sub Private Sub Timer1_Timer() Dim a As Long Dim p As pointapi a = CreateDCA("DISPLAY", vbNullString, vbNullString, 0) GetCursorPos p Me.BackColor = GetPixel(a, p.X, p.Y) Command1.
Caption
= GetPixel(a, p.X, p.Y)
Label
1.
Caption
= p.X
Label
2.
Caption
= p.Y DeleteDC a 'SendKeys "你好" 'SendKeys "{enter}" ''Shell ("C:\显示桌面.scf") 'Shell "C:\WINDOWS\Pbrush.exe c:\3333.bmp", 1 'SendKeys ("%{F4}") 'SendKeys "a" End Sub Private Sub Timer2_Timer() 'SendKeys ("%{F4}") 'SendKeys ("%{f}") 'Timer2.Interval = 0 'SendKeys "你好" 'SendKeys "{enter}" ''Shell ("C:\显示桌面.scf") 'Shell "C:\WINDOWS\Pbrush.exe c:\3333.bmp", 1 'SendKeys ("%{F4}") 'Shell "C:\WINDOWS\Pbrush.exe c:\3333.bmp", 1 End Sub Private Sub Timer3_Timer() 'SendKeys ("{a}") Timer3.Interval = 0 End Sub Private Sub Timer4_Timer() 'SendKeys ("{tab}") 'SendKeys ("{单}") 'SendKeys ("{tab}") 'SendKeys ("{s}") 'SendKeys ("{y}") 'SendKeys ("{y}") 'SendKeys ("%{F4}") Timer4.Interval = 0 End Sub
看实例学VFP:复选框控件
看实例学VFP:复选框控件 时间:2009-03-24来源:编程入门网 作者:老马 在vfp基础教程-复选框一文中,已经给出了复选框控件的常用属性。这个控件的使用重点是对它的value属性值的判断上,另外也可以通过controlsource属性把它和表中的某个逻辑型字段绑定,同时也可以在它支持的click、interactiveChange等事件中进行编程。 本文是一个在复选框控件的interactiveChange事件中编程的小例子,运行时通过复选框的选择来控制
label
控件的文字大小及
颜色
变化,运行界面如下: 制作步骤: 一、新建表单,将其
caption
属性值设置为“编程入门网-复选框控件”,保存为“复选框控件.scx”。 二、向表单上添加一个
label
控件,
caption
属性值设为“编程入门网”,fontsize属性值设为10,AutoSize属性值设为.t.,Forecolor属性值设为“0,0,255”(rgb
颜色
) 三、向表单添加两个复选框控件,
caption
属性值依次设置为“增大字号”和“改变
颜色
”,其它属性值采用默认的。 四、添加事件代码: 1.复选框check1(“增大字号”)的interactiveChange事件: if this.value=1 thisform.
label
1.fontsize=18 else thisform.
label
1.fontsize=10 endif 2.复选框check2(“改变
颜色
”)的interactiveChange事件: if this.value=1 thisform.
label
1.forecolor=rgb(255,0,0) else thisform.
label
1.forecolor=rgb(0,0,255) endif
VB6.0 动态演示冒泡法过程.rar
VB6.0 动态演示冒泡法过程,冒泡法的使用平时也是很常见的,本源码演示数组的冒泡法排序,开始排序后,气泡的
颜色
有所变化。部分代码如下: Option Base 1 Dim b(5) As Shape '建立形状数组和标签数组 Dim a(5) As
Label
Private Sub Form_Activate() '窗体激活事件 Randomize For i = 1 To 5 '随机生成5个数 Set a(i) =
Label
1(i) Set b(i) = Shape1(i) a(i).Tag = Int(Rnd * 99) a(i).
Caption
= a(i).Tag b(i).Width = a(i).Tag * 5 150 '设置气泡大小 b(i).Left = 600 - b(i).Width / 2'设置气泡垂直对齐 Next i Command1(0).Enabled = True End Sub
1.
label
的基本操作,通过点击按钮Button改变
label
的属性
//实现一个点击按钮的方法,方法的行为用IBAction修饰,返回值为void -(IBAction)clikRedButton{ //获得
label
对象,操作UI
Label
的属性,实现
label
里面文字
颜色
的修改以及其他改变 self.
label
.textColor = [UIColor redColor]; //改变文本字体
颜色
self.la
C++ Builder
13,825
社区成员
102,679
社区内容
发帖
与我相关
我的任务
C++ Builder
C++ Builder相关内容讨论区
复制链接
扫一扫
分享
社区描述
C++ Builder相关内容讨论区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章