IonicWind Software

IWBasic => General Questions => Topic started by: celphick on April 11, 2009, 10:26:35 PM

Title: Finding the current pen colour
Post by: celphick on April 11, 2009, 10:26:35 PM
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.
Title: Re: Finding the current pen colour
Post by: Ionic Wind Support Team on April 11, 2009, 11:45:52 PM
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.
Title: Re: Finding the current pen colour
Post by: celphick on April 12, 2009, 10:25:46 PM
Thank you. That is exactly what I wanted.