News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Can't seem to be able to get the Drawing Modes to work

Started by Rainstorm, July 12, 2008, 02:22:07 PM

Previous topic - Next topic

Rainstorm

I've tried different drawing MOdes using the SetROP2 function.. & they don't seem to make any difference & the colour doesn't change. don't know what am doing wrong but can't get it to work - the text colour just stays the same. : (
here's some of the code

thanks!
        invoke GetDC, hwnd
        mov hdc, eax
        invoke SelectObject, hdc, h_stockfont

;       invoke SetBkMode, hdc, TRANSPARENT
;       invoke SetBkColor, hdc, 0C9B5A5h
        invoke SetTextColor, hdc, 0946DA2h

    ; ========= drawing mode =============
   
        invoke SetROP2, hdc, R2_MERGENOTPEN

        invoke GetROP2, hdc
        fn MessageBox, 0, ustr$(eax), "Drawing Mode", MB_OK       
       
;       invoke CreateRectRgn, 0, 0, 40, 16
;       invoke SelectClipRgn, hdc, eax

        invoke TextOut, hdc, 0, 0, edi, SIZEOF txtstring
        invoke ReleaseDC, hwnd, hdc

PBrennick

Rainstorm,

This is a method that I use for coloring certain text.


    .elseif eax == WM_CTLCOLORSTATIC
      push    ebx
      push    edx
      invoke  SendMessage, HWnd, WM_GETFONT, 0, 0
      mov     edx, eax
      invoke  GetObject, edx, sizeof LOGFONT, addr tmpFont
      mov     tmpFont.lfUnderline, TRUE
      invoke  CreateFontIndirect, addr tmpFont
      mov     ebx, eax
      invoke  SelectObject, wParam, ebx
      .if hover == FALSE
        invoke  SetTextColor, wParam, Blue
      .else
        invoke  SetTextColor, wParam, Red
      .endif
      mov     eax, BackColor
      invoke  SetBkColor, wParam, eax
      invoke  DeleteObject, ebx
      invoke  GetStockObject, HOLLOW_BRUSH
      pop     edx
      pop     ebx


-- Paul
The GeneSys Project is available from:
The Repository or My crappy website

Tedd

The drawing modes only affect PEN drawing - text rendering isn't changed.
To get any kind of nice effects, you'll have to render the text on a memory dc and then bitblt using the wanted mode.
No snowflake in an avalanche feels responsible.

Rainstorm

Paul, thanks for the code ; )
I was just trying to get the text & background to interract.

Tedd wrote..
QuoteThe drawing modes only affect PEN drawing - text rendering isn't changed.
To get any kind of nice effects, you'll have to render the text on a memory dc and then bitblt using the wanted mode.
that's a bummer.. would rule it out i think for what i wanted it..

this is a quote from the SDK for the Drawing Mode that made me think it would work..
QuoteDefines how foreground colors are mixed with existing window or screen colors for pen, brush, bitmap, and text operations.

thanks.

PBrennick

Rainstorm,
The code was a snippet from the procedure that I use to create a hyperlink in my about box. It sets the colr to be anything you want and also shows you how to underline it. If you want the complete procedure, I can attach it.

There is also DrawText which I am using for syntax highlighting. I know you like to do things yourself, but if you get real stumped drop an email to pbrennick@juno.com

-- Paul
The GeneSys Project is available from:
The Repository or My crappy website

Tedd

Quote from: Rainstorm on July 12, 2008, 04:45:44 PM
this is a quote from the SDK for the Drawing Mode that made me think it would work..
QuoteDefines how foreground colors are mixed with existing window or screen colors for pen, brush, bitmap, and text operations.
Yes, it could be made a bit clearer. What it means is how the new pixels mix with the pixels already drawn on the dc by those operations.
No snowflake in an avalanche feels responsible.

Rainstorm

paul wrote..
QuoteThe code was a snippet from the procedure that I use to create a hyperlink in my about box. It sets the colr to be anything you want and also shows you how to underline it. If you want the complete procedure, I can attach it.
That would be good thx   : )

Tedd wrote...
QuoteYes, it could be made a bit clearer. What it means is how the new pixels mix with the pixels already drawn on the dc by those operations.
Tedd, didn't  realise it meant that - thx for clearing that up  :U