|
<html dir="ltr" xmlns:mshelp="http://msdn.microsoft.com/mshelp"
xmlns:silverlightsdk="http://msdn.microsoft.com/silverlight" xmlns=
"http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="online documentation, web online help, web help, chm2web" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="chm2web Standard 2.7 (unicode)" />
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8" />
<title>StylusInfo Object</title>
<link rel="stylesheet" href="../../default.css" type="text/css" />
<script type="text/JavaScript" src="../../files/supply.js"></script>
<script type="text/JavaScript">
chmtop.c2wtopf.pageid = "reference/o_stylusinfo.htm";
</script>
</head>
<body topmargin="0"><script type="text/JavaScript">
if (window.name != "content")
document.write(" <table width=\"100%\" bgcolor=\"#e1e1e1\"cellspacing=\"2\" cellpadding=\"0\" style=\"border-collapse: collapse; font-family: sans-serif; font-size: 14px; color: #000000; text-decoration: none; \"> <tr> <td align=\"center\" style=\"border-bottom: 2px solid gray\" > <br> Click <a href=\"../../index.html?page=source%2freference%2fo_stylusinfo.htm\">here</a> to show toolbars of the Web Online Help System: <a href=\"../../index.html?page=source%2freference%2fo_stylusinfo.htm\">show toolbars</a><br> </td></tr></table><br> ");
</script>
<!-- !chm2web! -->
<span id="sdkbannersection"></span>
<div class="tableSection"><span id="sdkbannersection"></span>
<table class="buttonbarshade" cellspacing="0">
<tr>
<td> </td>
</tr>
</table>
</div>
<div class="tableSection"><span id="sdkbannersection"></span>
<table class="buttonbartable" cellspacing="0">
<tr id="hdr">
<td class="runninghead" nowrap="nowrap"><img src=
"../common/logo.png" height="21" alt="Silverlight SDK" />
</td>
</tr>
</table>
</div>
<p><span class="betaboilerplate"><font color="gray" pointsize="8.5"
face="Verdana">[This topic is pre-release documentation and is
subject to change in future releases. Blank topics are included as
placeholders.]</font></span>
</p>
<h1><a name="silverlight_stylusinfo_object"></a>StylusInfo
Object</h1>
<div id="mainSection">
<div id="mainBody">
<p>Represents information about the state of the stylus.</p>
<h4>Syntax</h4>
<div class="tableSection">
<table id="syntaxtable">
<tr>
<th class="syntaxblocklanguage" nowrap="nowrap" style=
"width: 150px; background: #EEEEEE; vertical-align: top;">XAML</th>
<td class="syntaxblockcode" style="background:white;">
<div class="codesyntax">Cannot be used in XAML.</div>
</td>
</tr>
</table>
</div>
<div class="tableSection">
<table id="scriptingSyntaxBlock">
<tr>
<th class="syntaxblocklanguage" nowrap="nowrap" style=
"width: 150px; background: #EEEEEE; vertical-align: top;">
Scripting</th>
<td class="syntaxblockcode" style="background:white;">
<div class="codesyntax">To create an object using scripting, see
<a href=
"m_silverlightcontrol_createfromxaml.htm">CreateFromXAML</a>.</div>
</td>
</tr>
</table>
</div>
<h4>Properties</h4>
<p><a href="p_stylusinfo_isinverted.htm">IsInverted</a>, <a href=
"p_dependencyobject_name.htm">Name</a>, <a href=
"p_stylusinfo_devicetype.htm">DeviceType</a></p>
<h4>Methods</h4>
<p><a href="m_dependencyobject_getvalue.htm">GetValue</a>, <a href=
"m_dependencyobject_setvalue.htm">SetValue</a></p>
<h4>Events</h4>
<h4>Example</h4>
<p>The following example uses the PressureFactor property to
determine the size of a stroke. The PressureFactor is obtained from
the first StylusPoint of each stroke, then the stroke Width and
Height is calculated by multiplying the PressureFactor by 20.</p>
<div class="snippetdistributor_codesnippet" id=
"pressure_ink_snip#PressureInk">
<div style="width: 99%;">
<table class="codeexampletable" style=
"border: 1px solid #999999; background: #CCCCCC; width: 99%;">
<tr>
<th class="codelanguagecell" style=
"background: #CCCCCC; text-align: left;">JavaScript</th>
</tr>
<tr>
<td class="codeblockcell" style=
"background: #e6e6e6; border: none;">
<pre class="codeblock" style=
"background: transparent; border: none; margin: 0px; padding: 0px; font-family:'Courier New', Courier, monospace;">
var agCtrl;
var inkPresenter; // Corresponds to InkPresenter element in xaml
var newStroke = null; // The Stroke variable we'll use here in mouse handlers
var daWidth;
var daHeight;
function root_Loaded(sender, args)
{
// Get the html object which contains the Silverlight plugin
agCtrl = sender.GetHost();
inkPresenter = sender.findname("inkPresenterElement");
}
// Capture mouse movement when the left button is pressed then create the stroke.
function InkPresenterMouseDown(sender,args)
{
inkPresenter.CaptureMouse();
newStroke = agCtrl.content.createFromXaml('<Stroke/>');
// Get the DeviceType
if(args.GetStylusInfo().deviceType == "Stylus")
{
var sps = args.GetStylusPoints(inkPresenter);
SetStylusStrokeSize(sps);
}
// If the device type is not a stylus then use the default stroke height and width.
else
{
daWidth = 3;
daHeight = 3;
}
// Set the drawing attributes properties
newStroke.DrawingAttributes.Width = daWidth;
newStroke.DrawingAttributes.Height = daHeight;
newStroke.DrawingAttributes.Color = "Blue";
newStroke.DrawingAttributes.OutlineColor = "Orange";
newStroke.StylusPoints.AddStylusPoints(args.GetStylusPoints(inkPresenter));
inkPresenter.Strokes.Add(newStroke);
}
// Add the new points to the Stroke we're working with
function InkPresenterMouseMove(sender,args)
{
if (newStroke != null)
{
newStroke.StylusPoints.AddStylusPoints(args.GetStylusPoints(inkPresenter));
}
}
// Release the mouse
function InkPresenterMouseUp(sender,args)
{
newStroke = null;
}
// Set the size of the stroke based on the initial pressureFactor of the stroke.
function SetStylusStrokeSize(sps)
{
var p;
// Set variable p to the first StylusPoint in the Stroke
p = sps.getItem(0).pressureFactor;
daWidth = p * 20.0;
daHeight = p * 20.0;
}
</pre>
</td>
</tr>
</table>
</div>
</div>
<h4>See Also</h4>
<p>
<!-- <a href="../conceptual/c_silverlight_shapes.htm">Shapes Overview</a>, -->
</p>
</div>
</div>
<script type="text/JavaScript">
var fe = FindFrame("toc", top);
if ((fe != null) && (chmtop.c2wtopf.jstree != null)) {
if (chmtop.c2wtopf.FITEMS[chmtop.c2wtopf.pagenum] != chmtop.c2wtopf.pageid)
chmtop.c2wtopf.jstree.OpenTreeNode("source/" + chmtop.c2wtopf.pageid);
}
</script>
<!-- CHM2WEB -->
<!-- DO NOT DELETE OR MODIFY THIS CODE WITHOUT
WRITTEN PERMISSION OF A!K RESEARCH LABS -->
<table width="100%" cellspacing="0" cellpadding="0"
style="margin-top: 0pt; border-collapse: collapse;">
<tr> <td align="right" style="background-color:white; border-top: 1px solid gray;">
<a href="http://chm2web.aklabs.com" target="_blank" style="font-family: sans-serif; font-size: 11px; text-decoration: none;"><font color="gray">Converted from CHM to HTML with <b>chm2web Standard 2.7 (unicode)</b></font></a>
</td></tr></table>
<!-- /CHM2WEB -->
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Justin-Josef Angel is a C# Microsoft Most Valuable professional, a Senior .Net consultant in Israel with 4 years of .Net experience and has 8 years of Web experience.
Justin's been working this past year on two Enterprise sized Silverlight projects with his customers. During that time he's gained a real-insight into Silverlight's inner workings and how to integrate Silverlight into the real world of software development. Additionally, During that time he's developed a few well-known projects like the "Silverlight 1.0 Javascript Intellisense", "Silverlight 1.1 Hebrew & Arabic Languages support" and a few others you might know.
Justin is also a seasoned presenter with an impressive track-record of talking in front of thousands of people in Israel.
Justin owns the first .Net blog written in Hebrew -
http://www.JustinAngel.Net .
And he also owns an additional blog with mixed Hebrew & English content -
http://blogs.Microsoft.co.il/blogs/JustinAngel.
A full list of his articles (all 100+ of them) can be found at:
http://www.JustinAngel.Net/#index