|
OK thanks, this looks like something i needed.
|
|
|
|
|
I did it, it works now, thank you.
|
|
|
|
|
nave
|
|
|
|
|
Naveen R wrote: I never said to create another CPaintDC below the CButton::OnPaint();
Yes, but it is what should be used in OnPaint messages.
CClientDC associated with whole client area of window, as opposed to CPaintDC which is associated to invalidated rect only.
So consider how logical is it to use CClientDC there.
BTW,havn't you come across this line whenever added WM_PAINT message handler throught class wizard ?
// Do not call CButton::OnPaint() for painting messages
|
|
|
|
|
Igor Jerosimic wrote: OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
As told by Navin, you need to do all drawing stuff in case of owner drawn controls.
And should not call base version, as this function is supposed to override in derived control.
|
|
|
|
|
Have you see this?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
WhiteSky wrote: See A Better Bitmap Button Class[^] if helpfuls
i liked it sometime before
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Re
|
|
|
|
|
|
CImageButton class is very lousy way of replacing API function DrawFrameControl and i definitely don't need that...
All that code is easily replaced with these 4 lines of code:
CPaintDC dc(this);
CRect rc;
GetClientRect(&rc);
dc.DrawFrameControl(&rc, DFC_BUTTON, DFCS_BUTTONPUSH);
http://img214.imageshack.us/img214/6206/drawingfx6.png
|
|
|
|
|
Hello,
I have the following situation:
Input is char *buf (which is the content of a web page).
I have the following code
char v; <br />
for (i=0; i<strlen(buf); i++)<br />
{<br />
v = buf[i]; <br />
}
I get a negative v if the page has Greek characters I get negative values for v. Something like v=-50. Is there any method to get the character behind -50 ?
Thanks.
|
|
|
|
|
Sounds like you should be scraping the content of the page as Unicode (wide chars, wchar_t ) instead of ANSI (narrow chars, char ).
The standard ASCII table, which you are really using like-it-or-not when dealing with char types, does not have a lot of extended characters in it, and the ones it has can be treated differently by different systems. For example, -50 is 0xCE , which can be Î or ╬ , or some other character...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks for the reply. The whole application is developed around ANSI and changing everyting looks like not such a good idea. I was wandering if there is any mechanism to determine the “real character” behind -50. If I know that the real character is a greek character I can convert it into a html entity for example and I can get something like %u03C.
|
|
|
|
|
I dont know you checked my post or not...but this will work..isnt it?
CString cstext = L"03C5";
wchar_t Greek;
int nChar;
swscanf( cstext, L"%x", &nChar );
Greek = nChar;
nave
|
|
|
|
|
I did . Thanks.
I do not use CString (not using MFC). Your solution works but I am trying to find a way to determine if there is a possible to find our which Greek character is assigned to -50 (if there is such a possibility).
|
|
|
|
|
why cant you try printing it out to console..?
wprintf( L"%c", pGreek );
nave
|
|
|
|
|
I did.
printf("%c\n", c);
wprintf( L"%c", c );
Both print the same character which is not the correct one ┼ (this is printed instead of Π)
|
|
|
|
|
micutzu wrote: wprintf( L"%c", c );
if 'c' is of type wchar_t then you must specify like this.
wprintf( L"%c", &c );
nave
|
|
|
|
|
micutzu wrote: but I am trying to find a way to determine if there is a possible to find our which Greek character is assigned to -50 (if there is such a possibility).
That entirely depends on the text encoding. Which charset is the webpage you are working with? If it is Windows CP 1253 (Greek), you can find out by setting the codepage of your console window to 1253 and then printing it out. For -50 (ie 206 in unsigned form) it should be greek capital XI: Ξ
|
|
|
|
|
Naveen R wrote: CString cstext = L"03C5";
naveen, be careful, write this :
CStringW cstext = L"03C5"; or
CString cstext = _T("03C5"); but don't mix the two styles.
apparently, you're using wide characters in all the rest of your code, so i'd say use the former...
|
|
|
|
|
but CString have both constructors
CString(LPCWSTR lpsz)
CString(LPCSTR lpsz)
Any way I did so because he said( in his previous post) his project is UNICODE define...
nave
|
|
|
|
|
Naveen R wrote: but CString have both constructors
this is not acceptable argument, because, if the application is not defining UNICODE macro, even if you initialize your CString with a LPCWSTR, the string will be casted into ANSI string.
BTW, i doubt of this information. actually, CString gets a LPCTSTR, which is transformed into LPCSTR or LPCWSTR depending on unicode definition
Naveen R wrote: Any way I did so because he said( in his previous post) his project is UNICODE define...
yes, but then prefer using CStringW. imagine the case when someone else has to maintain the application, or develop the dual possibility of having the application running both ansi and unicode... your code must be flexible, not only "aware"
|
|
|
|
|
toxcct wrote: if the application is not defining UNICODE macro, even if you initialize your CString with a LPCWSTR, the string will be casted into ANSI string.
Even if UNICODE is defined, I am expecting only ANSI characters in that statement.
toxcct wrote: yes, but then prefer using CStringW
Whats is this CStringW? I didnt find any such class in vc6. I havent worked in later verions of visual studio. Is it a new class added to the MFC in later verions of visual studio?
nave
|
|
|
|
|
char is a signed data type.
You have to use unsigned char in order to get the character values above 127 (decimal) right, such as:
unsigned char v;
for (i=0; i {
v = (unsigned char) buf[i];
}
There is a compiler option (/J ?) that defaults char to be unsigned.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
If you just want char to be unsigned, set the compiler option /J.
|
|
|
|