|
Hi guys
¿Do you know a way to show a long text (CString) in a CStatic justified or left aligned?
Thanks in forwarding.
Dr.Pî
|
|
|
|
|
Text is left justified by default. Perhaps I'm misunderstanding.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry, I was talking about a CMyStatic where your own paints the text,bitmaps,etc...
Dr.Pi
|
|
|
|
|
the famous CMyStatic , how did I forget about?
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.
[my articles]
|
|
|
|
|
Are you using TextOut() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
And what is the value of the second argument?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The problem is that I have a CString too long for the width of the control (then I have to show as multiline). Then, I don't know how to manage this.
|
|
|
|
|
If this is a CStatic control, why aren't you using SetWindowText() , rather than rendering the text yourself with TextOut() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Cause in addition to the text I have graphics in the same CStatic derived class.
SetWindowText() don't have any control about in which position inside the control you write your text.
Imagine a INFO panel where there is a border, some graphics and a multiline text.
Anyway don't worry, I've found a simple way.
Dr.Pi
|
|
|
|
|
I suppose.
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.
[my articles]
|
|
|
|
|
hello all
i made small simple application (exe) using MFC in VS 2005 pro
now want to give it to my friends to run it on their PC where VS
is not installed.
but only the EXE itself is not running and asks for some DLLs
1- how can it be done .. any idea ???
i tried on mirosoft website and found this:
http://msdn2.microsoft.com/en-us/library/ms235317(VS.80).aspx
...
http://msdn2.microsoft.com/en-us/library/ms235291(VS.80).aspx
2- my prob can be sloved if anybody please tell me .. how to make this mylibrary.dll in the above example when i have the myapplication.exe as my project is an MFC executable !
take a look at the discussion here ...
http://forums.microsoft.com/msdn/showpost.aspx?siteid=1&postid=2745356&sb=0&d=1&at=7&ft=11&tf=0&pageid=1[^]
but here also the same mylibrary.dll is refrenced ...
3-is it necessary to make the project with MFC shared dll as project type
then what about the exe ... will it be there along with the dll ?
|
|
|
|
|
you need to build your EXE with "static linking"
|
|
|
|
|
Thanks a lot Chris ... it solved my problem
but now i am just wondering if just statically linking is all what is needed to run it on other PCs
what is the role of redistributable "vcredist.exe" !
|
|
|
|
|
You can ship all the DLLs that *you* have written. For MFC DLLs, you can distribute the latest version of vcredist.exe[^] along with your application.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
well just statically linking the DLL while building solved my prob.
but i think shipping all the dlls is not a good idea ... coz it asks for a single Dlls and gives error ... if provide that .. it asks for another ... (i dont know how many will there be)and i had to search it in the installed VS components for it .... also i guess most of them are not freely redistributable under MS VS Lisence
|
|
|
|
|
hi
I implimented CustomDraw
when i put lptvcd->clrTextBk = CLR_NONE ;
lables are painted with black color background but not trasparent
please some one tell me what shud i change in the code to get the CtreeCtrl lables trasparent
void CLeftPaneTreeCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
switch(pNMHDR->code)
{
case NM_CUSTOMDRAW:
{
LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW )pNMHDR;
lptvcd->clrTextBk = CLR_NONE ;
lptvcd->clrText = (RGB(0,0,255));
//SetTextColor(RGB(255, 0, 0));
//SetBkMode(lplvcd->nmcd.hdc,TRANSPARENT);
switch (lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
// Need to process this case and set pResult to
// CDRF_NOTIFYITEMDRAW, otherwise parent will never receive
//CDDS_ITEMPREPAINT notification. (GGH)
*pResult = CDRF_NOTIFYITEMDRAW;
return;
}
}
}
}
|
|
|
|
|
What happens if
// lptvcd->clrTextBk = CLR_NONE ;
dont get to work?
Greetings from Germany
|
|
|
|
|
Hi
Karstenk Thanx for the reply
if i coment out that line it will paint white background
but i painted gradient color on CTreeCtrl backgoud so it doest help me
and one more thing
lplvcd->clrTextBk = CLR_NONE ; works fine with CListCtrl lables
but same thing doesnt work for CTreeCtrl lables
and any other color other than trasparent will take effect properly
-SetBkMode(hdc,TRASPARENT) also wont work - it doesnt take any effect
|
|
|
|
|
You're gonna have to draw the labels yourself.
But who is the king of all of these folks?
|
|
|
|
|
how to do that can u please give me some pointers
how to start drawing the lables and where
in customdraw?
|
|
|
|
|
|
Hi,
I was wondering if you could give me an example of when you would want to store objects in a list and when would you want to store them in a multi set.
The multi set of course having the ability to store multiple values of the same object.
Thanks
|
|
|
|
|
You could use a multi set to store the factors of a prime number, say, 120: {2, 2, 2, 3, 5}
Using a list this would be {2,3,5} if you just wanted to identify the factors themselves.
Using the multi set, you could recontruct the prime (by multiplication of the contents of the multi set). The list would just give you the factors.
|
|
|
|
|
Hey thanks for your input. I thought Lists can store duplicates ? So it could store {2,2,2,3,5} ?
|
|
|
|