本文整理汇总了C#中Xwt.Rectangle.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.Contains方法的具体用法?C# Rectangle.Contains怎么用?C# Rectangle.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xwt.Rectangle
的用法示例。
在下文中一共展示了Rectangle.Contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnButtonReleased
protected override void OnButtonReleased (ButtonEventArgs args)
{
base.OnButtonReleased (args);
if (args.Button == PointerButton.Left) {
if (Expanded) {
var headerRect = new Rectangle (0, 0, Size.Width, header.Size.Height + header.MarginTop + header.MarginBottom);
if (!headerRect.Contains (args.Position))
return;
}
Expanded = !Expanded;
}
}
示例2: DrawCaret
public void DrawCaret (Context ctx, Rectangle area)
{
if (!caretBlink || HexEditorData.IsSomethingSelected)
return;
long caretY = HexEditorData.Caret.Line * LineHeight - (long)HexEditorData.VAdjustment.Value;
double caretX;
char ch;
if (HexEditorData.Caret.InTextEditor) {
caretX = textEditorMargin.CalculateCaretXPos (out ch);
} else {
caretX = hexEditorMargin.CalculateCaretXPos (out ch);
}
if (!area.Contains (caretX, (int)caretY))
return;
if (HexEditorData.Caret.IsInsertMode) {
ctx.Rectangle (caretX, (int)caretY, 2, LineHeight);
} else {
ctx.Rectangle (caretX, (int)caretY, textEditorMargin.charWidth, LineHeight);
}
ctx.SetColor (HexEditorStyle.HexDigit);
ctx.Fill ();
if (!HexEditorData.Caret.IsInsertMode) {
using (var layout = new TextLayout (this)) {
layout.Font = Options.Font;
layout.Text = ch.ToString ();
ctx.SetColor (HexEditorStyle.HexDigitBg);
ctx.DrawTextLayout (layout, caretX, caretY);
}
}
}
示例3: OnButtonPressed
protected override void OnButtonPressed(ButtonEventArgs args)
{
base.OnButtonPressed(args);
switch (args.Button) {
case PointerButton.Left:
Rectangle closeRegion = new Rectangle(
Size.Width - closeNormal.Width - (next == null ? padding.Right + Lean.Dx : 0),
(Size.Height - closeNormal.Height) / 2,
closeNormal.Width, closeNormal.Height
);
if (closeRegion.Contains(args.Position)) {
OnTabClosed(this, new CloseEventArgs());
} else {
if (!Managed) {
Active = !Active;
}
if (toggleEvent != null) {
toggleEvent(this, EventArgs.Empty);
}
}
break;
}
}