|
Hi all,
i m taking help of this article for printing in my application.
http://www.codeproject.com/KB/list/listprintdemo.aspx[^]
its working fine,there is only on problem if the Text of ListCtrl item is greater than the width of Rect,than the full text not displayed or not print.
i m already ask this problem to the author of article but he did not respond me, so please help me for this.
i m doing one thing i m extracting the long string in multiple parts according to Rect width and fit it to multiple lines,by this the full text is displayed and print but its only working for first page.
text not displyed on second or other pages.
if u have any other option please tell me.
please provide me any code or example for this.
please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
A long time ago I wrote this article http://www.codeproject.com/KB/printing/printlongtext.aspx[^] which splits a single string across multiple pages.
Its probably still ok. If you get stuck I may be able to help with replies. But its a last ditch thing for me as I dont get much spare time at work atm due to a heavy schedule.
I really shouldn't be replying atm as the Mrs is getting mad at me.
If you vote me down, my score will only get lower
|
|
|
|
|
Thanks alot, this article really helps me.
but you can only use single string.
in my application i m using a list control and print its.
initially how can i clculate the total number of pages,becuse string for diffrent list item if of diffrent length.
provide me any guiide or help for this.
thank in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
1. I try to print text with this macro _T("") 'UTF-8' with this code:
// use CQprint class codeproject;
CQPrint m_ocQPrint;
m_ocQPrint.Print(hFont,_T("محمد"),FORMAT_NORMAL);
but print bad-words - i found printing text out in CQPrint::Print function & with this code:
// now print the text...
m_DC.TextOut(lx,m_y,strSubText);
if (!(Format & FORMAT_NOLF)) {
m_y += Size.cy + CALCY(m_Abstand);
}
if can soulve the problem with 'DrawText' Api Function ???
what's the solution ?
/////////////////////////////////////////////////////////////
2. I want print bitmap file & have problem then wrote this function
// Print path of bitmap file.
int CQPrint::InsertBitmap (CString StringPath, int ResColor, int fmt, CSize *dest, int left)
this is same InsertBitmap orginal function but change :
this part: ------
// load the bitmap from the resource
if (bmp.LoadBitmap (resbit) == 0) {
m_LastErrNo = PRERR_LOADBITMAPFAILED;
return (-1);
}
to: ------
if (StringPath.IsEmpty())
StringPath = "chart.bmp";
HBITMAP m_hBmp = ( HBITMAP )LoadImage( 0, StringPath, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION);
bmp.Attach(m_hBmp);
it't work but picture print tall, then change size to:
CSize size[1];
size[0].cx = 1600;
size[0].cy = 77;
m_ocQPrint.InsertBitmap("chart.bmp", IDB_BITMAP__CHART, FORMAT_CENTER, size);
but now a little stretch, what's the solution ?
/////////////////////////////////////////////////////////////
thanks.
|
|
|
|
|
1:i made a constructor in class (at c++ )
cart(char a[2]){a[2]=('p','a','q');
cout << a[0]<<a[1]<<a[2];};
and i call it in main function like this:cart x;
i have this error in this line :cart x;
error C2512: 'cart' : no appropriate default constructor available.
2:i made some function in my class(c++)like this:
char left()
{
char a[2];
swap(a[0],a[1]);
for (int b=1;b>=2;b++)
cout << a[b];
return 'L';
};
but it didn't swap 2 char.and this function didn't use that variable in my constructor (char a[2]).
i hope can explain well.
|
|
|
|
|
arad.moradi wrote: 1:i made a constructor in class (at c++ )
cart(char a[2]){a[2]=('p','a','q');
cout << a[0]<<a[1]<<a[2];};
and i call it in main function like this:cart x;
i have this error in this line :cart x;
error C2512: 'cart' : no appropriate default constructor available.
Well the message is clear: you have to provide a default contructor (i.e. a constructor without arguments). If you don't supply any constructor then the compiler generates a default one for you, but that's not the case since you have provided a constructor accepting an argument.
arad.moradi wrote: char left()
{
char a[2];
swap(a[0],a[1]);
for (int b=1;b>=2;b++)
cout << a[b];
return 'L';
};
but it didn't swap 2 char.and this function didn't use that variable in my constructor (char a[2]).
i hope can explain well
Here you are swapping elements 0 and 1 of an (uninitialized) array and then printing
the elements 1 , 2 of it (going out of bounds).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Additionally to that, this cycle will never run:
for(int b=1;b>=2;b++)
cout << a[b];
Since he initializes b to 1 and then checks if it is greater or equal to 2, which it is obviously not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hello,
My question is simple, which library is 'the best' for handling XML & XPATH in C++.
- I have tried Xerces (+Xalan,cause Xerces does not supports XPath apparently),but the problem is that Xalan is not maintained as Xerces (I am on VC 9.0) and the Xerces implementation is mostly static.Moreover,I feel Xerces quite too complicated and causing memory leaks.
- MSXSML is not my best choice cause I don't want to depend on a COM.
- Tiny XML/Tiny XPath seems to be ok,but there is not XSD validation on TinyXML.
- I have seen two other libraries : LibXML & Expat,but I don't know.
Any advice would be greatly appreciated.
Thank you in advance.
Regards.
Nassim
PS: I don't mind about portability for the moment
|
|
|
|
|
|
I have seen Arabica,seems to be a top layer for expat?!
Have you got an opinion on the ease of use,the stability,the compliance?
Thank you.
|
|
|
|
|
If portability is not a issue why don't you want to depend on COM ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I don't want to depend on COM because :
- I don't know the future of MSXML and more generally COM on Windows 7
- I am not sure that my app will run on a computer that has it installed,and I don't want to include the installation of MSXML on my setup (admin rights...)
Thank you.
|
|
|
|
|
ntnass wrote: - I don't know the future of MSXML and more generally COM on Windows 7
I bet (just) a bunch of euros that Windows 7 will be still full of COM.
ntnass wrote: - I am not sure that my app will run on a computer that has it installed,and I don't want to include the installation of MSXML on my setup (admin rights...)
I know this feeling. Best wishes with the chosen library.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Ok,I am also pretty sure that Window 7 will support COM
The main problem is the possible install of MSXML (I already had the problem on a customer machine).Moreover,as I know,MSXML does only support XSLT 1.0,and if I need to use XSLT 2.0,I will be in trouble...
|
|
|
|
|
COM is not going anywhere, half the bloody OS is based on it.
Steve
|
|
|
|
|
Go for libxml - I've used it and it's fast and reliable.
|
|
|
|
|
Stuart,
thank you for your reply.
I have seen that libxml is a C library.But I also seen that a C++ binding exists.Have you tried it?As I can see,It require GTKMM library (or only a small subset,for ustring class),seems to be too much for me
Anyway,what do you think about LibXML vs Expat?
Than you in advance.
Regards.
modified on Saturday, January 31, 2009 6:18 AM
|
|
|
|
|
Ok,
I think that I made my choice : LibXML++
It can be usefull that I explain :
- Xerces/Xalan : Not maintained in the same way, static, leaks...
- TinyXML/TinyXPath : No XSD validation
- MSXML : COM,no support for XPath 2.0
- Arabica : Seemed to be ok, but finally : "provides uniform SAX2 wrappers for the Expat parser, Xerces, Libxml2 and, on Windows, for the Microsoft XML parser",so,not fully standalone.Moreover,as I am lazy,I have seen that the compilation gives only static libraries (not good for me).
- LibXML++: Installation is a bit "crappy", cause need glib & glibmm.But seems to be more standalone.
Thank you all,hope that I made the right choice
Regards.
|
|
|
|
|
Hehe,
after playing a bit with LibXML & LibXMl++,I have to say that it is incomplete.
First,the LibXML++ lacks of some functionalities,so I need to call the base C LibXML instead.Anyway,this is not the main problem.Apperently,LibXML has an incomplete support for XSD schemas,so that's not ok for me.
I will have a deeper look on Arabica right now,even if it uses MSXML (by default) on windows,but anyway it is portable,so even if it is not my priority it is better.
Update : I tried Arabica, but first bad impression : If I try to parse a document that does not exists,no error is reported.Moreover, XSD does not seams to be supported....I am lost....Xerces/Xalan or MSXML are much more complete I have to recognize.
modified on Saturday, January 31, 2009 10:43 AM
|
|
|
|
|
I want to avoid focus to a CEdit control when some condition met at runtime by setting tabstop to false.
How to do this programmatically?
|
|
|
|
|
Even if you did that, setting focus via the mouse would still be possible. Why not just disable the control?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
If I disable the edit control, the control is not painted correctly.
It is painted with text in someother edit control or someother part of my form view.
Before solving this problem, I wanted temporary fix by avoiding focus or something else.
Thanks,
Sabapathy
The problem was inside OnCtlColor() where I was doing some coloring with form control.
It is fixed. Thanks..
modified on Saturday, January 31, 2009 9:26 AM
|
|
|
|
|
editctrl.ModifyStyle ( WS_TABSTOP, 0 );
|
|
|
|
|
Hi,
Are there functions available in the windows api that will paint windows controls to a certain rectangle using GDI. Something similar to the ControlPaint class in .NET. If there are, can someone point me to the documentation that details how to use them.
Thanks
Steve
|
|
|
|
|
If the control handles WM_PRINTCLIENT , you can send it that message to have it paint into a DC.
|
|
|
|
|