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


C# GuiWidget.Close方法代码示例

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


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

示例1: TextEditTextSelectionTests

		public void TextEditTextSelectionTests()
		{
			GuiWidget container = new GuiWidget();
			container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
			TextEditWidget editField1 = new TextEditWidget("", 0, 0, pixelWidth: 51);
			container.AddChild(editField1);

			// select the conrol and type something in it
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
			SendKey(Keys.A, 'a', container);
			Assert.IsTrue(editField1.Text == "a", "It should have a in it.");

			// select the begining again and type something else in it
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
			SendKey(Keys.B, 'b', container);
			Assert.IsTrue(editField1.Text == "ba", "It should have ba in it.");

			// select the ba and delete them
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
			container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 0, 15, 0, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 15, 0, 0));
			SendKey(Keys.Back, ' ', container);
			Assert.IsTrue(editField1.Text == "", "It should have nothing in it.");

			// select the other way
			editField1.Text = "ab";
			Assert.IsTrue(editField1.Text == "ab", "It should have ab in it.");
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 15, 0, 0));
			container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
			SendKey(Keys.Back, ' ', container);
			Assert.IsTrue(editField1.Text == "", "It should have nothing in it.");

			// select the other way but start far to the right
			editField1.Text = "abc";
			Assert.IsTrue(editField1.Text == "abc", "It should have abc in it.");
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 30, 0, 0));
			container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0));
			SendKey(Keys.Back, ' ', container);
			Assert.IsTrue(editField1.Text == "", "It should have nothing in it.");

			container.Close();
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:46,代码来源:TextEditTests.cs

示例2: TextEditingSpecialKeysWork

		public void TextEditingSpecialKeysWork()
		{
			{
				GuiWidget container = new GuiWidget();
				container.DoubleBuffer = true;
				container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
				TextEditWidget textEdit = new TextEditWidget("some starting text");
				container.AddChild(textEdit);

				container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, textEdit.Height - 1, 0));
				container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, textEdit.Height - 1, 0));

				Assert.IsTrue(textEdit.CharIndexToInsertBefore == 0);
				Assert.IsTrue(textEdit.TopLeftOffset.y == 0);

				Assert.IsTrue(textEdit.Text == "some starting text");
				// this is to select some text
				SendKey(Keys.Shift | Keys.Control | Keys.Right, ' ', container);
				Assert.IsTrue(textEdit.Selection == "some ");
				Assert.IsTrue(textEdit.Text == "some starting text");
				// this is to prove that we don't loose the selection when pressing Control
				SendKeyDown(Keys.Control, container);
				Assert.IsTrue(textEdit.Selection == "some ");
				Assert.IsTrue(textEdit.Text == "some starting text");
				// this is to prove that we don't loose the selection when pressing Shift
				SendKeyDown(Keys.Shift, container);
				Assert.IsTrue(textEdit.Text == "some starting text");
				Assert.IsTrue(textEdit.Selection == "some ");
				SendKeyDown(Keys.Right, container);
				Assert.IsTrue(textEdit.Selection == "");
				SendKey(Keys.Shift | Keys.Control | Keys.Left, ' ', container);
				Assert.IsTrue(textEdit.Selection == "some ");
				SendKey(Keys.Delete, ' ', container);
				Assert.IsTrue(textEdit.Text == "starting text");
				SendKey(Keys.Shift | Keys.Control | Keys.Right, ' ', container);
				Assert.IsTrue(textEdit.Selection == "starting ");

#if(!__ANDROID__)
								// if this fails add
				// GuiHalWidget.SetClipboardFunctions(System.Windows.Forms.Clipboard.GetText, System.Windows.Forms.Clipboard.SetText, System.Windows.Forms.Clipboard.ContainsText);
				// before you call the unit tests
				Clipboard.SetSystemClipboard(new WindowsFormsClipboard());


				SendKey(Keys.Control | Keys.C, 'c', container);
				Assert.IsTrue(textEdit.Selection == "starting ");
				Assert.IsTrue(textEdit.Text == "starting text");
				SendKeyDown(Keys.Right, container); // move to the right
				SendKey(Keys.Control | Keys.V, 'v', container);
				Assert.IsTrue(textEdit.Text == "starting starting text");
#endif

				container.Close();
			}
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:55,代码来源:TextEditTests.cs

示例3: ScrollingToEndShowsEnd

		public void ScrollingToEndShowsEnd()
		{
			GuiWidget container = new GuiWidget();
			container.DoubleBuffer = true;
			container.LocalBounds = new RectangleDouble(0, 0, 110, 30);
			TextEditWidget editField1 = new TextEditWidget("This is a nice long text string", 0, 0, pixelWidth: 100);
			container.AddChild(editField1);

			TextWidget firstWordText = new TextWidget("This");
			RectangleDouble bounds = firstWordText.LocalBounds;
			bounds.Offset(bounds.Left, bounds.Bottom);
			firstWordText.LocalBounds = bounds;

			firstWordText.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
			firstWordText.OnDraw(firstWordText.BackBuffer.NewGraphics2D());
			TextWidget lastWordText = new TextWidget("string");

			bounds = lastWordText.LocalBounds;
			bounds.Offset(bounds.Left, bounds.Bottom);
			lastWordText.LocalBounds = bounds;

			lastWordText.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
			lastWordText.OnDraw(lastWordText.BackBuffer.NewGraphics2D());
			container.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
			container.BackgroundColor = RGBA_Bytes.White;

			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
			Assert.IsTrue(editField1.ContainsFocus == true);

			container.OnDraw(container.BackBuffer.NewGraphics2D());
			OutputImage(firstWordText.BackBuffer, "Control - Left.tga");
			OutputImage(lastWordText.BackBuffer, "Control - Right.tga");
			OutputImage(container.BackBuffer, "Test - Start.tga");

			Vector2 bestPosition;
			double bestLeastSquares;
			container.BackBuffer.FindLeastSquaresMatch(firstWordText.BackBuffer, out bestPosition, out bestLeastSquares);
			Assert.IsTrue(bestLeastSquares < 2000000);
			container.BackBuffer.FindLeastSquaresMatch(lastWordText.BackBuffer, out bestPosition, out bestLeastSquares);
			Assert.IsTrue(bestLeastSquares > 2000000);

			SendKeyDown(Keys.End, container);

			container.OnDraw(container.BackBuffer.NewGraphics2D());
			OutputImage(container.BackBuffer, "Test - Scrolled.tga");

			container.BackBuffer.FindLeastSquaresMatch(firstWordText.BackBuffer, out bestPosition, out bestLeastSquares);
			Assert.IsTrue(bestLeastSquares > 2000000);
			container.BackBuffer.FindLeastSquaresMatch(lastWordText.BackBuffer, out bestPosition, out bestLeastSquares);
			Assert.IsTrue(bestLeastSquares < 2000000);

			container.Close();
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:54,代码来源:TextEditTests.cs

示例4: NumEditHandlesNonNumberChars

		public void NumEditHandlesNonNumberChars()
		{
			{
				GuiWidget container = new GuiWidget();
				container.DoubleBuffer = true;
				container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
				NumberEdit numberEdit = new NumberEdit(0, 0, 0, 12, 200, 16, true, true);
				container.AddChild(numberEdit);

				container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, numberEdit.Height - 1, 0));
				container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, numberEdit.Height - 1, 0));

				Assert.IsTrue(numberEdit.CharIndexToInsertBefore == 0);
				Assert.IsTrue(numberEdit.TopLeftOffset.y == 0);

				// type a . (non numeric character)
				SendKey(Keys.Back, ' ', container);
				SendKey(Keys.Delete, ' ', container);
				SendKey(Keys.OemMinus, '-', container);
				Assert.IsTrue(numberEdit.Value == 0);
				SendKey(Keys.OemPeriod, '.', container);
				Assert.IsTrue(numberEdit.Value == 0);
				SendKey(Keys.D0, '.', container);
				Assert.IsTrue(numberEdit.Value == 0);
				SendKey(Keys.A, 'A', container);
				Assert.IsTrue(numberEdit.Value == 0);

				container.Close();
			}
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:30,代码来源:TextEditTests.cs

示例5: MiltiLineTests

		public void MiltiLineTests()
		{
			{
				InternalTextEditWidget singleLine = new InternalTextEditWidget("test", 12, false, 0);
				InternalTextEditWidget multiLine = new InternalTextEditWidget("test\ntest\ntest", 12, true, 0);
				Assert.IsTrue(multiLine.Height >= singleLine.Height * 3);
			}

			// we get the typed results we expect
			{
				GuiWidget container = new GuiWidget();
				container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
				InternalTextEditWidget multiLine = new InternalTextEditWidget("\n\n\n\n", 12, true, 0);
				container.AddChild(multiLine);

				container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
				container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
				Assert.IsTrue(multiLine.ContainsFocus == true);
				Assert.IsTrue(multiLine.SelectionIndexToStartBefore == 4);
				Assert.IsTrue(multiLine.Text == "\n\n\n\n");
				SendKey(Keys.A, 'a', container);
				Assert.IsTrue(multiLine.Text == "\n\n\n\na");
				SendKey(Keys.Up, ' ', container);
				SendKey(Keys.A, 'a', container);
				Assert.IsTrue(multiLine.Text == "\n\n\na\na");

				container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, multiLine.Height - 1, 0));
				container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, multiLine.Height - 1, 0));
				Assert.IsTrue(multiLine.ContainsFocus == true);
				Assert.IsTrue(multiLine.SelectionIndexToStartBefore == 0);
				Assert.IsTrue(multiLine.Text == "\n\n\na\na");
				SendKey(Keys.A, 'a', container);
				Assert.IsTrue(multiLine.Text == "a\n\n\na\na");
				SendKey(Keys.Down, ' ', container);
				SendKey(Keys.A | Keys.Shift, 'A', container);
				Assert.IsTrue(multiLine.Text == "a\nA\n\na\na");

				container.Close();
			}

			// make sure the insert position is correct when homed
			{
				GuiWidget container = new GuiWidget();
				container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
				InternalTextEditWidget multiLine = new InternalTextEditWidget("line1\nline2\nline3", 12, true, 0);
				container.AddChild(multiLine);

				container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 5, 1, 0));
				container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 5, 1, 0));
				Assert.IsTrue(multiLine.ContainsFocus == true);
				Assert.IsTrue(multiLine.InsertBarPosition.y == -32);
				SendKey(Keys.Home, ' ', container);
				Assert.IsTrue(multiLine.InsertBarPosition.y == -32);
				Assert.IsTrue(multiLine.Text == "line1\nline2\nline3");
				SendKey(Keys.A, 'a', container);
				Assert.IsTrue(multiLine.Text == "line1\nline2\naline3");
				SendKey(Keys.Back, ' ', container);
				Assert.IsTrue(multiLine.Text == "line1\nline2\nline3");
				Assert.IsTrue(multiLine.InsertBarPosition.y == -32);
				container.Close();
			}

			// make sure the insert position is correct when move left to end of line
			{
				GuiWidget container = new GuiWidget();
				container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
				InternalTextEditWidget multiLine = new InternalTextEditWidget("xx", 12, true, 0);
				container.AddChild(multiLine);

				container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
				container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
				Assert.IsTrue(multiLine.ContainsFocus == true);
				Assert.IsTrue(multiLine.CharIndexToInsertBefore == 0);
				Assert.IsTrue(multiLine.InsertBarPosition.x == 0);
				SendKey(Keys.Home, ' ', container);
				Assert.IsTrue(multiLine.CharIndexToInsertBefore == 0);
				Assert.IsTrue(multiLine.InsertBarPosition.x == 0);
				SendKey(Keys.Right, ' ', container);
				Assert.IsTrue(multiLine.CharIndexToInsertBefore == 1);
				double leftOne = multiLine.InsertBarPosition.x;
				SendKey(Keys.Right, ' ', container);
				Assert.IsTrue(multiLine.CharIndexToInsertBefore == 2);
				Assert.IsTrue(multiLine.InsertBarPosition.x == leftOne * 2);
				container.Close();
			}

			// make sure the cursor is at the right hight when it is after a \n that is on the first line
			{
				GuiWidget container = new GuiWidget();
				container.DoubleBuffer = true;
				container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
				InternalTextEditWidget multiLine = new InternalTextEditWidget("\n1\n\n3\n", 12, true, 0);
				Assert.IsTrue(multiLine.LocalBounds.Height == 16 * 5);
				container.AddChild(multiLine);

				container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, multiLine.Height - 1, 0));
				container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, multiLine.Height - 1, 0));

				Assert.IsTrue(multiLine.CharIndexToInsertBefore == 0);
				Assert.IsTrue(multiLine.InsertBarPosition.y == 0);
//.........这里部分代码省略.........
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:101,代码来源:TextEditTests.cs

示例6: TextEditGetsFocusTests

		public void TextEditGetsFocusTests()
		{
			GuiWidget container = new GuiWidget();
			container.Name = "container";
			container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
			TextEditWidget editField1 = new TextEditWidget("", 0, 0, pixelWidth: 160);
			editField1.Name = "editField1";
			container.AddChild(editField1);

			TextEditWidget editField2 = new TextEditWidget("", 0, 20, pixelWidth: 160);
			editField2.Name = "editField2";
			container.AddChild(editField2);

			// select no edit field
			Assert.IsTrue(editField1.Text == "");
			SendKey(Keys.D, 'a', container);
			Assert.IsTrue(editField1.Text == "");
			Assert.IsTrue(editField2.Text == "");

			// select edit field 1
			container.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0)); // we move into the widget to make sure we have seprated focus and enter events.
			Assert.IsTrue(editField1.ContainsFocus == false);
			Assert.IsTrue(editField1.Focused == false);
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
			Assert.IsTrue(editField1.ContainsFocus == true);
			Assert.IsTrue(editField1.Focused == false, "The internal text widget must be focused.");
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
			Assert.IsTrue(editField1.ContainsFocus == true);
			Assert.IsTrue(editField1.Focused == false);
			SendKey(Keys.B, 'b', container);
			Assert.IsTrue(editField1.Text == "b", "It should have b a in it.");
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 150, 1, 0));
			Assert.IsTrue(editField1.ContainsFocus == true);
			Assert.IsTrue(editField1.Focused == false, "The internal text widget must be focused.");
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 150, 1, 0));
			Assert.IsTrue(editField1.ContainsFocus == true);
			Assert.IsTrue(editField1.Focused == false);
			SendKey(Keys.D, 'c', container);
			Assert.IsTrue(editField1.Text == "bc", "It should have b a in it.");

			// select edit field 2
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 21, 0));
			Assert.IsTrue(editField2.ContainsFocus == true);
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, 21, 0));
			SendKey(Keys.D, 'd', container);
			Assert.IsTrue(editField1.Text == "bc", "It should have a bc in it.");
			Assert.IsTrue(editField2.Text == "d", "It should have d in it.");

			container.Close();
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:50,代码来源:TextEditTests.cs

示例7: TextChangedEventsTests

		public void TextChangedEventsTests()
		{
			GuiWidget container = new GuiWidget();
			container.Name = "container";
			container.LocalBounds = new RectangleDouble(0, 0, 200, 200);
			TextEditWidget editField1 = new TextEditWidget("", 0, 0, pixelWidth: 20);
			editField1.Name = "editField1";
			Assert.IsTrue(editField1.BoundsRelativeToParent.Top < 40, "We make this assumption in the code below, so make sure it's true.");
			bool textField1EditComplete = false;
			editField1.EditComplete += (sender, e) => { textField1EditComplete = true; };
			bool textField1LostFocus = false;
			editField1.LostFocus += (sender, e) => { textField1LostFocus = true; };
			bool textField1GotFocus = false;
			editField1.GotFocus += (sender, e) => { textField1GotFocus = true; };
			container.AddChild(editField1);

			TextEditWidget editField2 = new TextEditWidget("", 0, 40, pixelWidth: 20);
			editField2.Name = "editField2";
			container.AddChild(editField2);

			// mouse select on the control when it contains nothing
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
			Assert.IsTrue(textField1GotFocus);
			Assert.IsFalse(textField1EditComplete);
			SendKey(Keys.B, 'b', container);
			Assert.IsTrue(editField1.Text == "b");
			Assert.IsFalse(textField1EditComplete, "We do not change with each keystroke.");
			SendKey(Keys.Enter, '\n', container);
			Assert.IsTrue(textField1EditComplete, "Enter must send a EditComplete if changed.");
			textField1EditComplete = false;
			SendKey(Keys.A, 'a', container);
			Assert.IsTrue(editField1.Text == "ba");
			Assert.IsFalse(textField1EditComplete, "We do not change with each keystroke.");

			Assert.IsFalse(textField1LostFocus);
			textField1GotFocus = false;
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 41, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
			SendKey(Keys.E, 'e', container);
			Assert.IsTrue(textField1LostFocus);
			Assert.IsTrue(textField1EditComplete, "Loosing focus should send a text changed.");
			Assert.IsTrue(editField1.Text == "ba");
			Assert.IsTrue(editField2.Text == "e");

			textField1EditComplete = false;
			textField1LostFocus = false;
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
			Assert.IsFalse(textField1LostFocus);
			Assert.IsFalse(textField1EditComplete);
			container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, 41, 0));
			container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 0, 1, 1, 0));
			Assert.IsTrue(textField1LostFocus);
			Assert.IsFalse(textField1EditComplete, "The text did not change even though we lost focus we should not call textChanged.");

			container.Close();
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:58,代码来源:TextEditTests.cs

示例8: TextWidgetVisibleTest

		public void TextWidgetVisibleTest()
		{
			{
				GuiWidget rectangleWidget = new GuiWidget(100, 50);
				TextWidget itemToAdd = new TextWidget("test Item", 10, 10);
				rectangleWidget.AddChild(itemToAdd);
				rectangleWidget.DoubleBuffer = true;
				rectangleWidget.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
				rectangleWidget.OnDraw(rectangleWidget.BackBuffer.NewGraphics2D());

				ImageBuffer textOnly = new ImageBuffer(75, 20, 32, new BlenderBGRA());
				textOnly.NewGraphics2D().Clear(RGBA_Bytes.White);

				textOnly.NewGraphics2D().DrawString("test Item", 1, 1);

				if (saveImagesForDebug)
				{
					ImageTgaIO.Save(rectangleWidget.BackBuffer, "-rectangleWidget.tga");
					//ImageTgaIO.Save(itemToAdd.Children[0].BackBuffer, "-internalTextWidget.tga");
					ImageTgaIO.Save(textOnly, "-textOnly.tga");
				}

				Assert.IsTrue(rectangleWidget.BackBuffer.FindLeastSquaresMatch(textOnly, 1), "TextWidgets need to be drawing.");
				rectangleWidget.Close();
			}

			{
				GuiWidget rectangleWidget = new GuiWidget(100, 50);
				TextEditWidget itemToAdd = new TextEditWidget("test Item", 10, 10);
				rectangleWidget.AddChild(itemToAdd);
				rectangleWidget.DoubleBuffer = true;
				rectangleWidget.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
				rectangleWidget.OnDraw(rectangleWidget.BackBuffer.NewGraphics2D());

				ImageBuffer textOnly = new ImageBuffer(75, 20, 32, new BlenderBGRA());
				textOnly.NewGraphics2D().Clear(RGBA_Bytes.White);

				TypeFacePrinter stringPrinter = new TypeFacePrinter("test Item", 12);
				IVertexSource offsetText = new VertexSourceApplyTransform(stringPrinter, Affine.NewTranslation(1, -stringPrinter.LocalBounds.Bottom));
				textOnly.NewGraphics2D().Render(offsetText, RGBA_Bytes.Black);

				if (saveImagesForDebug)
				{
					ImageTgaIO.Save(rectangleWidget.BackBuffer, "-rectangleWidget.tga");
					//ImageTgaIO.Save(itemToAdd.Children[0].BackBuffer, "-internalTextWidget.tga");
					ImageTgaIO.Save(textOnly, "-textOnly.tga");
				}

				Assert.IsTrue(rectangleWidget.BackBuffer.FindLeastSquaresMatch(textOnly, 1), "TextWidgets need to be drawing.");
				rectangleWidget.Close();
			}
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:52,代码来源:TextAndTextWidgetTests.cs


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