|
I'm not sure I'm doing the right thing.
I have a CStatic in a dialog ( with the associated variable in the dialog class ), and I want to change the "weight" of the font of the CStatic, make it bold or normal depending on a state.
Can I do something like :
CFont* font = m_MaxStatic.GetFont();
LOGFONT logFont;
font->GetLogFont( &logFont );
logFont.lfWeight = FW_BOLD;
CFont newFont;
newFont.CreateFontIndirect( &logFont );
m_MaxStatic.SetFont(&newFont);
when I do the above, the font seems ok, it appears bold, but if the dialogs ( or the control ) gets invalidated, the font (size) is different.
Do I need to make the 2 different fonts (normal and bold) class members ( of either the dialog or a derived CStatic class ) ? or is there a better way to dinamically change the font of a control ?
Should there be a functional difference between small fonts vs. large fonts.
Thanks a lot.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
CFont newFont;
You are creating the font correctly. But since it is local to the function, it goes out of scope when the function exits. This means that the font the control is trying to use has been destroyed. So the next time it tries to draw, it no longer has a valid font.
Make the CFont object a member of the class. That should do it for you.
Peace!
-=- James 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! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Yeah, thanks, It figures ...
(ranting)
it's kind of weird that I have a CWnd object with the SetFont() method and I need to keep a local copy of the font ... why can't it copy the font instead of keeping a pointer to it.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
It allows only a single instance of the same font to be used with multiple controls, and you (the developer) maintain its lifetime, so there is no additional allocate-copy-deallocate overhead.
I would not want to set the font for 20 controls on a non-modal dialog, then open a few copies of that dialog, and have MFC have a bunch of identical copies of a font being managed.
Peace!
-=- James 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! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
|
Thanks for the faq link ...
I will hide under a rock ...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I've tried to implement the MATLAB C++ Math Library using Riazi's article posted 28 May 2003. I get a link error 'cannot find the file "MSVCIRT.LIB". I've tried the recommended fix (/nodefaultlib "MVSCRT.LIB" and (/nodefaultlib "MVSCIRT.LIB") which yields more undefined symbols. I've also tried selecting multithreading and still get the error. Any suggestions would be appreciated.
Ron
|
|
|
|
|
If you tell us what some of the undefined symbols are, sometimes we can suggest which library to try linking with. What seems to be missing?
|
|
|
|
|
Hi Everybody,
I am doing a project in image processing using VC++, in which I have to find the intersecting points in a grid.
I tried many corner detection algorithms. Everything works fine with straight lines but not with skewed lines.
Please help me with some algorithm or code
Thanks in advance
|
|
|
|
|
I guess you'll have to take each pixel and verify if it has the same value as at least one from his neighbours.
Something like this:
[ 1 2 3 ]
[ 4 5 6 ]
[ 7 8 9 ]
Now you take pixel #5 and check his value with the ones from that matrix. if it's the same then it is a point of the line(composing the grid), if not then it don't belongs there.
Once you know where the grid lines starts it's easy to identify the intersecting points since you'll know the angle and everything.
|
|
|
|
|
Is it possible to load msword doc and to perform string manipulation.Suppose If we use "Navigate2" we can load the Doc Files,but I was not able to do string manipulation?.Can anyone help out in this.
Thanks,
Gnanaprakash
|
|
|
|
|
You need to Google or search MSDN for Word Automation.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
David,
Thanks for ur info.Is there any third party controls like CHTMLView.
|
|
|
|
|
GnanaprakashJebaraj wrote:
Is there any third party controls like CHTMLView.
Not sure what you mean by "third party" but CHtmlView is part of MFC.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Alok Gupta,
Thanks for ur info.Is there any third party controls.If we go for Addins we have to port in WinWord.But I need to have in SDI/Dialog.Is there any option.
Thanks,
Gnanaprakash
|
|
|
|
|
Microsoft NewsGroup will right place to ask these type of Question
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Thanks for ur info.
www.mindcracker.com/code/2003/July/WordAddIn.asp
I have done all the steps to load Addins in the Word as mentioned in article.I was able to compile code but I couldn't see my addin item button in Word.
Even tried this
Tools -> Customize
Select the Commands Tab
Select Tools in the Categories
Drag the "COM Add-Ins" to a toolbar somewhere.
Click Close.
This article for outlook is working .www.mindcracker.com/mindcracker/c_cafe/atl/BuildingOffice2KCOMAddInAD.asp
How can I see my addin items.Iam using office2000
Thanks,
Gnanaprakash
|
|
|
|
|
I need a parser for C++ that can be integrated in Visual C.
I've tried to make one using yacc and bison but it didn't work(didn't manage to do the file).
Can anyone help me? Do you know where I can find it? Do you have it?
Thank you.
|
|
|
|
|
why not writing yours ???
maybe you don't know where to start ...
hope this[^] will help...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
As far as I know, Visual C == Visual C++ and already has a C++ parser. Or are you using some very old IDE?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
As far as I know, Visual C == Visual C++
not exacly... if you change your source files extension from CPP into C, the compiler will be restricted to a C compiler (not C++)...
(hum, it was like this on VS6 ; i'm not sure for later versions...)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
not exacly... if you change your source files extension from CPP into C, the compiler will be restricted to a C compiler (not C++)...
True, but that still doesn't mean that you can call the whole IDE visual C instead of Visual C++... Anyway, in his own reply to his original post he says that he needs an analyser that gives him the structure of the program... I don't know if such a tool exists...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
Anyway, in his own reply to his original post he says that he needs an analyser that gives him the structure of the program
No,no, I need a parser. I think a parser knows which statement is an conditional one or not.
Bob Stanneveld wrote:
I don't know if such a tool exists.
It will as soon as I finish this project.
|
|
|
|
|
marius-adrian wrote:
No,no, I need a parser.
i am currently working on such a project (C++ parser), but as it is a personal goal, i don't work very fast on it.
however, the principle is simple, and based on the work exposed in my article VisualCalc .
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|