|
Hi!
Thanks for replying. Here is what I want to do, check the width of the tree ctrl and based on that figure out how much of my std::string variable(which could be very long) to display. I am not sure how to convert the length of the string to pixels.
Are there any functions that will help me here?
Thanks so much,
NC
|
|
|
|
|
Yes, you can use DrawText() using the tree control's DC to determine the exact width of the string to be displayed. If you're using MFC, I'd subclass CTreeCtrl and turn this into a method - eg: CMyTreeCtrl::getTextWidth (CString& strDisplay) - that you can conveniently call from anywhere once the tree control is constructed (and has a DC!).
Use the DT_CALCRECT flag to calculate the bounds used by the text. The call will automagically use the correct font currently in use by the tree control.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi!
Thanks again for replying. I am new to a lot of this, so I need a little more info.
I have my tree ctrl subclassed. And I am drawing some stuff in custom draw. I looked up DrawText() and seems like I should be able to use it to do what I want. But, I am not sure what you meant by
Ravi Bhavnani wrote:
turn this into a method - eg: CMyTreeCtrl::getTextWidth (CString& strDisplay)
Did you mean have a method that returns the size of the text being passed?
Thanks for all your help,
NC
|
|
|
|
|
What I meant was if you expose the "get text width" functionality via a method, you could determine the width outside of the tree control. This may not be necessary in your application if you need to compute the text width only while drawing (i.e. the only object interested in the text width is the tree control itself).
Did you mean have a method that returns the size of the text being passed?
Yes.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi!
Thanks for replying. I will have to bother you one more time.
Is there any way to convert the rect of the tree item and the string length to some common unit and compare the two? I have to chop off my std::string and display it on 2 or 3 lines based on the current width of the the tree ctrl. So, I need to calculate it before DrawText().
Thanks for all your help.
NC
|
|
|
|
|
NC wrote:
Is there any way to convert the rect of the tree item and the string length to some common unit and compare the two?
Not that I know of. There is a neat function PathCompactPath that automatically compresses file paths, given a device context, but this is different from what you want to do.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks for all your help. I did look at PathCompactPath() and like you seed, I cannot use that.
If you think of a way to do this, please do let me know.
Thanks so much,
NC
|
|
|
|
|
hi,
I have an ArrayList in a fuction. in it i want add some Double object, but always take the same result,
C2664: 'System::Collections::ArrayList::Add' : cannot convert parameter 1 from 'double __gc *' to 'System::Object __gc *'
if i do the same with a String there is any problem, so what i must do? please help,
Thanks in advance
Salamanca 2002 Capital Cultural Europea, Visitala
|
|
|
|
|
I think you've got to box the double, i.e. push it into an Object before insertion. Why don't you try at the C# forum?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
how can i push it into an object?
I put the question here because this is VC++ not C#, maybe VC++ managed code questions are similar to C#, but... if here is like OT, i put it in the other forum.
Salamanca 2002 Capital Cultural Europea, Visitala
|
|
|
|
|
Try with Object obj=__box(myDouble) . We warned I'm no managed C++ expert
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have a DLL that was NOT created with the app wizard. It has a single entry point, no DllMain, no nothing - just a single function.
If I were to re-architect the DLL from within appwiard (create a new dll and move the existing code into it, including the entry point function), would I experience any bizarre behavior?
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
As far as I know, as long as you keep the same entry point name and keep the same ordinal number if specified, you shouldn't have a problem.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
Can some tell me , how do I detect if the user has pressed
down the ALT key.
Thanks,
Sansky
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
Look up the GetAsyncKeyState(...) function for starters... (That is, of course, if you are not peeking at window messages...)
Peace!
-=- James.
|
|
|
|
|
Hello programmers,
i have currently a problem, maybe my brain is no more functioning correctly, i can't save an item from a CLIstBox into a CString variable. The thing is that the ListBox was created at runtime from (CMyListBox) a CListBox class i derived. Please could you help me get the selected of the listbox into a CString variable. Remember there's no resource for the listbox, that is no dialog box.
Thanks in advance
Bernard Racoute
56Kbps of sighs
|
|
|
|
|
You mean when you use GetSel() and GetText() you can't do it?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I've heard of others having problems with MSVC6 on Win2000. I'm frequently being told that there is no disk in the drive, and compiling is constantly failing. Either the linker fails to execute or the resource compiler fails to execute.
There's nothing on the MS KB on the issue. I'm pretty certain that Service Pack 5 is the problem. Anyone care to fill me in?
Simon
Q: Why didn't Intel call the Pentium the 586?
A: Because they added 486 and 100 on the first Pentium and got 585.999983605.
Sonork ID 100.10024
|
|
|
|
|
It's telling you there is no disk in the floppy drive? maybe if you put a disk in it would tell you what file its expecting to find on the disk? .. i have never heard of this problem.. and we have a couple guys who were using vs6 before .net..
-dz
|
|
|
|
|
Simon Walton wrote:
I've heard of others having problems with MSVC6 on Win2000. I'm frequently being told that there is no disk in the drive, and compiling is constantly failing. Either the linker fails to execute or the resource compiler fails to execute
Make sure that "A:" and/or "B:" (or any other non-existant or removable drive letters) are not in any of your paths (system paths, LIB path, INCLUDE path, etc.). I have seen something like that happen before, and it was because of a mistake like that.
Peace!
BTW: I would be more worried if you were NOT using Service Patk 5!
-=- James.
|
|
|
|
|
Do you know how could i disable a WebBrowser control's scrollbar?
rechi
|
|
|
|
|
hi,
I have a managed function that wrapper an unmanaged one where a parameter is a double [10], and this function returns values in this parameter, now in my wrapper function y want to be able to use it from c#, so i want to pass an ArrayList, or a double[10], or something where can take the back parameters, but i don't know how to do it, and if its possible any suggestion? thanks in advance
Salamanca 2002 Capital Cultural Europea, Visitala
|
|
|
|
|
I doubt this would work. The compiler may compile right, but runtime environment won't probably accept this, since it would be a security risk, and it would defeat the managed code purpose.
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
Hi,
I am using VC++ 6.0 . I need to print some text from a simple C program.
How do I do it?
I tried to use fprintf(); but couldn't get a suitable FILE * object to put
as the first parameter.
Please help. Is there any other way to do it?
With best regards,
Sayan
Email:sayanmukherjee@indiatimes.com
|
|
|
|
|
printf (without the leading f .)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|