|
Here is a library for for drawing different bar-codes [^]. You can use the Draw function for both - drawing on the screen and printing. You just have to give the proper DC to this function.
|
|
|
|
|
Hi,
I am able to print Bitmap Images in ListBox using
HBITMAP hbmp = (HBITMAP)LoadImage(hInstTemp,Image, IMAGE_BITMAP, PicSizeX, PicSizeY,LR_LOADFROMFILE )
I want to print JPEG images in ListBox.for Bitmaps we should use "IMAGE_BITMAP" flag. There is no specific flag for JPEG.What I should use?
Rekha.
|
|
|
|
|
I think LoadImage will not load JPEG images it only supports BMP.
Try using CImage[^]class for other file types.
Regards,
Sandip.
|
|
|
|
|
Print the jpg or bmp is not different you only need to a handle to these files for bmp files you can us of LoadImage but for jpg files you can use of CImage class or GDI+ after get it you can use of StartDoc/StartPage.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi,
can you guide me how to use CImage class for JPG files.
Rekha.
|
|
|
|
|
|
Hi Chandrasekharanp,
The link which you have sent is to display icons or bitmaps. I know how to Display Bitmaps.But my problem is with JPEG Images which I have mentioned in my Query.
Can anyone suggest me how to use CImage.I am new to MFC.
|
|
|
|
|
Did you look at the link i provided?? It shows the members of CImage.
you can use Load method to load the JPEG files. After you load the bitmap using CImage object you can get HBITMAP. After you get HBITMAP you know what you have to do
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
It's simple:
CImage m;
m.Load(_T("c:\\1.jgp"));
HBITMAP hbitmap=m.Detach(); it returns a hbitmap
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi,
Thanks for your reply. I am able to display JPEG images.
|
|
|
|
|
If it was helpful you can give me 5 vote.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I cannot calculate the exact number of pages to be printed in advance, so I do not call SetMaxPage in OnBeginPrinting(). In this case only 1 page is printed.
I tried setting it to maximum(0xFFFF), but still it prints only 1 page. The data(sample) to be printed is clearly more than 5 pages.
How do I continue with this?
Is setting max page mandatory for printing more than 1 page?
Thanks in Advance..
|
|
|
|
|
The documentation says something about using the m_bContinuePrinting member if the max. page is not known.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks superman..
I always use documentation. but in this case I totally forgot it.
|
|
|
|
|
Hi all,
I have an edit box,i want to handle space key in this edit box in following manner.
i want space not allowed at strating point and ending point of editbox.
while if i press space in midle of edit box than its working.
i m try this.
but there is one problem when i press space key at end than the cursor moves to strat of edit box.
void Ctest::OnEnChangeEdit1()
{
CString str;
GetDlgItemText(IDC_EDIT1,str);
if(str.Mid(0,1)==' ')
{
SetDlgItemText(IDC_EDIT1,str.TrimLeft());
}
int length=str.GetLength();
length=length--;
if(str.Mid(length,1)==' ')
{
SetDlgItemText(IDC_EDIT1,str.TrimRight());
}
}
please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
modified on Thursday, February 19, 2009 4:20 AM
|
|
|
|
|
Handle the EN_UPDATE notification in the parent dialog box.
The notification is sent in the form of a WM_COMMAND message.
In this handler, the edit box text can be retrieved and manipulated.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Another thing you can do is to let the user type the space key and then use Trim() function once you acquire the data from your edit box. I think you are more interested in getting the string without the spaces, than not to allow the user to enter spaces.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
If you just want the string without spaces in the staring and ending, then you can use the CString::TrimLeft and CString::TrimRight.
But if you need to prevent it from entering itself, then you need to map the EN_CHANGE and watch the input and filter it. This might be simple.
See also this[^].
- ns ami -
|
|
|
|
|
ns ami wrote: See also this[^].
there is nothing like that is i want.
please tell me use of CString::TrimLeft and CString::TrimRight.
can u please explain me with any example.
thanks.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
i m try this.
but there is one problem when i press space key at end than the cursor moves to strat of edit box.
<br />
void Ctest::OnEnChangeEdit1()<br />
{<br />
CString str;<br />
<br />
GetDlgItemText(IDC_EDIT1,str);<br />
<br />
if(str.Mid(0,1)==' ')<br />
{<br />
SetDlgItemText(IDC_EDIT1,str.TrimLeft()); <br />
}<br />
int length=str.GetLength();<br />
<br />
length=length--;<br />
<br />
if(str.Mid(length,1)==' ')<br />
{<br />
SetDlgItemText(IDC_EDIT1,str.TrimRight()); <br />
} <br />
}<br />
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
To move the cursor use
edit.SetSel( nPos, nPos )
- ns ami -
|
|
|
|
|
"_$h@nky_" wrote: please tell me use of CString::TrimLeft and CString::TrimRight.
can u please explain me with any example.
Well...
CString csStr = _T( " Some text with spaces... " );
csStr.TrimLeft();
csStr.TrimRight();
Have a look at MSDN also...
- ns ami -
|
|
|
|
|
ns ami wrote: CString csStr = _T( " Some text with spaces... " );csStr.TrimLeft(); // Result: "Some text with spaces... " csStr.TrimRight(); // Result: "Some text with spaces..."
I know this, i want to use it when i press any key on edit box.
i want to prevent press sapce key at strting and end.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
The idea of using TrimLeft/Right is that you can then let the user enter spaces if she like. Later, when you get the text from the edit box for use, you can just throw the spaces away.
It's a choise. Trimming later will be less confusing for the user, and less work for you.
I know if I wanted to enter text in a box, and my keyboard suddenly looked like it stopped working, I would be concerned...
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
m try this.
but there is one problem when i press space key at end than the cursor moves to strat of edit box.
void Ctest::OnEnChangeEdit1()
{
CString str;
GetDlgItemText(IDC_EDIT1,str);
if(str.Mid(0,1)==' ')
{
SetDlgItemText(IDC_EDIT1,str.TrimLeft());
}
int length=str.GetLength();
length=length--;
if(str.Mid(length,1)==' ')
{
SetDlgItemText(IDC_EDIT1,str.TrimRight());
}
}
please tell me now what can i do.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|