Page 1 of 1

How to draw in a mimized dialog ?

Posted: Tue Nov 28, 2006 9:57 am
by toninhofwi
Hi friends.

I need know, what I need to draw on the minimized dialog.

For example: when I click to minimize a dialog in my main window app, a little bar (like a tittle title dialog) appear in my app right ? I need a way to draw a red line on it.

Thanks and best regards,

Toninho.

Posted: Tue Nov 28, 2006 9:53 pm
by Marc Boissinot
Here's a try for mdi child windows inside a mdi frame.

Code: Select all

#include "FiveWin.ch"

#define WM_ERASEBKGND         20
#define WM_ICONERASEBKGND     39
#define WM_MDIACTIVATE       546
#define WM_NCPAINT           133

function Main()

  local oWin, oDlg

  OVERRIDE METHOD NCPaint     IN CLASS TMdiChild WITH MyNCPaint
  OVERRIDE METHOD Paint       IN CLASS TMdiChild WITH MyPaint
  OVERRIDE METHOD MdiActivate IN CLASS TMdiChild WITH MyMdiActivate
  OVERRIDE METHOD HandleEvent IN CLASS TMdiChild WITH MyHandleEvent


  DEFINE WINDOW oWin TITLE "Main Window" MDI

  ACTIVATE WINDOW oWin


function RedLine(oWnd)

  local hPen := CreatePen(PS_SOLID,1,CLR_HRED)
  local hOldPen
  local aRect, nLineDC

  aRect := GetWndRect(oWnd:hWnd)

  nLineDC := GetWindowDC(oWnd:hWnd)
  hOldPen := SelectObject(nLineDC,hPen)
  MoveTo(nLineDC,0,10)
  LineTo(nLineDC,aRect[4]-aRect[2],10)
  SelectObject(nLineDC,hOldpen)
  DeleteObject(hPen)
  ReleaseDC(nLineDC)

  return nil



function MyMdiActivate( lOn, hWndAct, hWndDeAct )

  local self := HB_QSelf()

     if lOn
        if ::oMenu != nil
           ::oWnd:SetMenu( ::oMenu, ::nMenuInfo )
        endif
     else
        if ::oMenu != nil
           ::oWnd:SetMenu( ::oWnd:oMenuStart )
        endif
     endif

     if IsIconic(::hWnd)
       RedLine(Self)
     endif

  return nil

function myNCPaint(nWParam)

  local self := HB_QSelf()

     if IsIconic(::hWnd)
       RedLine(Self,nWParam)
     endif
     return ::TWindow:NCPaint()

function myPaint(nWParam)

  local self := HB_QSelf()

     if IsIconic(::hWnd)
       RedLine(Self,nWParam)
     endif
     return ::TWindow:Paint()

function MyHandleEvent( nMsg, nWParam, nLParam )

   local self := HB_QSelf()
      if nMsg == WM_MDIACTIVATE
         return ::MdiActivate( ::hWnd == nLParam, nLParam, nWParam )
      elseif nMsg == WM_NCPAINT
        return ::NCPaint()
      endif

return ::TWindow():HandleEvent( nMsg, nWParam, nLParam )


Posted: Wed Nov 29, 2006 11:23 am
by toninhofwi
Marc Boissinot wrote:Here's a try for mdi child windows inside a mdi frame.
Marc, works fine. Is just that I need, thanks.

Toninho.