2014-01-08 25 views
0

我一直在VFP的WPF遷移project.While轉換代碼遇到foxpro代碼中的「foxtools.fll」。我搜索了很多谷歌。 任何人都可以告訴我使用foxtools.fll嗎?我們如何在C#中使用它們?如何在Winforms中使用foxtools.fll?

+0

不知道你是否已經發現這個或者它是否有幫助http://www.foxtools.com/foxtoolsfll-help-file – Coops

+0

我已經引用這個鏈接了。 –

回答

0

我相信很多這些元素在C#中已經在某種程度上已經可用了。你可能想要做的是創建你自己的C#靜態類,並使用與它們在VFP中相同的名稱引用的函數,然後使用與從VFP相同的參數進行調用,但是基於C#處理...類似於

public static class FoxTools 
{ 
    // since DriveType is a class, changed method to GetDriveType 
    public static DriveType GetDriveType(string DriveLetterToTest) 
    { 
     Sample code to detect drive types 
     http://stackoverflow.com/questions/4396634/how-can-i-determine-if-a-given-drive-letter-is-a-local-mapped-usb-drive/4396692#4396692 
    } 

    public static string DefaultExt(string ThisFileName, string TryThisExt) 
    { 
     if(Path.GetExtension(ThisFileName).Length > 0 
      return ThisFileName; 

     return ThisFileName + TryThisExt; 
    } 

    public static string ForceExt(string ThisFileName, string ForceThisExt) 
    { 
     return Path.GetFileNameWithoutExtension(ThisFileName) + ForceThisExt; 
    } 

    public static string ForcePath(string ThisFileName, string ForceThisPath) 
    { 
     return ForceThisPath + Path.GetFileName(ThisFileName); 
    } 

    // many others simple to get to, looking at the "Path." object reference for things 
    // associated with file names, paths, extensions, etc.. 


} 

請注意,您不必執行每個函數,只是您實際上使用FoxTools.fll的那些函數。在C#中編寫一段時間之後,在很多情況下,找到VFP調用的C#等價物變得更容易。有時候更容易,有時候更多的努力,但仍然可行。

相關問題