翻譯|使用教程|編輯:況魚杰|2020-08-20 10:08:47.633|閱讀 379 次
概述:TX Text Control提供了非常強大的圖形功能,可以將許多不同類型的形狀插入文檔中。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Text Control GmbH公司的文檔處理控件功能強大,能幫助您輕松創建能與Microsoft Word功能媲美的應用程序。
TX Text Control提供了非常強大的圖形功能,可以將許多不同類型的形狀插入文檔中。 功能區的“插入”選項卡提供了開箱即用的UI,可將形狀添加到文檔中:
添加單一形狀
為了以編程方式插入這些形狀,需要執行幾個步驟:
// create a drawing control that contains the shape(s) TXTextControl.Drawing.TXDrawingControl drawing = new TXTextControl.Drawing.TXDrawingControl(3000, 3000); // create a new donut shape TXTextControl.Drawing.Shape shape = new TXTextControl.Drawing.Shape(TXTextControl.Drawing.ShapeType.Donut); // set the color and border width shape.ShapeFill.Color = Color.Red; shape.ShapeOutline.Color = Color.Yellow; shape.ShapeOutline.Width = 200; // add the shape to the drawing control drawing.Shapes.Add( shape, TXTextControl.Drawing.ShapeCollection.AddStyle.Fill); // create a new drawing frame object from the created drawing control TXTextControl.DataVisualization.DrawingFrame frame = new TXTextControl.DataVisualization.DrawingFrame(drawing); // add the frame to the document textControl1.Drawings.Add(frame, -1);
textControl1.Drawings.Add(frame, TXTextControl.FrameInsertionMode.DisplaceText);
添加容器組框架
以下代碼顯示了如何在組框架中插入更多形狀。 如果容器組框架被移動,則所有包含的形狀將一起移動:
// create a drawing control that contains the shape(s) TXTextControl.Drawing.TXDrawingControl drawingGroup = new TXTextControl.Drawing.TXDrawingControl(3000, 3000); // create a new donut shape TXTextControl.Drawing.Shape donut = new TXTextControl.Drawing.Shape(TXTextControl.Drawing.ShapeType.Donut) { Location = new Point(100, 100), Size = new Size(500,500) }; TXTextControl.Drawing.Shape diamond = new TXTextControl.Drawing.Shape(TXTextControl.Drawing.ShapeType.Diamond); // add the shape to the drawing control drawingGroup.Shapes.Add(donut); drawingGroup.Shapes.Add(diamond); // create a new drawing frame object from the created drawing control TXTextControl.DataVisualization.DrawingFrame frame = new TXTextControl.DataVisualization.DrawingFrame(drawingGroup); // add the frame to the document textControl1.Drawings.Add( frame, textControl1.InputPosition.Location, TXTextControl.FrameInsertionMode.DisplaceText);以下屏幕截圖顯示了已激活的組容器框架,其中插入了2個形狀:
向容器添加其他形狀
如果激活了容器框架(虛線邊框),則可以添加其他形狀。 以下代碼將新形狀插入到已激活的容器框架中:
// create a new donut shape TXTextControl.Drawing.Shape shape = new TXTextControl.Drawing.Shape(TXTextControl.Drawing.ShapeType.Donut); // set the color and border width shape.ShapeFill.Color = Color.Red; shape.ShapeOutline.Color = Color.Yellow; shape.ShapeOutline.Width = 200; if (textControl1.Drawings.GetActivatedItem() != null) { // add the shape to the drawing control ((TXDrawingControl)textControl1.Drawings.GetActivatedItem().Drawing).Shapes.Add(shape); }如果希望用戶將其他形狀繪制到容器中,則必須在Shapes.Add方法中使用MouseCreation成員。
((TXDrawingControl)textControl1.Drawings.GetActivatedItem().Drawing).Shapes.Add( shape, ShapeCollection.AddStyle.MouseCreation);
文章推薦:
TX Text Control系列教程— ASP.NET :創建文字處理器和模板設計器
如果您對Text Control感興趣,可以咨詢購買正版授權軟件。
關注慧聚IT微信公眾號 ???,了解產品的最新動態及最新資訊。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: