How to get HBITMAP from Graphics object in Gdiplus?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AD

    How to get HBITMAP from Graphics object in Gdiplus?

    Hey,
    I have a problem with getting a bitmap (HBITMAP) from Device Context using
    Graphics object.
    Let's say I draw something :
    CDC ndc;

    HBITMAP hb;

    ndc.CreateCompa tibleDC(dc);

    Graphics g(ndc->m_hDC);

    g.Draw(somethin g..); //drawing on g is here
    hb= ???
    And how to get a bitmap then? Or maybe I did something wrong..

    AD






  • Jens Bäckman

    #2
    Re: How to get HBITMAP from Graphics object in Gdiplus?

    AD wrote:
    [color=blue]
    > Hey,
    > I have a problem with getting a bitmap (HBITMAP) from Device Context using
    > Graphics object.
    > Let's say I draw something :
    > CDC ndc;
    >
    > HBITMAP hb;
    >
    > ndc.CreateCompa tibleDC(dc);
    >
    > Graphics g(ndc->m_hDC);
    >
    > g.Draw(somethin g..); //drawing on g is here
    > hb= ???
    > And how to get a bitmap then? Or maybe I did something wrong..[/color]

    I'm not aware of any such objects or methods in standard C++. They have to
    be part of some oddball library for your operating system or compiler. Try
    looking for newsgroups about any of them instead
    ..

    Comment

    • james

      #3
      Re: How to get HBITMAP from Graphics object in Gdiplus?

      HBITMAP is one of GDI object in CDC, So you need to use SelectObject to
      select HBITMAP object into CDC before you draw.
      "AD" <ania.domachows ka@wp.pl> ¦b¶l¥ó news:c14n5l$nis $1@news.onet.pl ¤¤¼¶¼g
      ....[color=blue]
      > Hey,
      > I have a problem with getting a bitmap (HBITMAP) from Device Context using
      > Graphics object.
      > Let's say I draw something :
      > CDC ndc;
      >
      > HBITMAP hb;
      >
      > ndc.CreateCompa tibleDC(dc);
      >
      > Graphics g(ndc->m_hDC);
      >
      > g.Draw(somethin g..); //drawing on g is here
      > hb= ???
      > And how to get a bitmap then? Or maybe I did something wrong..
      >
      > AD
      >
      >
      >
      >
      >
      >[/color]


      Comment

      Working...