October 29, 2025, 10:41:12 AM

News:

IWBasic runs in Windows 11!


Finding the current pen colour

Started by celphick, April 11, 2009, 10:26:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

celphick

I have looked in the manual and used the forum search to see if there is a way to identify the colour in use.
I can work around it by drawing a dot and identifying the pixel colour. Not very elegant.
Is there a nicer answer? I will continue to look.

Ionic Wind Support Team

April 11, 2009, 11:45:52 PM #1 Last Edit: April 12, 2009, 10:30:29 PM by Paul Turley
I am assuming you are using an Emergence created window, and want to return the color you have set with the FRONTPEN statement. The FRONTPEN color can be obtained by getting the current text color.

declare import,GetTextColor(hdc as UINT),UINT

uint hdc = GetHDC(win)
fclr = GetTextColor(hdc)
ReleaseHDC(win,hdc)

The color set by the BACKPEN statement is stored in a member of the WINDOW udt.

bclr = win.m_cBack

If you are looking for some other color then you'll need to be more specific. 

Paul.
Ionic Wind Support Team

celphick

Thank you. That is exactly what I wanted.