CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Dim. of a DC

  1. #1
    Guest

    Dim. of a DC

    hello,

    i can't find any menber function of CDC or CClientDC which gives the size of the DC...
    does this kind of function exist ?

    thanks!


  2. #2
    Join Date
    May 1999
    Location
    West Sussex, England
    Posts
    1,939

    Re: Dim. of a DC

    Don't you just need to use :

    int size = sizeof(CDC) ; // get the size






    Roger Allen
    Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
    Please remember to rate useful answers. It lets us know when a question has been answered.

  3. #3
    Guest

    Re: Dim. of a DC

    i don't want the size of the memory object but the drawable size of the DC !
    thanks!


  4. #4
    Join Date
    May 1999
    Location
    West Sussex, England
    Posts
    1,939

    Re: Dim. of a DC

    I think you have to get this information from the view you are drawing onto.
    If you can get the DC of an object, you can call GetClientRect() or GetWindowRect() function on it to get the size of it.

    Soz, for my earlier misunderstanding.
    HTH


    Roger Allen
    Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
    Please remember to rate useful answers. It lets us know when a question has been answered.

  5. #5
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Dim. of a DC

    Try GetDeviceCaps().

    Regards,

    Paul McKenzie


  6. #6
    Join Date
    May 1999
    Posts
    5

    Re: Dim. of a DC

    To the best of my knowledge, there is no such
    thing as drawable size of CDC. However, it is
    implicitly defined by the size of the bitmap
    that is selected into CDC. Use the following
    *untested* code to obtain it:


    CSize szDrawSize(0,0);
    CBitmap *pbmDraw = pDC->GetCurrentBitmap();

    if (pbmDraw)
    {
    szDrawSize = pbmDraw->GetBitmapDimension();
    }

    // You have it in szDrawSize.cx and szDrawSize.cy





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured