How do I find position of a Win32 control/window relative to its parent window?

The solution is using the combined power of GetWindowRect() and MapWindowPoints(). GetWindowRect() retrieves the coordinates of a window relative to the entire screen area you see on your monitor. We need to convert these absolute coordinates into relative coordinates of our main window area. The MapWindowPoints() transforms the coordinates given relative to one window into … Read more

Accessing the item at a specified index in a ‘SortedSet’

That’s because a SortedSet has the semantics of a set and is not a List-like construct. Consequently, it does not implement IList (which give you the ability to address items by index via the Item property). As noted by @DavidRR, you could use the Linq extension method Enumerable.ElementAt(). However, since the backing store of a … Read more

Hide scrollable content behind transparent fixed position divs when scrolling the page?

Just coming to this late, but in case anyone else runs across this in the future, here’s your fix. Your CSS Code: .wrapper { width:100%; position:fixed; z-index:10; background:inherit; } .bottom-wrapper { width:100%; padding-top:92px; z-index:5; overflow:auto; } Your HTML: <div class=”wrapper”> …your header here… </div> <div class=”bottom-wrapper”> …your main content here… </div> This will provide you … Read more

How can you move the cursor to the last position of a textarea in Javascript?

xgMz’s answer was best for me. You don’t need to worry about the browser: var html = $(“#MyTextArea”).val(); $(“#MyTextArea”).focus().val(“”).val(html); And here’s a quick jQuery extension I wrote to do this for me next time: ; (function($) { $.fn.focusToEnd = function() { return this.each(function() { var v = $(this).val(); $(this).focus().val(“”).val(v); }); }; })(jQuery); Use like this: … Read more

Break element out of container

Another idea, which in modern browsers does stretch the .breakout only to the width of the browser window: body, html { overflow-x: hidden; margin: 0; padding: 0; } div { padding:0.5em; } .container { width:300px; background-color:rgba(255,255,0,0.5); margin:auto; } .breakout { margin:1em -100%; /* old browsers fallback */ margin:1em calc(50% – 50vw); background-color:rgba(255,0,255,0.5) } <div class=”container”> … Read more

tech