October 20, 2011

gcroot and pin_ptr

Reference managed type members in an unmanaged class by using the "gcroot<>" template. This provides a wrapper around the GCHandle class.
Look at this msdn explanantion
Also there is this article on codeproject
gcroot str;
str = gcnew String("hello");
Pinning in C++/CLI. Do this using the pin_ptr keyword. This prevents the managed object from being moved around in memory by the garbage collector
Object ^obj = gcnew MyClass();
pin_ptr pinned = obj;

October 12, 2011

CSS Positioning Concepts

CSS unit of measurement 1ex= width of letter "x"

CSS Positioning Concepts
CSS Positioning
Positioning in 10 easy steps with pictures - very good

“position:relative”
The “position:relative” is best used when you want to adjust some element's position slightly. The “relative” means it is relative to the parent tag's rendering box. More here

"position:fixed"
Position is fixed to the browser window. For example "<div style="position:fixed; right:1ex; bottom:1ex">" fixes to the bottom right hand corner of the browser window. More from the original source
When a element is “position:fixed”, it is moved into a layer by itself. Use the "z-index" parameter to specify if it is on top or below the over elements. Again, more here

October 6, 2011

Printing HTML

To initiate the Print of a web page use the following HTML and Javascript:
<a href="javascript:window.print()">Print Page</a> 
This is how the link looks: Print Page

There is more on this at Htmlgoodies