|
I need to find out the width and height (in pixel/ in any logical unit) of a string.
I am using GetTextExtentPoint32() API to calculate the string size. But it is observed that the GetTextExtentPoint32() is giving me the different size , if execute my application on different language OS. After some analysis it is observed that font size and font face value is affecting the size of a string, so i have set the font face and font size to the DC.But still due to different CHARSET value available on different language OS i am getting different size of a string. Please let me know how to handle this issue, so that i can get same value of a string (string from any language) for different language OS.
I wrote the method as below:
LPSIZE lpSize = new SIZE () ;
void MyAPI( CString szLangStr , lpSize )
{
....
}
So the expected out put the width and height of szLangStr and which should be same for all the language OS.
|
|
|
|
|
Cannot you just be prepared to deal with different string sizes?
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]
|
|
|
|
|
pandit84 wrote: Please let me know how to handle this issue, so that i can get same value of a string (string from any language) for different language OS.
I really doubt if this is possible. There will be a lot of variation between fonts, and user preferences may come into it as well.
As noted in the previous reply, you're much better designing your app to handle different sizes of string.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Did you not just ask this same question 9 minutes ago?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Noooooo - he's asking about string width AND height now, not just width
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Fair comment.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi!
I'm trying to run MFC example from VS2005, and I get a lot of errors
Error 1 error C2039: 'GetInt' : is not a member of 'CMFC001App'
Error 2 error C3861: 'InitUserToolbars': identifier not found
Error 3 error C3861: 'DockPane': identifier not found
there are just a few first (of 50!), and I cant figure this out, because my simpler C++ programs run just fine.
thank you
|
|
|
|
|
Take a look at the code you posted
thanks
|
|
|
|
|
Where's your header file?
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 )
|
|
|
|
|
there are in the same folder as cpp files
C:\Users\XXX\Documents\Visual Studio 2008\Projects\MFC 001\MFC 001
if that's what you asked
|
|
|
|
|
No did you set it on your file(c++)?
#include "yourfile.h"
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 )
|
|
|
|
|
|
Hello,
After creating a child window I change the title of the window by SetWindowText() but as soon as I change the foucs to some other child window the title of the earlier window changes to the name of the program which would have appeared if I had not chaged te title of the window.
How should I maintain the canged title even if the focus is changed.
Prithaa
|
|
|
|
|
There is an undocumented function called OnUpdateFrameTitle in the CFrameWnd class.
Override it in your main frame class and set the title from withing the overload.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
|
hello,
I have created a indow with the command CreateNewChild().Can alter the size of the window immediately before displayed on the screen.
Pritaa
|
|
|
|
|
|
I need a simple example
Demonstration of the client-side connection service
|
|
|
|
|
can you please search codeproject before posting your question here!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Pardon sir, I've found it: CP itz thiz!!!! plz send me code plz plz!
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]
|
|
|
|
|
That's simple.
//CListenSocket头文件
class CListenSocket : public CSocket
{
public:
CListenSocket(HWND hWnd=NULL);
HWND m_hWnd; //事件处理窗口
virtual void OnAccept(int nErrorCode);
};
//CListenSocket实现文件
#include "ListenSocket.h"
CListenSocket::CListenSocket(HWND hWnd){m_hWnd=hWnd;}
void CListenSocket::OnAccept(int nErrorCode)
{
SendMessage(m_hWnd,WM_SOCKET_MSG,SOCKET_CLNT_ACCEPT,0);
CSocket::OnAccept(nErrorCode);
}
...
m_pListenSocket=new CListenSocket(m_hWnd);
m_pListenSocket->Create(...);
m_pListenSocket->Listen();
...
LRESULT CXxxDlg::OnSocketMsg(WPARAM wParam, LPARAM lParam)
{
UINT type=(UINT)wParam;
switch(type)
{
case SOCKET_CLNT_ACCEPT:
{
CSocket* pSocket=new CSocket;
if(!m_pListenSocket->Accept(*pSocket))
{
delete pSocket;
break;
}
...
}
...
}
}
|
|
|
|
|
You could write:
头文件=Header file
事件处理窗口=Window event handler
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 )
|
|
|
|
|
Note how it will be Chinese?
|
|
|
|
|
|