当前位置: 首页>>代码示例>>C++>>正文


C++ CsvReader::getHeadRow方法代码示例

本文整理汇总了C++中CsvReader::getHeadRow方法的典型用法代码示例。如果您正苦于以下问题:C++ CsvReader::getHeadRow方法的具体用法?C++ CsvReader::getHeadRow怎么用?C++ CsvReader::getHeadRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CsvReader的用法示例。


在下文中一共展示了CsvReader::getHeadRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OpenDialog

//Display the openfile common dialog
BOOL OpenDialog(HWND hwnd){
	OPENFILENAME ofn;
	TCHAR szFile[MAX_PATH];


	ZeroMemory(&ofn, sizeof(ofn));
	ofn.lStructSize = sizeof(ofn);
	ofn.lpstrFile = szFile;
	ofn.lpstrFile[0] = '\0';
	ofn.hwndOwner = hwnd;
	ofn.nMaxFile = sizeof(szFile);
	ofn.lpstrFilter = TEXT("EXCEL csv files(*.csv)\0*.csv\0");
	ofn.nFilterIndex = 1;
	ofn.lpstrInitialDir = NULL;
	ofn.lpstrFileTitle = NULL;
	ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
	wstring s1, s2;
	if (GetOpenFileName(&ofn)){
		s1 += L"正在打开:";
		s2 += ofn.lpstrFile;
		s1 += s2;
		SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 1, (LPARAM)s1.c_str());
		LoadCSV(ofn.lpstrFile);
	}
	std::wostringstream s;
	s << L"已经打开了" << s2 << "     " << L"共读取了" << csvReader.getRowCount() << L"条";
	wstring r(s.str());
	SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 0, (LPARAM)L"编辑中");
	SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 1, (LPARAM)r.c_str());
	SetScrollRange(hwnd, SB_VERT, 0, csvReader.getRowCount(), FALSE);
	const int columnCount = csvReader.getHeadRow()->getColumnSize();
	
	HMENU hmRand = GetSubMenu(hMenu, 1);
	assert(hmRand != NULL);
	for (int i = 0; i < columnCount; i++){
		wstring s(L"以“");
		s += csvReader.getHeadRow()->getColumn(i);
		s += L"”随机排序";
		AppendMenu(hmRand, MF_STRING, IDM_RANDOMSORT_ITEM_1 + i,s.c_str());
	}
	SetMenu(hWnd, hMenu);
	GetSystemMenu(hWnd, TRUE);
	return TRUE;

}
开发者ID:bugparty,项目名称:win32RandomList,代码行数:46,代码来源:Win32RandonList.cpp

示例2: WndProc


//.........这里部分代码省略.........
		SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)hStatusbar);
		InitStatusbar(hStatusbar);
		// Add 4 Header items
		
		for (UINT i = 0; i < 4; i++)
		{
			HDITEM hdi = { 0 };
			hdi.mask = HDI_WIDTH | HDI_FORMAT | HDI_TEXT;
			hdi.cxy = rc.right / 4;
			hdi.fmt = HDF_CENTER;
			swprintf_s(szText, 200, L"Header  %d", i);
			hdi.pszText = szText;
			hdi.cchTextMax = 200;

			SendMessage(hHeader, HDM_INSERTITEM, i, (LPARAM)&hdi);
		}

	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		// TODO: Add any drawing code here...
		TCHAR buffer[20];
		s += L"Text Height";
		wsprintf(buffer, L"%d ", cyChar);
		s.append(buffer);

		s += L" Text Width";
		wsprintf(buffer, L"%d ", cxChar);
		s += buffer;
		
		//TextOut(hdc, 0, 20, s.c_str(), s.length());

		if (csvReader.isOpened()){
			
			const int columnCount = csvReader.getHeadRow()->getColumnSize();
			wstring *heads = new wstring[columnCount];
			
			for (int i = 0; i < columnCount; i++){

				heads[i].append(csvReader.getHeadRow()->getColumn(i));
			}

			TextOut(hdc, 0, 0, (LPWSTR)csvReader.getHeader(), lstrlen(csvReader.getHeader()));


			int curStart = 0;
			EditRow *per;
			int count;
			curStart = iScollPos;
			int end = curStart + cyClient / cyChar;
			for (int i = curStart ; i < end; i++){
				
				csvReader.getRow(i,&per);
				count = per->getColumnSize();
				int j;
				for (j = 0; j < count-1; j++){
					TextOut(hdc, j*COLUMN_WIDTH, (i-curStart + 1)*cyChar, per->getColumn(j),lstrlen(per->getColumn(j)));
				}
				wstring sTailRow(per->getColumn(j));
				int fpos = -1;
				if (fpos = sTailRow.find(_T("\n"))){
					sTailRow.erase(fpos, 2);
				}
				TextOut(hdc, j*COLUMN_WIDTH, (i - curStart + 1)*cyChar,
					sTailRow.c_str(),
					sTailRow.length());
				
开发者ID:bugparty,项目名称:win32RandomList,代码行数:66,代码来源:Win32RandonList.cpp


注:本文中的CsvReader::getHeadRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。