Difference between revisions of "Graphics.Handle"

From Xojo Documentation

(SMBot: new page by automated transformation)
 
(Changed from read-only property to Method)
 
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{PropertyBox
+
{{MethodBox
| name=Handle
+
| name = Handle
| owner=[[Graphics]]
+
| owner = [[Graphics]]
| ownertype=class
+
| ownertype = class
| scope=public
+
| scope = public
| parameters=Type as [[Integer]]
+
| parameters = Type as [[Graphics.HandleTypes]]
| type=[[Integer]]
+
| returntype = [[Ptr]]
 
| platform=all
 
| platform=all
| readonly=yes
 
 
}}
 
}}
Gets the OS Handle for the passed Type. Pass a '''Graphics''' class constant to specify the Type. <br />
+
{{Description
 +
|text = Gets the OS Handle for the passed Type. Pass the appropriate [[Graphics.HandleTypes]] value to specify the Type. }}
  
The class constants are as follows:<br />
+
== Notes ==
 +
Handle will return nil if the requested [[Graphics.HandleTypes|handle type]] is not available or is not supported.
  
1-HandleTypeHDC. Gets the HDC on Windows. <br />
+
== Sample Code ==
 
+
This code gets a handle to the port of the Graphics object on Mac and iOS.
2-HandleTypeCGrafPtr. Gets the QuickDraw CGrafPtr on Macintosh. <br />
+
<rbcode>
 
+
Var h As Ptr = g.Handle(Graphics.HandleTypes.CGContextRef)
3-HandleTypeGdkDrawablePtr. Gets the GdkDrawable * on Linux. <br />
+
</rbcode>
 
 
4-HandleTypeGdkGCPtr. Gets the GdkGC * on Linux.<br />
 
 
 
5-HandleTypeCGContextRef<br />
 
 
 
6-HandleTypeGDIPlusGraphics. Obtains a handle to a GDI+ graphics handle. This requires that [[Application|App]].UseGDIPlus is enabled.<font color="green"><i>Introduced 2009r4</i></font><br />
 
 
 
Handle will return zero if the requested handle Type is not available or is not supported.
 

Latest revision as of 17:16, 19 November 2020

Method

Graphics.Handle(Type as Graphics.HandleTypes) As Ptr

Supported for all project types and targets.

Gets the OS Handle for the passed Type. Pass the appropriate Graphics.HandleTypes value to specify the Type.

Notes

Handle will return nil if the requested handle type is not available or is not supported.

Sample Code

This code gets a handle to the port of the Graphics object on Mac and iOS.

Var h As Ptr = g.Handle(Graphics.HandleTypes.CGContextRef)