MFC常用小工具函式

2021-09-28 21:53:59 字數 1556 閱讀 4404

1、判斷檔案是否存在

bool isfileexist(cstring sfilename)

return true;

}

2、判斷目錄是否存在

bool clib_global::ispathexist(const cstring spathname)

findclose(hfind);

return rvalue;

}

3、從全檔案路徑中找到帶字尾的檔名

cstring clib_global::gettitlefilename(const cstring sfilename)

return ***t;

}

6、mfc判斷資料夾路徑是否存在以及建立資料夾的方法

pathisdirectory()  檢測路徑是否存在

createdirectioy() 建立資料夾

兩個函式需要使用shlwapi.h標頭檔案以及新增shlwapi.lib或shlwapi.dll 庫函式

7、平面座標下計算外包類

// summary: 平面座標系下的外包立方體,橫平豎直

class chcextent

void addpoint(const acgepoint3d& pt)

else

}void addextent(const chcextent& other) }

public:

bool m_bisempty;

acgepoint3d m_min;

acgepoint3d m_max;

};

8、判斷是否是數字

bool isnumber(cstring snumber)

int ndotcount = 0;

for (int i = 0; i < snumber.getlength(); i++)

if (ndotcount > 1)

return false;

return true;

}

9、刪除資料夾及其裡面的所有內容

void mydeletedirectory(cstring directory_path)   //刪除乙個資料夾下的所有內容

else

}}

10、clist設定水平拖動

void sethorizontalscroll()

} releasedc(dc);

}11 、利用分隔符分隔字串

//字串處理部分

void getstrarrayfromstring(tchar cseparator, cstringarray &satag, cstring ssource)

//允許最後以逗號或不以逗號結尾

int nlen = ssource.getlength();

if(npreindex+1}

python常用小工具

for i in range 32 image tensor2 image tensor1 0,i plt.imshow image tensor2 plt.show 比如 篩選列表中最後字元為 relu6 的元素 x for x in a if x 5 relu6 tmp 是pil影象 impor...

常用小工具使用

xshell支援右鍵貼上 工具 選項下 點選鍵盤和滑鼠,開啟鍵盤和滑鼠視窗,如圖 vim快捷鍵 set nu 取消行號 vim 檔案 n 開啟檔案並指定到第n行 n n向後向前跳轉 win10及雙屏快捷鍵 將當前屏切換到另乙個螢幕上。滑鼠點到你要切換的視窗,shift win 親測可用 alt ta...

測繪地理常用小工具

目前實現功能 座標 角度 弧度 換算求座標所在的高斯分帶 高斯正反算 大圓距離 計畫 序號 名稱描述 實現否1 基礎gis框架 外掛程式式,點線面繪製,儲存,屬性錄入 2最小凸包 3最短路徑 4緩衝區分析 5通視分析 6坡度分析 7淹沒分析 8tin生成和泰森多邊形 9統計分析 10座標 角度 弧度...