|
Hi...
Install new font(what u would like to see in u r edit control)
1) Create variable for Edit control m_font.
CEdit m_ctrlEdit;
2) Create varible for CFont
CFont m_font;
3)Initialize with new Font..
m_font = CreateFont(,.....,....,m_fontName) /* see in MSDN
m_edit.SetFont(&m_font);
Try this..
I am able to display "xxxxxxx.ttf" with this appproach..
|
|
|
|
|
Oh it was my mistake anyway you can use of CFont class of MFC and then use of SetFont.
|
|
|
|
|
Here is a code snippet about CListCtrl from MSDN. And I don't think MSDN give correct code.
int index = m_myListCtrl.GetTopIndex();<br />
int last_visible_index = index + m_myListCtrl.GetCountPerPage();<br />
if (last_visible_index > m_myListCtrl.GetItemCount())<br />
last_visible_index = m_myListCtrl.GetItemCount();<br />
<br />
while (index <= last_visible_index)<br />
{<br />
<br />
index++;<br />
}
IMO, variable last_visible_index is more than one. So the While statement should be written like this:
while (index < last_visible_index)
Am I wrong? Or MSND?
Thank you all!
A Chinese VC++ programmer
|
|
|
|
|
Your Question:
Is MSDN wrong?
You asked:
Am I wrong? Or MSND?
What is wrong? you...?
Anyway, Did you implement this code?
Mukesh Kumar
Software Engineer
|
|
|
|
|
Yes, I didn't run this code. But look at this :
last_visible_index = m_myListCtrl.GetItemCount();
The max index of a CListCtrl is m_myListCtrl.GetItemCount() - 1 not m_myListCtrl.GetItemCount().
Any way ,thank you!
A Chinese VC++ programmer
|
|
|
|
|
Mukesh Kumar wrote: What is wrong? you...?
Nope thats why asking the question!
"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
|
|
|
|
|
Could you please, post the link to the MSDN page?
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
|
|
|
|
|
|
Well I think you're right and MSDN example is wrong. Unfortunately at the moment I have no time to test it, but I'll do in a day or two.
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
|
|
|
|
|
O,yeah!
Thank you!
I'll test it tomorrow.
A Chinese VC++ programmer
|
|
|
|
|
It might actually be right.
I assume that GetCountPerPage includes only complete items to be shown, however the click might occur at a partially visible additional item.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist
|
|
|
|
|
Thank you peterchen
You're right, GetCountPerPage only returns the items that completely visible. But this has nothing to do with this bug!
I've test this code, and I'm sure that this code is bugsome.GetItemRect will return FALSE when index is GetItemCount(); I've reported this to MS.
A Chinese VC++ programmer
|
|
|
|
|
you are right, either the limiting condition should be changed to
if (last_visible_index > =GetItemCount())
last_visible_index = GetItemCount()-1;
or the return value of GetItemRect should be checked.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist
|
|
|
|
|
Hi all,
I am Savtri here.I am having 3 field in table,Slnumber,Name, and PhoneNumber.Slnumber is of type Autonumber, and Name and phonenumber are text.when I add New element then it is incrementing.but when i am deleting it is not decrementing it means if i have 5 values like 1,2,3,4,5.if delete 3rd value then my table cantains 4 values.so please tell me How Shall i do it.I am doing Updation also.But I want ot Update the both the fields name and Phonenumber and in where clause i want to check slnumber.Like SqlString="UPDATE ADDRESBOOK SET name="" AND Phonenumber="" WHERE SlNumber=""";But Not getting How TO GET THAT SLNUMBER FROM THE TABLE into the variable.
PLEASE TELL ME.HELP ME.
Thanks in Advance,
savitri
|
|
|
|
|
savitri wrote: but when i am deleting it is not decrementing
No, it does not work that way. The end. If you want this behaviour, then you need to write your own code to do it, and not use an autonumber. And, that is ridiculous. Imagine you have 6 values. You delete value 4. You have anoher table that references this table ( that's the main thing the autonumbers are used for ). Why would you want to go and change the 5 and 6 to 4 and 5 AND try to change all references to them accordingly ? What if references exist out side the DB ?
It seems to me you have no idea about databases, and should be buying a beginners book and working through it.
Numeric types do not go into quotes.
UPDATE ADDRESSBOOK SET name ='fred' and Phonenumber = '123424243' where slNumber = 1
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
ok thanku.i am taking that slnumber in irec value from the table it is printing correctly.but i am getting how shall i use the iRec variable to slnumber in update query.i am doing like this:
SqlString="UPDATE AddressBook SET Name='"+sCAtID+"' AND PhoneNumber='"+sCAtegory+"' WHERE SlNumber="+iRec+"";
but it is giving error as '+' cannot overloads.
Please tell me how can write this.
HELP ME PLEASE.
THANKS A LOT,
Savitri
|
|
|
|
|
Saviri Ji,
+ cannot concatenate int to string. Convert iRec value into string.
|
|
|
|
|
autonumber is int know.how it is compare with string .please modify my that SQL statement and tell me how can i do it.
thanku,
savitri
|
|
|
|
|
CString strRec = _T("");
strRec.Format(_T("%d"), iRec);
SqlString="UPDATE AddressBook SET Name='"+sCAtID+"' AND PhoneNumber='"+sCAtegory+"' WHERE SlNumber="+strRec+"";
|
|
|
|
|
no it is not working.i am getting error.like datatype mismatch.
|
|
|
|
|
Two people have told you the same thing now. Perhaps if you told us the EXACT error message. Also, please note, you should have asked this in the SQL forum.
Are you getting an error trying to build the string ? If you're not getting that error, you're not even using C++. In C++ you need to turn the int into a string, with sprintf, or with the Format method on CString, or with itoa. If you're using a .NET language, then it will work, but again, in that case, you have asked in a forum that has NOTHING to do with your question. In that instance, you need to look at your database. If your column is a numeric type, then the SQL you're generating, will work.
The best test is to use the debugger to get the exact string you are generating, and then plug that into your database directly, so your code is out of the picture, and you're just testing the SQL.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
And why on earth is this in the MFC forum ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi everybody!, I want to write a MFC application can create a hidden folder, but I don't know have any function allow me can do that.Thus, I hope if someone know,please tell me how to do it. Thanks alot
AS84
|
|
|
|
|
|
Please let me know how do I pass a string class string variable to a function...
Suppose
in main function
string str1("Hello");
creating a function outside main
new_function (----------)
{
.....
}
how do I pass word "Hello" to the new_function()
Please help me out.
Thanks.
|
|
|
|