font: 
With CommonDialog1
        .DialogTitle = "Select Font"
        .Flags = cdlCFScreenFonts
        .ShowFont
        optThumb(i).fontsize=.fonsize
        optThumb(i).fontbold=.fontbold
        optThumb(i).fontname=.fontname
End With一关闭窗体,才变的字体就没了.怎么保存字体formpicture:Private Sub mnuFormPicture_Click()
   
 On Error GoTo ErrHandler
     
     CommonDialog1.Filter = "All Files (*.*)|*.*|Picture Files (*.jpg,*.bmp,*.gif)|*.jpg;*.bmp;*.gif|Jpg Files (*.jpg)|*.jpg"
     
     CommonDialog1.FilterIndex = 3
     
     CommonDialog1.ShowOpen
     
     frmTableManager.Picture = LoadPicture(CommonDialog1.FileName)
     
     Exit Sub
ErrHandler:
     Exit SubEnd Sub    If oRs.RecordCount > 0 Then
        For i = 1 To oRs.RecordCount
           xpCombo1.ItemsAdd oRs!TableGroupName
           oRs.MoveNext
        Next
    End If
    
    For i = 1 To oRs.RecordCount
        sFormPicture(i) = oIni.ReadKey("Retail", "FormPicture" & Val(i))
        If sFormPicture(i) = "NOT EXIST" Then
           sFormPicture(i) = "0"
           oIni.WriteKey "Retail", "FormPicture" & Val(i), "0"
        End If
    Next i我现在是用INI控制,不能在窗体就能改变和保存FORM的图片.

解决方案 »

  1.   

    你需要把字体的名称和大小写到硬盘的某个地方保存
    比如:注册表,INI文件.TXT文件,EXCEL文件,或ACCESS数据库,或注册表
    然后下次打开你的程序的时候读出来使用
    图片可以写到数据库中或只保存它的位置
      

  2.   

    用INI或TXT文件做配置,启动时加载最省事,对话框选择字体后要先更新INI或TXT文件,然后再加载
      

  3.   

    我现在是写在INI中,但是INI是开始的时候读的,在运行过程中,要修改字体SIZE,那么INI要怎么改?
      

  4.   


    刘哥,选择字体后,INI要怎么才能更新?
      

  5.   

    那你就要问"运行中怎么修改INI"
    修改INI在VB的安装盘里有个"日积月累"的示例可以参考
      

  6.   

     Private strINI As String
      'Windows API Declares
      Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
      (ByVal lpApplicationName As String, _
      ByVal lpKeyName As Any, _
      ByVal lpString As Any, _
      ByVal lpFileName As String) As Long  Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
      (ByVal lpApplicationName As String, _
      ByVal lpKeyName As Any, ByVal lpDefault As String, _
      ByVal lpReturnedString As String, _
      ByVal nSize As Long, _
      ByVal lpFileName As String) As Long  Private Function MakePath(ByVal strDrv As String, ByVal strDir As String) As String  ' Makes an INI file: Guarantees a sub dir
      Do While Right$(strDrv, 1) = "\"
      strDrv = Left$(strDrv, Len(strDrv) - 1)
      Loop  Do While Left$(strDir, 1) = "\"
      strDir = Mid$(strDir, 2)
      Loop  ' Return the path
      MakePath = strDrv & "\" & strDir
      End Function  Private Sub CreateIni(strDrv As String, strDir As String)
      ' Make a new ini file
      strINI = MakePath(strDrv, strDir)
      End Sub  Public Sub WriteIniKey(strSection As String, strKey As String, strValue As String)
      ' Write to strINI
      WritePrivateProfileString strSection, strKey, strValue, strINI
      End Sub  Public Function GetIniKey(strSection As String, strKey As String) As String
      Dim strTmp As String
      Dim lngRet As String
      Dim i As Integer
      Dim strTmp2 As String  strTmp = String$(1024, Chr(32))
      lngRet = GetPrivateProfileString(strSection, strKey, "", strTmp, Len(strTmp), strINI)
      strTmp = Trim(strTmp)
    strTmp2 = ""
      For i = 1 To Len(strTmp)
      If Asc(Mid(strTmp, i, 1)) <> 0 Then
      strTmp2 = strTmp2 + Mid(strTmp, i, 1)
      End If
      Next i
      strTmp = strTmp2  GetIniKey = strTmp
      End Function  Public Property Let INIFileName(ByVal New_IniPath As String)
      ' Sets the new ini path
      strINI = New_IniPath
      End Property  Public Property Get INIFileName() As String
      ' Returns the current ini path
      INIFileName = strINI
      End Property  '***************************************清除KeyWord"键"(Sub)********
      Public Function DelIniKey(ByVal SectionName As String, ByVal KeyWord As String)
      Dim RetVal As Integer
      RetVal = WritePrivateProfileString(SectionName, KeyWord, 0&, strINI)
      End Function  '如果是清除section就少写一个Key多一个""。
      '**************************************清除 Section"段"(Sub)********
      Public Function DelIniSec(ByVal SectionName As String) '清除section
      Dim RetVal As Integer
       RetVal = WritePrivateProfileString(SectionName, 0&, "", strINI)
      End Function
      
      '调用
      Dim commIni As New IniCLs
      commIni.INIFileName = App.Path & "\configini.ini" 
      CommIni.WriteIniKey "system", "xxx", "值"    '写
      CommIni.GetIniKey("system", "xxx")           '读
      

  7.   

    同意上面幾樓的,通過INI設置與讀取參數比較簡單與靈活。上面幾樓代碼都有,我就幫頂一下得了。
      

  8.   

    怎么在字体窗体选择字体之后,更新下INI中字体的类型。