在Form_Load事件添加: '定位库文件路径 Data1.DatabaseName = App.Path + "\rtSet.mdb" Data1.RecordSource = "MySet" '设置背景色 Private Sub mnuBackColorSetting_Click() CommonDialog1.Flags = cdlCCFullOpen CommonDialog1.ShowColor On Error GoTo err Data1.Recordset.Edit err: If err.Number = 3021 Then Data1.Recordset.AddNew End If Data1.Recordset.Fields("backcolor") = CommonDialog1.Color Data1.Recordset.Update Text1.BackColor = CommonDialog1.Color End Sub '设置字体 Private Sub mnuFontSetting_Click() CommonDialog1.Flags = cdlCFEffects Or cdlCFBoth CommonDialog1.ShowFont On Error GoTo FontErr Data1.Recordset.Edit FontErr: If err.Number = 3021 Then Data1.Recordset.AddNew End If Data1.Recordset.Fields("fontsize") = CommonDialog1.FontSize Data1.Recordset.Fields("forecolor") = CommonDialog1.Color Data1.Recordset.Fields("fontname") = CommonDialog1.FontName Data1.Recordset.Update Text1.ForeColor = CommonDialog1.Color Text1.Font.Name = CommonDialog1.FontName Text1.Font.Size = CommonDialog1.FontSize '窗体的Activate事件 Private Sub Form_Activate() On Error Resume Next Text1.BackColor = Data1.Recordset.Fields("backcolor") Text1.Font.Size = Data1.Recordset.Fields("fontsize") Text1.ForeColor = Data1.Recordset.Fields("forecolor") Text1.Font.Name = Data1.Recordset.Fields("fontname") End Sub |