Stock Font in ATL ActiveX Control using VS.NET
-
Hello... I have been trying to add a font stock property to my ATL ActiveX control in VS.NET. I go by the examples and documentation at MSDN but its not quite possible. They suggest to right click on the interface of my class under the class view, and select ADD->Properties.... Then apparrently there will be a drop down menu where I will be able to choose the type of stock property, in this case FONT. But no..there is no such drop down menu...only a text fields.. I tried to manually type in Font, but nothing... I tried to manually copy and paste the code shown in the example in the corresponding sections of the project but it won't even compile. How on earth does one add a FOnt stock property to an ATL ActiveX control in VS.NET? Thanks!
-
Hello... I have been trying to add a font stock property to my ATL ActiveX control in VS.NET. I go by the examples and documentation at MSDN but its not quite possible. They suggest to right click on the interface of my class under the class view, and select ADD->Properties.... Then apparrently there will be a drop down menu where I will be able to choose the type of stock property, in this case FONT. But no..there is no such drop down menu...only a text fields.. I tried to manually type in Font, but nothing... I tried to manually copy and paste the code shown in the example in the corresponding sections of the project but it won't even compile. How on earth does one add a FOnt stock property to an ATL ActiveX control in VS.NET? Thanks!
So it turnes out the only way to achive the above is to manualy create a new project where you state the stock properties from the vary begining, and then copy the code segments over to your existing project code.... tsk tsk tsk :wtf: And now the latest problem for the past 2 hours has been that I have added the font stock property and a member variable CComPtr m_pFont; which gets set at OnFontChanged(). Now in my OnDraw() function I would like to select this font and use it, however I cannot simply do pdc.SelectObject(m_pFont) as m_pFont is not a CFont. In the MFC only version of ActiveX I could call SelectStockFont(pDC); but this is no longer suitable in ATL ActiveX. I cannot figure out how to convert a font refered to by IFontDisp to a CFont so that I can select it for the drawing code. Could somebody point me in the right direction please? Thanks
-
So it turnes out the only way to achive the above is to manualy create a new project where you state the stock properties from the vary begining, and then copy the code segments over to your existing project code.... tsk tsk tsk :wtf: And now the latest problem for the past 2 hours has been that I have added the font stock property and a member variable CComPtr m_pFont; which gets set at OnFontChanged(). Now in my OnDraw() function I would like to select this font and use it, however I cannot simply do pdc.SelectObject(m_pFont) as m_pFont is not a CFont. In the MFC only version of ActiveX I could call SelectStockFont(pDC); but this is no longer suitable in ATL ActiveX. I cannot figure out how to convert a font refered to by IFontDisp to a CFont so that I can select it for the drawing code. Could somebody point me in the right direction please? Thanks
greekgoddj wrote: Could somebody point me in the right direction please?
QueryInterface()
forIFont
, which has neat method calledget_hFont()
. If the object doesn't implementIFont
, then you will have to create the font manually, using the properties exposed byIFontDisp
(it sucks, I know!) -- My name in Katakana is ヨルゲン. My name in German is Jörgen. My name in Mandarin/Kanji is 乔尔根 西格瓦德森. My name in Korean is 요르겐. I blog too now[^] -
greekgoddj wrote: Could somebody point me in the right direction please?
QueryInterface()
forIFont
, which has neat method calledget_hFont()
. If the object doesn't implementIFont
, then you will have to create the font manually, using the properties exposed byIFontDisp
(it sucks, I know!) -- My name in Katakana is ヨルゲン. My name in German is Jörgen. My name in Mandarin/Kanji is 乔尔根 西格瓦德森. My name in Korean is 요르겐. I blog too now[^]Got it! thanks :)