I need to layout a listview content as a table to a printer using PrintDlg. Is there som开发者_JS百科e simple way to do this using only WinAPI without any classes? Pure WinAPI and C.
I won't guarantee it'll work, but you could try sending WM_PRINTCLIENT to the list view control. You pass the printer DC as the wparam and set the appropriate flags in the lparam. Not all controls implement WM_PRINTCLIENT, but it's worth a shot to see if it meets your needs.
If it doesn't work or if it doesn't meet your needs, you'll have to do a lot of work to print the contents yourself. It's not particularly hard, but it would be a bit of code to measure everything in the printer context, select appropriate fonts and colors, format the table, etc.
精彩评论