Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Stock Font in ATL ActiveX Control using VS.NET

Stock Font in ATL ActiveX Control using VS.NET

Scheduled Pinned Locked Moved ATL / WTL / STL
csharpc++visual-studiocomtutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    greekgoddj
    wrote on last edited by
    #1

    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!

    G 1 Reply Last reply
    0
    • G greekgoddj

      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!

      G Offline
      G Offline
      greekgoddj
      wrote on last edited by
      #2

      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

      J 1 Reply Last reply
      0
      • G greekgoddj

        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

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #3

        greekgoddj wrote: Could somebody point me in the right direction please? QueryInterface() for IFont, which has neat method called get_hFont(). If the object doesn't implement IFont, then you will have to create the font manually, using the properties exposed by IFontDisp (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[^]

        G 1 Reply Last reply
        0
        • J Jorgen Sigvardsson

          greekgoddj wrote: Could somebody point me in the right direction please? QueryInterface() for IFont, which has neat method called get_hFont(). If the object doesn't implement IFont, then you will have to create the font manually, using the properties exposed by IFontDisp (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[^]

          G Offline
          G Offline
          greekgoddj
          wrote on last edited by
          #4

          Got it! thanks :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups