获取style里元素的值

char* styleVal="position:absolute;left:111;top:0;height:315;width:1760;";

CString strVal(styleVal);

CString Ele(_T("left:"));

int n=QueryValOfStyleEle(strVal,Ele);

int QueryValOfStyleEle(CString &src,const CString &ele)
{
int n=src.Find(ele);
CString out=src.Right(src.GetLength()-n);
n=out.Find(_T(":"));
out=out.Right(out.GetLength()-n-1);
n=out.Find(_T(";"));
out=out.Left(n);
n=_ttoi(out.GetBuffer());
return n;
}

猜你喜欢

转载自www.cnblogs.com/mengjiulong/p/9118700.html
今日推荐