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

Thread: creating a frame

  1. #1
    Join Date
    Jul 2009
    Posts
    14

    Angry creating a frame

    hi all!
    i'm trying to create something like a frame so i made

    Code:
    HDC hdc2 = CreateCompatibleDC(hdc);
    //draw on hdc2
    BitBlt(hdc, 44, 59, 193, 87, hdc2, 0, 0, SRCCOPY);
    where hdc is the main hdc retrieved by hdc = BeginPaint(hWnd, &ps);
    i thought "probably i have to convert hdc2 in HBITMAP" but when i do that it seems it takes wrong pointer or lost a pair... XD
    i need also hdc2 transparent.

    p.s. i'm developing on windows mobile that is the same of the normal win32 unless a couple of function like createDIBitmap are not implemented

    tnx!
    Last edited by EvIl_DeViL; March 21st, 2010 at 01:16 PM.

  2. #2
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: creating a frame

    Quote Originally Posted by EvIl_DeViL View Post
    hi all!
    i'm trying to create something like a frame so i made

    Code:
    HDC hdc2 = CreateCompatibleDC(hdc);
    //draw on hdc2
    BitBlt(hdc, 44, 59, 193, 87, hdc2, 0, 0, SRCCOPY);
    where hdc is the main hdc retrieved by hdc = BeginPaint(hWnd, &ps);
    i thought "probably i have to convert hdc2 in HBITMAP" but when i do that it seems it takes wrong pointer or lost a pair... XD
    i need also hdc2 transparent.

    p.s. i'm developing on windows mobile that is the same of the normal win32 unless a couple of function like createDIBitmap are not implemented

    tnx!
    The BitBlt function is for rendering bitmaps (or parts of it) to a dc. So if you want to use it you must create (or have) a device context as a destination and one (this is hdc2) as a source. You must select a valide bitmap in the source dc (via SelectObject). Then this selected bitmap will be rendered.
    Why do you want to use BitBlt to create a frame? Maybe my English isn't good enough: But what exactly is a frame in your original post? Is it a frame of 4 lines (up, down, left and right) or a bitmap?

    If it is a frame of four lines you can use Rectangle (supported for CE too).
    If it is a bitmap:
    Code:
    HDC hdc2 = CreateCompatibleDC(hdc);
    //draw on hdc2
    HBITMAP hOldBmp = SelectObject(hdc2, hBitmap);
    BitBlt(hdc, 44, 59, 193, 87, hdc2, 0, 0, SRCCOPY);
    SelectObject(hdc2, hOldBmp);
    DeleteDC(hdc2);
    With regards
    Programartist

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center