Closed Thread
Results 1 to 4 of 4

Thread: Problem with drawing functions

  1. #1
    Gaski is offline Newbie
    Join Date
    Feb 2008
    Posts
    1
    Rep Power
    0

    Problem with drawing functions

    Hi,
    I have an application, that is drawing a simple text on my desktop.
    I have two button created on desktop, and when i click one of them the text is displayed. It should be displayed all the time, but when I put something on it (for example if I move an icon into the text area), , the text dissapears.

    I'm using global hook to see if the button is pressed.
    My painting code :
    [HIGHLIGHT="Delphi"]
    //if hook catch an WM_PAINT message it sends a message to application // application code when the WM_PAINT message is found:

    DC := BeginPaint(GetDesktopListViewHandle, PS);
    SetBkMode(DC, TRANSPARENT);
    SetTextColor(DC, RGB(0, 0, 0));
    TextOut(DC, 1024 - 200, i, Pchar(s), Length(s));
    EndPaint(GetDesktopListViewHandle, PS);
    [/HIGHLIGHT]

    and the GetDesktopListViewHandle function looks :

    [HIGHLIGHT="Delphi"]

    function GetDesktopListViewHandle: THandle;
    var
    S: String;
    begin
    Result := FindWindow('ProgMan', nil);
    Result := GetWindow(Result, GW_CHILD);
    Result := GetWindow(Result, GW_CHILD);
    SetLength(S, 40);
    GetClassName(Result, PChar(S), 39);
    if PChar(S) <> 'SysListView32' then
    Result := 0;
    end;
    [/HIGHLIGHT]

    I must redraw the text, when something is put on it, but i don't know after what message should I redraw it, and how ?

    Please help.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Tiago2 is offline Newbie
    Join Date
    May 2008
    Posts
    5
    Rep Power
    0

    Re: Problem with drawing functions

    This may not be a best solution but u could always create a procedure for Application.OnIdle to redraw the test... its messy i know

  4. #3
    shruti is offline Newbie
    Join Date
    Jul 2008
    Posts
    16
    Rep Power
    0

    Re: Problem with drawing functions

    Actually i don't have too much idea about it.

  5. #4
    dav
    dav is offline Newbie
    Join Date
    Mar 2007
    Posts
    1
    Rep Power
    0

    Re: Problem with drawing functions

    this is the difference between drawing on a form and drawing on an image on the form, in the first case you have redraw your shape after each (move, minimize, maximize ...), so you have two solutions:
    1- ad an image component to your form and then draw your text on it
    2- draw your text in the form.onpaint event

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem with trigonometric functions
    By hampus.tagerud in forum Java Help
    Replies: 2
    Last Post: 06-14-2011, 06:03 PM
  2. Replies: 3
    Last Post: 05-08-2011, 02:59 PM
  3. Replies: 1
    Last Post: 05-18-2010, 03:30 AM
  4. Replies: 20
    Last Post: 01-14-2010, 08:05 PM
  5. problem with functions and pointer
    By naspek in forum C and C++
    Replies: 5
    Last Post: 09-05-2009, 12:52 AM

Tags for this Thread

Bookmarks

Posting Permissions

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