Re: Writing text in colors

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message -----
From: "Andy Drummond" <kestrelandy at xalt.co.uk>


> I want to write text, over & over again, into the same text box
> controls, in different foreground OR background color without the
> resources getting eaten up like they are when I use setWindowBkColor()
> and setText().


If you do this in C:

while 1 do
    brush = CreateSolidBrush (RGB (rand ()%255, rand ()%255, rand ()%255)
    SelectObject (hdc, brush)
    Ellipse (hdc, 0, 0, 100, 100)
    DeleteObject (brush)
end while

it won't work. After some time brush won't be created correct, it will be
allways
white (or something similar). That's what has happend to me several times
when I was programming in
C on win9x.

What I suggest is to pre-create all your brushes, pens on program startup
and save them in sequence. Delete them when program closes.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu