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


C# TextLayout.Dispose方法代码示例

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


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

示例1: OptionsChanged

		internal protected override void OptionsChanged ()
		{
			var layout = new TextLayout (Editor);
			layout.Font = Editor.Options.Font;
			layout.Text = string.Format ("0{0:X}", Data.Length) + "_";
//			int height;
			width = layout.GetSize ().Width;
			layout.Dispose ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:9,代码来源:GutterMargin.cs

示例2: OptionsChanged

		internal protected override void OptionsChanged ()
		{
			var layout = new TextLayout (Editor);
			layout.Font = Editor.Options.Font;
			layout.Text = ".";
//			int height;
			charWidth = layout.GetSize ().Width;
			layout.Dispose ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:9,代码来源:TextEditorMargin.cs

示例3: OptionsChanged

		internal protected override void OptionsChanged ()
		{
			var layout = new TextLayout (Editor);
			layout.Font = Editor.Options.Font;
			layout.Text = "!";
//			int tmp;
			this.marginWidth = layout.GetSize ().Height;
			marginWidth *= 12;
			marginWidth /= 10;
			layout.Dispose ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:11,代码来源:IconMargin.cs

示例4: OptionsChanged

		internal protected override void OptionsChanged ()
		{
			var layout = new TextLayout (Editor);
			layout.Font = Editor.Options.Font;
			string groupString = new string ('0', Editor.Options.GroupBytes * 2);
			layout.Text = groupString + " ";
			double lineHeight;
			var sz = layout.GetSize ();
			groupWidth = sz.Width;
			lineHeight = sz.Height;
			 
			Data.LineHeight = lineHeight;
			
			layout.Text = "00";
			byteWidth = layout.GetSize ().Width;

			layout.Dispose ();
			
//			tabArray = new Pango.TabArray (1, true);
//			tabArray.SetTab (0, Pango.TabAlign.Left, groupWidth);
		}
开发者ID:jrhtcg,项目名称:monodevelop,代码行数:21,代码来源:HexEditorMargin.cs

示例5: Draw

		internal void Draw (DrawingPathBackendHandler targetHandler, object ctx, VectorImageData cm)
		{
			int di = 0;
			int ci = 0;
			int ii = 0;
			int ri = 0;
			int oi = 0;
			int imi = 0;
			int ti = 0;

			ContextBackendHandler handler = targetHandler as ContextBackendHandler;
			DrawingPathBackendHandler pathHandler = targetHandler;

			for (int n=0; n<cm.Commands.Length; n++)
			{
				switch (cm.Commands [n]) {
				case DrawingCommand.AppendPath:
					var p = cm.Objects [oi++];
					if (p is VectorImageData)
						Draw (targetHandler, ctx, (VectorImageData)p);
					else
						pathHandler.AppendPath (ctx, p);
					break;
				case DrawingCommand.Arc:
					pathHandler.Arc (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.ArcNegative:
					pathHandler.ArcNegative (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.Clip:
					handler.Clip (ctx);
					break;
				case DrawingCommand.ClipPreserve:
					handler.ClipPreserve (ctx);
					break;
				case DrawingCommand.ClosePath:
					pathHandler.ClosePath (ctx);
					break;
				case DrawingCommand.CurveTo:
					pathHandler.CurveTo (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.DrawImage2:
					handler.DrawImage (ctx, cm.Images [imi++], cm.Rectangles [ri++], cm.Rectangles [ri++]);
					break;
				case DrawingCommand.DrawImage:
					handler.DrawImage (ctx, cm.Images [imi++], cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.DrawTextLayout:
					var lad = (TextLayoutData)cm.TextLayouts [ti++];
					var la = new TextLayout (toolkit);
					lad.InitLayout (la);
					handler.DrawTextLayout (ctx, la, cm.Doubles [di++], cm.Doubles [di++]);
					la.Dispose();
					break;
				case DrawingCommand.Fill:
					handler.Fill (ctx);
					break;
				case DrawingCommand.FillPreserve:
					handler.FillPreserve (ctx);
					break;
				case DrawingCommand.LineTo:
					pathHandler.LineTo (ctx, cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.MoveTo:
					pathHandler.MoveTo (ctx, cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.NewPath:
					handler.NewPath (ctx);
					break;
				case DrawingCommand.Rectangle:
					pathHandler.Rectangle (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.RelCurveTo:
					pathHandler.RelCurveTo (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.RelLineTo:
					pathHandler.RelLineTo (ctx, cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.RelMoveTo:
					pathHandler.RelMoveTo (ctx, cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.Restore:
					handler.Restore (ctx);
					break;
				case DrawingCommand.Rotate:
					handler.Rotate (ctx, cm.Doubles [di++]);
					break;
				case DrawingCommand.Save:
					handler.Save (ctx);
					break;
				case DrawingCommand.Scale:
					handler.Scale (ctx, cm.Doubles [di++], cm.Doubles [di++]);
					break;
				case DrawingCommand.SetColor:
					handler.SetColor (ctx, cm.Colors [ci++]);
					break;
				case DrawingCommand.SetGlobalAlpha:
					handler.SetGlobalAlpha (ctx, cm.Doubles [di++]);
					break;
				case DrawingCommand.SetLineDash:
//.........这里部分代码省略.........
开发者ID:TheBrainTech,项目名称:xwt,代码行数:101,代码来源:VectorImage.cs

示例6: Refresh

        /// <summary>
        /// Refresh the specified scan.
        /// </summary>
        /// <param name="scan">Scan.</param>
        /// <param name="changedFiberType">Set to true, if the fibertype of the given scan has changed</param>
        void Refresh(BaseScan scan, bool changedFiberType = false)
        {
            Image thumbnail = store.GetNavigatorAt(scan.position).GetValue(thumbnailCol);
            TreePosition currentNode = scan.position;

            if (changedFiberType) {
                TreePosition parentNodePosition;
                if (fiberTypeNodes.ContainsKey(scan.FiberType)) {
                    parentNodePosition = fiberTypeNodes[scan.FiberType];
                } else {

                    TextLayout text = new TextLayout();
                    text.Text = scan.FiberType;
                    ImageBuilder ib = new ImageBuilder(text.GetSize().Width, text.GetSize().Height);
                    ib.Context.DrawTextLayout(text, Point.Zero);

                    parentNodePosition = store.AddNode(null).SetValue(thumbnailCol, ib.ToBitmap()).CurrentPosition;
                    fiberTypeNodes[scan.FiberType] = parentNodePosition;

                    text.Dispose();
                    ib.Dispose();

                }
                store.GetNavigatorAt(currentNode).Remove();
                scan.position = currentNode = store.AddNode(parentNodePosition).CurrentPosition;

                ExpandToRow(scan.position);
                ScrollToRow(scan.position);
                SelectRow(scan.position);

                scan.parentPosition = parentNodePosition;
            }

            store.GetNavigatorAt(currentNode)
                .SetValue(nameCol, scan.ToString())
                .SetValue(thumbnailCol, thumbnail)
                .SetValue(finishCol, scan.IsFinish() ? tick : cross)
                .SetValue(saveStateCol, scan.HasUnsaved() ? "*" : "");

            if (DataSource.GetChildrenCount(scan.parentPosition) <= 0) {
                store.GetNavigatorAt(scan.parentPosition).Remove();
            }

            // update filtered store
            if (!string.IsNullOrEmpty(filterText)) {
                storeFilter.GetNavigatorAt(scan.positionFiltered)
                    .SetValue(nameColFilter, scan.ToString())
                    .SetValue(thumbnailColFilter, thumbnail)
                    .SetValue(finishColFiltered, scan.IsFinish() ? tick : cross)
                    .SetValue(saveStateColFilter, scan.HasUnsaved() ? "*" : "");

                if (changedFiberType) {
                    Filter(filterText);
                }
            }
        }
开发者ID:jfreax,项目名称:BAIMP,代码行数:61,代码来源:FileTreeView.cs

示例7: OnKeyPressed

        protected override void OnKeyPressed(KeyEventArgs args)
        {
            base.OnKeyPressed(args);
            switch (args.Key) {
            case Key.Delete:
                TreeStore currentStore = DataSource as TreeStore;

                if (currentStore != null) {
                    TreeNavigator selected = currentStore.GetNavigatorAt(SelectedRow);

                    if (selected != null) {
                        Dialog d = new Dialog();
                        d.Title = "Remove this scan";

                        VBox nameList = new VBox();
                        ScrollView nameListScroll = new ScrollView(nameList);

                        foreach (TreePosition selectPos in SelectedRows) {
                            nameList.PackStart(
                                new Label(currentStore.GetNavigatorAt(selectPos)
                                .GetValue(isFiltered ? nameColFilter : nameCol))
                            );
                        }
                        TextLayout text = new TextLayout();
                        text.Text = "M";
                        double textHeight = text.GetSize().Height;
                        text.Dispose();

                        nameListScroll.MinHeight = Math.Min(10, SelectedRows.Length) * textHeight;
                        d.Content = nameListScroll;
                        d.Buttons.Add(new DialogButton(Command.Delete));
                        d.Buttons.Add(new DialogButton(Command.Cancel));

                        Command r = d.Run();
                        if (r != null && r.Id == Command.Delete.Id) {
                            foreach (TreePosition selectPos in SelectedRows) {
                                string name = currentStore.GetNavigatorAt(selectPos)
                                    .GetValue(isFiltered ? nameColFilter : nameCol);
                                if (!string.IsNullOrEmpty(name)) {
                                    currentStore.GetNavigatorAt(selectPos).Remove();

                                    scanCollection.RemoveAll(scan => scan.Name == name);
                                }
                            }
                        }
                        d.Dispose();
                    }
                }
                break;
            }
        }
开发者ID:jfreax,项目名称:BAIMP,代码行数:51,代码来源:FileTreeView.cs

示例8: Reload

        /// <summary>
        /// Reloads file tree information.
        /// </summary>
        /// <param name="scans">Collection of loaded scans</param>
        /// <param name="currentScan">Current focused scan</param>
        /// <param name="save">Update scan collection</param>
        public void Reload(ScanCollection scans, BaseScan currentScan = null, bool save = true)
        {
            if (scans.Count > 0) {
                scans.Sort(scans[0]);
            }

            if (save) {
                scanCollection = scans;
            }

            DataSource = store;
            store.Clear();

            TreePosition pos = null;
            fiberTypeNodes = new Dictionary<string, TreePosition>();
            foreach (BaseScan scan in scans) {
                TreePosition currentNode;
                if (fiberTypeNodes.ContainsKey(scan.FiberType)) {
                    currentNode = fiberTypeNodes[scan.FiberType];
                } else {
                    TextLayout text = new TextLayout();
                    text.Text = scan.FiberType;
                    ImageBuilder ib = new ImageBuilder(text.GetSize().Width, text.GetSize().Height);
                    ib.Context.DrawTextLayout(text, Point.Zero);

                    currentNode = store.AddNode(null).SetValue(thumbnailCol, ib.ToVectorImage()).CurrentPosition;
                    fiberTypeNodes[scan.FiberType] = currentNode;

                    text.Dispose();
                    ib.Dispose();
                }

                var v = store.AddNode(currentNode)
                    .SetValue(nameCol, scan.ToString())
                    .SetValue(finishCol, scan.IsFinish() ? tick : cross)
                    .SetValue(saveStateCol, scan.HasUnsaved() ? "*" : "")
                    .CurrentPosition;
                scan.position = v;
                scan.parentPosition = currentNode;
                if (currentScan != null) {
                    if (currentScan == scan) {
                        pos = v;
                    }
                } else {
                    if (pos == null) {
                        pos = v;
                    }
                }

                scan.ScanDataChanged += OnScanDataChanged;
            }

            if (scans.Count > 0) {
                ExpandToRow(pos);
                SelectRow(pos);
            }

            LoadPreviewsAsync(scans);
        }
开发者ID:jfreax,项目名称:BAIMP,代码行数:65,代码来源:FileTreeView.cs

示例9: OnSelectionChanged

        protected override void OnSelectionChanged(EventArgs e)
        {
            if (SelectedRow == null)
                return;

            object value = store.GetNavigatorAt(SelectedRow).GetValue(nameCol);
            if (value is BaseAlgorithm) {

                TextLayout text = new TextLayout();
                text.Text = value.ToString();

                Size textSize = text.GetSize();
                var ib = new ImageBuilder(textSize.Width, textSize.Height);
                ib.Context.DrawTextLayout(text, 0, 0);

                var d = CreateDragOperation();
                d.Data.AddValue(value.GetType().AssemblyQualifiedName);
                d.SetDragImage(ib.ToVectorImage(), -6, -4);
                d.AllowedActions = DragDropAction.Link;
                d.Start();

                d.Finished += (object sender, DragFinishedEventArgs e2) => this.UnselectAll();

                text.Dispose();
                ib.Dispose();
            } else {
                this.UnselectRow(SelectedRow);
            }
        }
开发者ID:jfreax,项目名称:BAIMP,代码行数:29,代码来源:AlgorithmTreeView.cs


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