1. Euveiwer3 questin for Al

Hello Al,

        retv=win:SetTextColor(hdc,#FFA0FF)--violet
        retv=win:SetBkColor(hdc,TRANSPARENT)--
    TextOutEx(hdc,LeftMargin,TopMargin,"my stuff")

The text background color comes up Black.

How can I make it transparent or whatever the picture color is behind it?

I'm working on adding zoom.

Don Cole
 A Bug is an un-documented feature.
A Feature is a documented Bug.

new topic     » topic index » view message » categorize

2. Re: Euveiwer3 questin for Al

don cole wrote:
> 
> Hello Al,
> 
>         retv=win:SetTextColor(hdc,#FFA0FF)--violet
>         retv=win:SetBkColor(hdc,TRANSPARENT)--
>     TextOutEx(hdc,LeftMargin,TopMargin,"my stuff")
> 
> The text background color comes up Black.
> 
> How can I make it transparent or whatever the picture color is behind it?
> 
> I'm working on adding zoom.
> 
> Don Cole
>  A Bug is an un-documented feature.
> A Feature is a documented Bug.

Hi there Don,


Well, there are a few functions to keep in mind when writing
text...

  SetTextColor
  SetBkColor
  SetBkMode

SetTextColor  sets the text color (the lettering itself).
SetBkColor    sets the background color where the text itself prints
              (but only if mode=OPAQUE).
SetBkMode     sets the mode, and the mode determines if the background
              will be colored with the "BkColor", or transparent.
              SetBkMode with a value of OPAQUE means the back color
              set with SetBkColor will be painted just behind the text,
              while using a value of TRANSPARENT means whatever color
              already exists (from a previous paint) will show behind
              the text.

It sounds like you want to make the background mode transparent, so you
would set the background mode something like this:

retv=win:SetBkMode(hdc,TRANSPARENT)

Note that once in the back mode of 'TRANSPARENT' the background
color setting will not have any effect.  Thus in the two lines:

  retv=win:SetBkMode(hdc,TRANSPARENT)
  retv=win:SetBkColor(hdc,#FFFFFF)

  SetBkColor wont have any effect in your app (still sets it however)
  unless SetBkMode is called later with a value of OPAQUE instead
  of TRANSPARENT, because TRANSPARENT effectively says "dont use back
  color and allow previous back paint to show through" while 
  OPAQUE says "use the back color, overwriting previous back paint
  wherever text is drawn".

Note also that these commands operate within the context of an hdc
(as im sure you noted already) so that they must be repeated for
any newly obtained hdc, such as when a BeginPaint command is called
or within an onPaint event.  You probably know this already but i
just wanted to mention it so no problems develop down the road for
anyone else that might be interested also.

As a last note, you may wish to look up the functions i've mentioned
in order to check their spelling and parameter accuracy in case i made
a mistake typing them out.


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

3. Re: Euveiwer3 questin for Al

Al Getz wrote:
> 
> don cole wrote:
> > 
> > Hello Al,
> > 
> >         retv=win:SetTextColor(hdc,#FFA0FF)--violet
> >         retv=win:SetBkColor(hdc,TRANSPARENT)--
> >     TextOutEx(hdc,LeftMargin,TopMargin,"my stuff")
> > 
> > The text background color comes up Black.
> > 
> > How can I make it transparent or whatever the picture color is behind it?
> > 
> > I'm working on adding zoom.
> > 
> > Don Cole
> >  A Bug is an un-documented feature.
> > A Feature is a documented Bug.
> 
> Hi there Don,
> 
> 
> Well, there are a few functions to keep in mind when writing
> text...
> 
>   SetTextColor
>   SetBkColor
>   SetBkMode
> 
> SetTextColor  sets the text color (the lettering itself).
> SetBkColor    sets the background color where the text itself prints
>               (but only if mode=OPAQUE).
> SetBkMode     sets the mode, and the mode determines if the background
>               will be colored with the "BkColor", or transparent.
>               SetBkMode with a value of OPAQUE means the back color
>               set with SetBkColor will be painted just behind the text,
>               while using a value of TRANSPARENT means whatever color
>               already exists (from a previous paint) will show behind
>               the text.
> 
> It sounds like you want to make the background mode transparent, so you
> would set the background mode something like this:
> 
> retv=win:SetBkMode(hdc,TRANSPARENT)
> 
> Note that once in the back mode of 'TRANSPARENT' the background
> color setting will not have any effect.  Thus in the two lines:
> 
>   retv=win:SetBkMode(hdc,TRANSPARENT)
>   retv=win:SetBkColor(hdc,#FFFFFF)
> 
>   SetBkColor wont have any effect in your app (still sets it however)
>   unless SetBkMode is called later with a value of OPAQUE instead
>   of TRANSPARENT, because TRANSPARENT effectively says "dont use back
>   color and allow previous back paint to show through" while 
>   OPAQUE says "use the back color, overwriting previous back paint
>   wherever text is drawn".
> 
> Note also that these commands operate within the context of an hdc
> (as im sure you noted already) so that they must be repeated for
> any newly obtained hdc, such as when a BeginPaint command is called
> or within an onPaint event.  You probably know this already but i
> just wanted to mention it so no problems develop down the road for
> anyone else that might be interested also.
> 
> As a last note, you may wish to look up the functions i've mentioned
> in order to check their spelling and parameter accuracy in case i made
> a mistake typing them out.
> 
> 
> Take care,
> Al
> 
> And, good luck with your Euphoria programming!
> 
> My bumper sticker: "I brake for LED's"

Yes Thank you Al ,

I was confusing mode with color.

TRANSARENT is a mode not a color.

Don Cole
 A Bug is an un-documented feature.
A Feature is a documented Bug.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu