当前位置: 首页>>代码示例>>C#>>正文


C# Gdk.Contains方法代码示例

本文整理汇总了C#中Gdk.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Contains方法的具体用法?C# Gdk.Contains怎么用?C# Gdk.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdk的用法示例。


在下文中一共展示了Gdk.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDockTarget

		public bool GetDockTarget (DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect)
		{
			outrect = Gdk.Rectangle.Zero;
			dockDelegate = null;
			
			if (item != this.item && this.item.Visible && rect.Contains (px, py)) {

				// Check if the item is allowed to be docked here
				var s = Frame.GetRegionStyleForObject (this);

				int xdockMargin = (int) ((double)rect.Width * (1.0 - DockFrame.ItemDockCenterArea)) / 2;
				int ydockMargin = (int) ((double)rect.Height * (1.0 - DockFrame.ItemDockCenterArea)) / 2;
				DockPosition pos;
				
/*				if (ParentGroup.Type == DockGroupType.Tabbed) {
					rect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);
					pos = DockPosition.CenterAfter;
				}*/				
				if (px <= rect.X + xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
					if (s.SingleColumnMode.Value)
						return false;
					outrect = new Gdk.Rectangle (rect.X, rect.Y, xdockMargin, rect.Height);
					pos = DockPosition.Left;
				}
				else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
					if (s.SingleColumnMode.Value)
						return false;
					outrect = new Gdk.Rectangle (rect.Right - xdockMargin, rect.Y, xdockMargin, rect.Height);
					pos = DockPosition.Right;
				}
				else if (py <= rect.Y + ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
					if (s.SingleRowMode.Value)
						return false;
					outrect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, ydockMargin);
					pos = DockPosition.Top;
				}
				else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
					if (s.SingleRowMode.Value)
						return false;
					outrect = new Gdk.Rectangle (rect.X, rect.Bottom - ydockMargin, rect.Width, ydockMargin);
					pos = DockPosition.Bottom;
				}
				else {
					outrect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);
					pos = DockPosition.Center;
				}
				
				dockDelegate = delegate (DockItem dit) {
					DockGroupItem it = ParentGroup.AddObject (dit, pos, Id);
					it.SetVisible (true);
					ParentGroup.FocusItem (it);
				};
				return true;
			}
			return false;
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:56,代码来源:DockGroupItem.cs

示例2: DrawCaret

		public void DrawCaret (Gdk.Drawable win, Gdk.Rectangle area)
		{
			if (Settings.Default.CursorBlink && !caretBlink || HexEditorData.IsSomethingSelected) 
				return;
			if (caretGc == null) {
				caretGc = new Gdk.GC (win);
				caretGc.RgbFgColor = new Color (255, 255, 255);
				caretGc.Function = Gdk.Function.Xor;
			}
			long caretY = HexEditorData.Caret.Line * LineHeight - (long)HexEditorData.VAdjustment.Value;
			int caretX;
			if (HexEditorData.Caret.InTextEditor) {
				caretX = textEditorMargin.CalculateCaretXPos ();
			} else {
				caretX = hexEditorMargin.CalculateCaretXPos ();
			}
			
			if (!area.Contains (caretX, (int)caretY))
				return;
			
			if (HexEditorData.Caret.IsInsertMode) {
				win.DrawRectangle (caretGc, true, new Gdk.Rectangle (caretX, (int)caretY, 2, LineHeight));
			} else {
				win.DrawRectangle (caretGc, true, new Gdk.Rectangle (caretX, (int)caretY, textEditorMargin.charWidth, LineHeight));
			}
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:26,代码来源:HexEditor.cs


注:本文中的Gdk.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。