Inactive caption text color in Windows 10 - windows

In Windows 10, how do you get the color of inactive caption text?
In the example below, "Untitled - Notepad" is gray when window is inactive:
But the color I get is black when I try the following functions:
color = GetSysColor(COLOR_INACTIVECAPTIONTEXT);
//color = black, wrong
HTHEME htheme = OpenThemeData(hwnd, L"WINDOW");
color = GetThemeSysColor(htheme, COLOR_INACTIVECAPTIONTEXT);
//color = black, wrong
GetThemeColor(htheme, WP_CAPTION, CS_INACTIVE, TMT_TEXTCOLOR, &color);
//color = black, wrong
DrawThemeText and DrawThemeTextEx also print the inactive caption in black.
All of these functions work fine in Windows 7 because inactive caption remains the same color, only the Aero glass thing changes color. But it's not the same in Windows 10.

Related

Gtk TextView - how to change width of cursor?

I'm using a Gtk TextView in a small Ruby program. The text cursor is a vertical bar, only 1 pixel wide. I have changed its colour to red but it is still barely visible. Can it be made wider?
require "gtk2"
tl = Gtk::Window.new
vb = Gtk::VBox.new false, 0
tl.add vb
sw = Gtk::ScrolledWindow.new
tview = Gtk::TextView.new
tbuf = Gtk::TextBuffer.new
tview.set_buffer tbuf
tview.set_wrap_mode Gtk::TextTag::WRAP_WORD
tview.set_justification Gtk::JUSTIFY_FILL
font = Pango::FontDescription.new "Serif, 11"
tview.modify_font font
red = Gdk::Color.new 65535, 20000, 20000
tview.modify_cursor red, red
sw.add tview
vb.pack_start sw, true, true, 0
tl.show_all
tbuf.set_text %(I'm using a Gtk TextView in a small Ruby program. The text cursor is a vertical bar, only 1 pixel wide. I have changed its colour to red but it is still barely visible. Can it be made wider?)
Gtk.main

CATScript - Text, Lines and Frames in Black

The code is as below (CATScript):
Sub CATMain()
' enter sheet background
Set oView = oDrawingDocument.DrawingRoot.ActiveSheet.Views.Item("Background View")
oView.Activate
' select all views in current screen
Set oSelection = oDrawingDocument.Selection
oSelection.Search "Type=*,scr"
' set visual to black
oSelection.VisProperties.SetRealColor 0, 0, 0, 0
' exit sheet background
Set oView = oDrawingDocument.DrawingRoot.ActiveSheet.Views.Item("Main View")
oView.Activate
End Sub
The code works seamlessly except that oSelection.VisProperties.SetRealColor 255, 255, 255, 0 does not change any of the selected lines and frames to black in my 2D drawing. Manually I can do this so pretty sure I'm just using the wrong syntax. SetVisibleColor neither works, but then also I can only find that these syntaxes are used for changing color in 3D and I am using it for a 2D drawing. Anyone here knows the syntax to manipulate the color icon in the 'Graphic Properties' workspace for a 2D drawing?
This is the solution I found after some research and trial&error:
'CHANGE LINE COLOR
Set oSelectionGI = oDrawingDocument.Selection
oSelectionGI.Search("CATDrwSearch.CATEarlyGenItem,all")
oSelectionGI.VisProperties.SetRealColor 0,0,0,0
'CHANGE TEXT COLOR
Set oSelectionDC = oDrawingDocument.Selection
oSelectionDC.Search("CATDrwSearch.DrwText,all")
oSelectionDC.VisProperties.SetRealColor 0,0,0,0
'CHANGE TABLE COLOR
Set oSelectionDT = oDrawingDocument.Selection
oSelectionDT.Search("CATDrwSearch.DrwTable,all")
oSelectionDT.VisProperties.SetRealColor 0,0,0,0

AHK: How to change window transparency when window is not active?

I would like to change the GUI to transparent when the window is not active.
Add this in the beginning of the code:
OnMessage(0x06, "WM_ACTIVATE") ;TRIGGER FUNCTION WHEN WINDOW'S ACTIVE STATUS IS CHANGED
Add this function to your code:
WM_ACTIVATE()
{
IfWinActive, MyWindow
WinSet, Transparent, 255, MyWindow ; TRANSPARENCY OFF
else
WinSet, Transparent, 200, MyWindow ; SET TRANSPARENCY BETWEEN 0-255
}

NSBezierPath Stroke color is wrong

I want to draw a 1px wide border around my custom NSView in DrawRect with NSBezierPath:
BorderColor.Set();
var path = NSBezierPath.FromRect(theRect);
path.LineWidth = 1;
path.Stroke();
Now BorderColor is set to NSColor.Gray, which I can see while debugging has an RGBA color code: (127,127,127,255)
But the 1px wide border which appears on the screen gets this color: (194,194,194,255)
When I set the path.LineWidth to 3, than I can see the 3 lines, the middle with wrong color (194..), the 2 wings with color (135,135,135,255) - which is close enough to the wanted (127..) color to be ok.
When I use four piece of 1px wide rectangles for border instead, and Fill these 4 rects, I also get the (135..) color, which is ok again.
I can use this rectangle based solution, I'm only wondering:
Is there a way to achieve the correct color for a 1px wide border with NSBezierPath.Stroke?
Assuming you're setting the stroke color correctly (we don't see how BorderColor is set up) it might be the case that you're measuring the color value on screen, which - in particular for a thin line - might have been anti-aliased so you're not seeing the original color but the output of the anti-aliasing algorithm.
Set the width to something bigger like 10 and measure the color in the middle of the 'blob' to make sure you're not chasing anti-aliasing artefacts..

Mathematica : Add text to imported image / graphic as a label

Ive searched for hours ... but Im at a loss !
I have imported an image int Mathematica -> dimensions 2x2cm at 72DPI.
I am trying to "label" the image with a text string that:
- has font color "fontColor"
- has a black outline, so it contrasts to any underlying color
- sits in the bottom right corner of the imported image
- has size h/w in cm
- optionally sits in a text box with a white background
This is how far ive come:
MathCode:
image = Import["myimg.jpg"];
inchFactor = 2.54;(* 1 inch = 2.54cm *)
docRes = 72;
pixelConverter = docRes/inchFactor/2;
myText = First[
First[ImportString[
ExportString[
Style["glorious label string here", Bold, FontSize -> 15,
FontFamily -> "Verdana"], "PDF"], "PDF",
"TextMode" -> "Outlines"]]];
myTextGraphic =
Graphics[{EdgeForm[Directive[Black, Thickness[0.01]]], White,
myText}, Background -> White,
ImageSize -> {10*pixelConverter, 2*pixelConverter}];
myTextGraphic = Rasterize[myTextGraphic];
combined = SetAlphaChannel[myTextGraphic, myTextGraphicAlphaVersion];
I found the above method (PDF wrapper) for the black outline of the text string.
I am adding an AlphaChannel to the graphic of the text string using a version of it that only uses black/white.
I then try to combine the images with Overlay.
As none of this seems to work concerning the outputted image size and positioning, Im kindly asking for help.
ThereĀ“s no need to "fix" that messy code.
Maybe you could point me to a script or tutorial - all I really want is to add and position a text string or text box to an underlying image.
Thanks a lot !
Have a look at this. There are other ways too.
img = Import["http://todayinsci.com/H/Hilbert_David/HilbertDavidThm.jpg"];
Column[{
img,
Text[Style["Professor Hilbert", Red]]
}]
imgCtr = Round[ImageDimensions[img]/2];
overlay = Framed[Graphics[{Text[Style["Professor Hilbert", Red, 9], imgCtr]},ImageSize-> {66, 14}], FrameStyle -> Green]
Overlay[{img, overlay}, Alignment -> Center]
It's late here so this is only the beginning of a solution for you but here's a simple way to add a text label to an image:
lbl = Graphics[Text[Style["Bottom", Red, Large]]]
which creates an image with the text 'Bottom' in red in a large font. Next, given an image called img1
ImageCompose[img1,lbl]
puts the text in the centre of the image. ImageCompose has options to allow you to position the second image (ie the label) wrt the first image. You can put the label on a coloured background like this:
lbl = Graphics[Text[Style["Bottom", Red, Large, Background -> Blue]]]
I haven't figured out, yet, how to write the text with a coloured outline.

Resources