企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
<p><strong><span style="font-size:16px;">BackColor 属性</span></strong></p> <p><span style="line-height:1.78571;">返回或设置一指示对象的背景颜色</span></p> <p><span></span></p> <p class="label"><b>语法</b></p> <p><span class="emp"><i>object</i></span><b>.BackColor</b>&nbsp;[= <i>color</i>]</p> <p><b><span style="font-weight:700;">BackColor</span><span>&nbsp;</span></b>属性语法包含下面部分:<span></span></p> <table class="MsoNormalTable" border="1" cellpadding="0"><tbody><tr><td width="29%" valign="top"><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:宋体;">部分</span></b><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> <td width="71%" valign="top"><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:宋体;">描述</span></b><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> </tr> <tr><td width="29%" valign="top"><p class="MsoNormal"><span class="emp"><i><span style="font-size:9.0pt;">object</span></i></span><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> <td width="71%" valign="top"><p class="MsoNormal"><span style="font-size:9.0pt;"><span style="font-family:宋体;">对象表达式</span></span><span style="font-size:9.0pt;font-family:宋体;">,其值是</span><span style="font-size:9.0pt;">“</span><span style="font-size:9.0pt;font-family:宋体;">应用于</span><span style="font-size:9.0pt;">”</span><span style="font-size:9.0pt;font-family:宋体;">列表中的一个对象。</span><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> </tr> <tr><td width="29%" valign="top"><p class="MsoNormal"><span class="emp"><i><span style="font-size:9.0pt;">Value</span></i></span><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> <td width="71%" valign="top"><p class="MsoNormal"><span style="font-size:9.0pt;"><span style="font-family:宋体;"><span style="color:#2A2A2A;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;line-height:17.55px;">确定对象的背景或前景颜色的值或常量</span></span></span><span style="font-size:9.0pt;font-family:宋体;"></span><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> </tr> </tbody> </table> <p class="label"><b>说明</b></p> <p class="indent"><br /> </p> <p style="color:#2A2A2A;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;"><span class="">Access使用操作环境红-绿-蓝(RGB)配色方案。</span><i>颜色</i>的设置是:</p> <div class="tablediv" style="color:#000000;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;"><div class="contentTableWrapper"><table class="dtTABLE" style="border:1px solid #BBBBBB;"><tbody><tr><th width="29%" style="color:#636363;background-color:#EDEDED;">设置</th> <th width="71%" style="color:#636363;background-color:#EDEDED;">描述</th> </tr> <tr><td width="29%" style="color:#2A2A2A;">普通RGB颜色</td> <td width="71%" style="color:#2A2A2A;">通过使用“调色板”或通过在代码中使用<b>RGB</b>或<b>QBColor</b>功能指定的颜色。</td> </tr> <tr><td width="29%" style="color:#2A2A2A;">系统默认颜色</td> <td width="71%" style="color:#2A2A2A;">由对象浏览器中的VBA对象库中列出的系统颜色常量指定的颜色。Windows操作环境将根据控制面板设置中的指定来替代用户的选择。</td> </tr> </tbody> </table> </div> </div> <p style="color:#2A2A2A;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;">对于所有窗体和控件,设计时的默认设置为:</p> <ul style="color:#000000;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;"><li><b>BackColor</b>&nbsp;- 设置为由常量<b>vbWindowBackground</b>指定的系统默认颜色。</li> </ul> <p><br /> </p> <p style="color:#2A2A2A;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;">普通RGB颜色的有效范围为0到16777215(&HFFFFFF)。该范围内的数字的最低有效字节到最高有效字节分别确定红色,绿色和蓝色的数量。红色,绿色和蓝色分量各自由0到255(&HFF)之间的数字表示。</p> <p style="color:#2A2A2A;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;"><br /> </p> <p style="color:#2A2A2A;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;"><span class=""><span class="le" style="font-weight:700;color:#000000;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;line-height:23.2143px;">注意</span><span style="color:#000000;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;line-height:23.2143px;">&nbsp;&nbsp;&nbsp;&nbsp;“&nbsp;</span><span style="font-weight:700;color:#000000;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;line-height:23.2143px;">动画”</span><span style="color:#000000;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;line-height:23.2143px;">控件仅显示两种类型的AVI文件,未压缩或以RLE8格式压缩。用RLE8压缩的AVI文件只显示8位颜色。</span><br /> </span></p> <p style="color:#2A2A2A;font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;"><span class=""><br /> </span></p> <p><br /> </p> <p class="indent"><br /> </p> <p class="label" style="font-size:12px;">示例</p> <br /> <p><span style="line-height:1.78571;">先定义一个SetColor函数调用颜色选择器,再选择相关的颜色。</span></p> <pre class="prettyprint lang-vb">Public Function SetColor(ctl As Control) Dim lColor As Long lColor = Nz(ctl.Value, 0) ctl.SetFocus If CommonDialog.ChooseColor(lColor, Me.Hwnd) Then ctl.Text = lColor End If End Function </pre> <p><br /> </p> <p class="indent"><br /> </p> <pre class="prettyprint lang-vb">'修改树控件背景色 Private Sub TxtBackColor_AfterUpdate() TreeView0.BackColor = Nz(Me.TxtBackColor, 16777215) End Sub</pre>