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


C# StringFormat.Dispose方法代码示例

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


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

示例1: RepertoryImage

        public static void RepertoryImage(Graphics drawDestination)
        {
            StringFormat itemStringFormat = new StringFormat();
            RectangleF itemBox = new RectangleF(10, 30, 42, 10);
            RectangleF itemBox2 = new RectangleF(60, 48, 10, 10);
            itemStringFormat.Alignment = StringAlignment.Center;
            itemStringFormat.LineAlignment = StringAlignment.Far;
            drawDestination.DrawLine(Pens.LightGray,10,10,10,70);
            if (mMscStyle == MscStyle.SDL){
                PointF[] capPolygon = new PointF[3];
                capPolygon[0] = new PointF(61, 40);
                capPolygon[1] = new PointF(53, 44);
                capPolygon[2] = new PointF(53, 36);
                drawDestination.FillPolygon(Brushes.Black,capPolygon);
                drawDestination.DrawString("Lost",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox2,itemStringFormat);
                drawDestination.DrawLine(Pens.Black,10, 40, 60,40);
                drawDestination.FillEllipse(Brushes.Black, new RectangleF(60,35, 10,10));
            }
            else if(mMscStyle == MscStyle.UML2){

                drawDestination.DrawString("Lost",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox2,itemStringFormat);
                drawDestination.DrawLine(Pens.Black,10, 40, 60,40);
                drawDestination.DrawLine(Pens.Black,60, 40, 54,43);
                drawDestination.DrawLine(Pens.Black,60, 40, 54,37);
                drawDestination.FillEllipse(Brushes.Black, new RectangleF(60,35, 10,10));

            }
            itemStringFormat.Dispose();
        }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:31,代码来源:LostMessageExtension.cs

示例2: RepertoryImage

 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(15, 30, 50, 20);
     itemStringFormat.Alignment = StringAlignment.Center;
     itemStringFormat.LineAlignment = StringAlignment.Center;
     drawDestination.DrawLine(Pens.LightGray,40,10,40,70);
     if (mMscStyle == MscStyle.SDL){
         PointF[] statePolygon = new PointF[6];
         statePolygon[0] = new PointF(5,40);
         statePolygon[1] = new PointF(15,30);
         statePolygon[2] = new PointF(65,30);
         statePolygon[3] = new PointF(75,40);
         statePolygon[4] = new PointF(65,50);
         statePolygon[5] = new PointF(15,50);
         drawDestination.FillPolygon(Brushes.White,statePolygon);
         drawDestination.DrawString("State",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
         drawDestination.DrawPolygon(Pens.Black,statePolygon);
     }
     else if(mMscStyle == MscStyle.UML2){
             drawDestination.FillRectangle(Brushes.White,itemBox);
             drawDestination.FillEllipse(Brushes.White,5,30,20,20);
             drawDestination.FillEllipse(Brushes.White,55,30,20,20);
             drawDestination.DrawLine(Pens.Black,15,30,65,30);
             drawDestination.DrawLine(Pens.Black,15,50,65,50);
             drawDestination.DrawArc(Pens.Black,5,30,20,20,90,180);
             drawDestination.DrawArc(Pens.Black,55,30,20,20,270,180);
             drawDestination.DrawString("State",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     }
     itemStringFormat.Dispose();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:31,代码来源:StateExtension.cs

示例3: RepertoryImage

 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(10, 20, 60, 20);
     float[] pattern = {4f,4f};
     Pen rPen = new Pen(Color.Black);
     rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
     rPen.DashPattern = pattern;
     itemStringFormat.Alignment = StringAlignment.Center;
     itemStringFormat.LineAlignment = StringAlignment.Center;
     drawDestination.DrawLine(Pens.LightGray,10,10,10,70);
     drawDestination.DrawLine(Pens.LightGray,55,50,55,70);
     drawDestination.DrawLine(Pens.Black,10,45,40,45);
     if (mMscStyle==MscStyle.SDL){
         PointF[] messagePolygon = new PointF[3];
         messagePolygon[0] = new PointF(40, 45);
         messagePolygon[1] = new PointF(40-8, 45-4);
         messagePolygon[2] = new PointF(40-8, 45+4);
         drawDestination.FillPolygon(Brushes.Black,messagePolygon);
     }
     else if (mMscStyle==MscStyle.UML2){
         drawDestination.DrawLine(Pens.Black,40, 45,40-8, 45-4);
         drawDestination.DrawLine(Pens.Black,40, 45,40-8, 45+4);
     }
     drawDestination.DrawRectangle(Pens.Black, 40,40,30,10);
     drawDestination.DrawString("Create",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     rPen.Dispose();
     itemStringFormat.Dispose();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:29,代码来源:ProcessCreateExtension.cs

示例4: RepertoryImage

 public static void RepertoryImage(Graphics drawDestination, ItemPos position)
 {
     StringFormat itemStringFormat = new StringFormat();
     if (position == ItemPos.Left){
         drawDestination.DrawLine(Pens.DarkGray,70,10,70,70);
         RectangleF itemBox = new RectangleF(15, 12, 60, 14);
         itemStringFormat.Alignment = StringAlignment.Near;
         itemStringFormat.LineAlignment = StringAlignment.Near;
         drawDestination.DrawLine(Pens.Black,15,30,70,30);
         drawDestination.DrawLine(Pens.Black,11,26,19,34);
         drawDestination.DrawLine(Pens.Black,11,34,19,26);
         drawDestination.DrawString("StopTimer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     }
     else if (position == ItemPos.Right){
         drawDestination.DrawLine(Pens.DarkGray,10,10,10,70);
         RectangleF itemBox = new RectangleF(11, 12, 60, 14);
         itemStringFormat.Alignment = StringAlignment.Near;
         itemStringFormat.LineAlignment = StringAlignment.Near;
         drawDestination.DrawLine(Pens.Black,10,30,65,30);
         drawDestination.DrawLine(Pens.Black,61,26,69,34);
         drawDestination.DrawLine(Pens.Black,61,34,69,26);
         drawDestination.DrawString("StopTimer",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     }
     itemStringFormat.Dispose();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:25,代码来源:StopTimerExtension.cs

示例5: WndProc

        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case (int)Msgs.WmPaint:

                    base.WndProc(ref m);

                    using (Graphics g = Graphics.FromHwnd(Handle))
                    {
                        g.SmoothingMode = SmoothingMode.HighQuality;

                        g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;

                        StringFormat format = new StringFormat();

                        // format.Alignment = StringAlignment.Center;
                        // format.LineAlignment = StringAlignment.Center;

                        Brush labelBrush = new SolidBrush(ForeColor);
                        Rectangle rect = new Rectangle(0, 0, Bounds.Width, Bounds.Height);
                        g.DrawStringWithGraphicsPath(Text, Font, labelBrush, rect, format);

                        format.Dispose();
                    }

                    break;

                default:
                    base.WndProc(ref m);
                    break;
            }
        }
开发者ID:solitas,项目名称:SolitasWinformControllib,代码行数:33,代码来源:AdvencedLabel.cs

示例6: monthCalendar1_DayRender

        private void monthCalendar1_DayRender(object sender, Pabo.Calendar.DayRenderEventArgs e)
        {
            Brush bgBrush =  new SolidBrush(Color.White);
            Brush dateBrush = new SolidBrush(Color.Black);
            Font dateFont = new Font("Microsoft Sans Serif",(float)8.25);
            StringFormat dateAlign = new StringFormat();

            dateAlign.Alignment = StringAlignment.Far;
            dateAlign.LineAlignment = StringAlignment.Near;

            Rectangle rect = new Rectangle(0,0,e.Width,e.Height);

            // Set OwnerDraw = true to override built in formatting...
            e.OwnerDraw = true;
            // ...then Draw the appearance of the date
            e.Graphics.FillRectangle(bgBrush,rect);
            e.Graphics.DrawString(e.Date.Day.ToString(),
                   dateFont,dateBrush,rect,dateAlign);

            // Clean up
            bgBrush.Dispose();
            dateBrush.Dispose();
            dateAlign.Dispose();
            dateFont.Dispose();
        }
开发者ID:kanke,项目名称:cal,代码行数:25,代码来源:Form9.cs

示例7: RepertoryImage

 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(5, 15, 30, 15);
     RectangleF itemBox2 = new RectangleF(5, 35, 70, 15);
     itemStringFormat.Alignment = StringAlignment.Near;
     itemStringFormat.LineAlignment = StringAlignment.Near;
     PointF[] statePolygon = new PointF[5];
     statePolygon[0] = new PointF(5,15);
     statePolygon[1] = new PointF(40,15);
     statePolygon[2] = new PointF(40,25);
     statePolygon[3] = new PointF(35,30);
     statePolygon[4] = new PointF(5,30);
     drawDestination.FillPolygon(Brushes.White,statePolygon);
     drawDestination.DrawPolygon(Pens.LightGray,statePolygon);
     drawDestination.DrawRectangle(Pens.LightGray,5,15,70,50);
     drawDestination.DrawString("frag",new Font("Arial",8,FontStyle.Regular),Brushes.LightGray,itemBox,itemStringFormat);
     Pen rPen = new Pen(Color.Black);
     float[] pattern = {4f,4f};
     rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
     rPen.DashPattern = pattern;
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("separator",new Font("Arial",8,FontStyle.Italic),Brushes.Black,itemBox2,itemStringFormat);
     drawDestination.DrawLine(rPen, 5, 50, 75, 50);
     rPen.Dispose();
     itemStringFormat.Dispose();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:27,代码来源:InLineSeperatorExtension.cs

示例8: DrawPanel

        public virtual void DrawPanel(DrawItemEventArgs e)
        {
            string text = base.Text;
            if ((text != null) && (text.Length != 0))
            {
                int num = 0;
                StringFormat format = new StringFormat(StringFormatFlags.NoWrap);
                format.LineAlignment = StringAlignment.Center;
                format.HotkeyPrefix = HotkeyPrefix.Hide;
                format.Trimming = StringTrimming.EllipsisCharacter;
                switch (base.Alignment)
                {
                    case HorizontalAlignment.Right:
                        format.Alignment = StringAlignment.Far;
                        break;

                    case HorizontalAlignment.Center:
                        format.Alignment = StringAlignment.Center;
                        break;

                    default:
                        format.Alignment = StringAlignment.Near;
                        num = 3;
                        break;
                }
                Rectangle layoutRectangle = new Rectangle((e.Bounds.X + 1) + num, e.Bounds.Y, (e.Bounds.Width - 2) - num, e.Bounds.Height);
                e.Graphics.DrawString(base.Text, base.Parent.Font, SystemBrushes.ControlText, layoutRectangle, format);
                format.Dispose();
            }
            this.DrawPanelBorder(e);
        }
开发者ID:ikvm,项目名称:webmatrix,代码行数:31,代码来源:MxStatusBarPanel.cs

示例9: RepertoryImage

 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(5, 20, 70, 20);
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("Message",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     if (mMscStyle == MscStyle.SDL){
         drawDestination.DrawLine(Pens.Black,5,55,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,75,35);
         PointF[] messagePolygon = new PointF[3];
         messagePolygon[0] = new PointF(5, 55);
         messagePolygon[1] = new PointF(5+8, 55-4);
         messagePolygon[2] = new PointF(5+8, 55+4);
         drawDestination.FillPolygon(Brushes.Black,messagePolygon);
     }
     else if(mMscStyle == MscStyle.UML2){
         drawDestination.DrawLine(Pens.Black,5,55,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,75,35);
         drawDestination.DrawLine(Pens.Black,5,55,5+8, 55-4);
         drawDestination.DrawLine(Pens.Black,5,55,5+8, 55+4);
     }
     itemStringFormat.Dispose();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:25,代码来源:MessageBeginExtension.cs

示例10: RepertoryImage

 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(10, 30, 60, 20);
     float[] pattern = {4f,4f};
     Pen rPen = new Pen(Color.Black);
     rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
     rPen.DashPattern = pattern;
     itemStringFormat.Alignment = StringAlignment.Center;
     itemStringFormat.LineAlignment = StringAlignment.Center;
     drawDestination.DrawLine(Pens.LightGray,10,10,10,70);
     drawDestination.DrawLine(rPen,10,20,70,20);
     drawDestination.DrawLine(rPen,10,60,70,60);
     PointF[] capPolygon = new PointF[3];
     capPolygon[0] = new PointF(65, 19);
     capPolygon[1] = new PointF(69, 11);
     capPolygon[2] = new PointF(61, 11);
     drawDestination.DrawPolygon(Pens.Black,capPolygon);
     capPolygon[0] = new PointF(65, 61);
     capPolygon[1] = new PointF(69, 69);
     capPolygon[2] = new PointF(61, 69);
     drawDestination.DrawPolygon(Pens.Black,capPolygon);
     drawDestination.DrawLine(rPen,65,20,65,60);
     drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     rPen.Dispose();
     itemStringFormat.Dispose();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:27,代码来源:MeasureBeginExtension.cs

示例11: TerrainEditorControl

        public TerrainEditorControl()
        {
            InitializeComponent();

            int itemHieght = m_header + m_thumbSize + 6;
            m_decoList.ItemHeight = itemHieght;
            m_layerList.ItemHeight = itemHieght;

            m_decoList.DrawItem2 += DrawItem;
            m_layerList.DrawItem2 += DrawItem;
            
            m_addBtn.Image = ResourceUtil.GetImage16(ATFResources.AddImage);
            m_deleteBtn.Image = ResourceUtil.GetImage16(ATFResources.RemoveImage);
            m_moveUpBtn.Image = ResourceUtil.GetImage16(ATFResources.ArrowUpImage);
            m_moveDownBtn.Image = ResourceUtil.GetImage16(ATFResources.ArrowDownImage);

            Application.Idle += (sender, e) =>
                {
                    UpdateButtonStatus();
                };

            m_thumbnailReslovers = Globals.MEFContainer.GetExportedValues<IThumbnailResolver>();

            // create no-tex bmp.
            m_noTexBmp = new Bitmap(m_thumbSize, m_thumbSize);
            Graphics g = Graphics.FromImage(m_noTexBmp);
            StringFormat strFormat = new StringFormat();
            strFormat.Alignment = StringAlignment.Center;
            strFormat.LineAlignment = StringAlignment.Center;
            g.Clear(Color.White);
            Rectangle texRect = new Rectangle(0, 0, m_noTexBmp.Width, m_noTexBmp.Height);

            g.DrawString("No\n\rTexture", Font, Brushes.Red, texRect, strFormat);
            strFormat.Dispose();
            g.Dispose();


            m_flattenRdo.Text = "Flatten".Localize();
            m_flattenRdo.Tag = new FlattenBrush(m_flattenRdo.Text);

            m_brushRiseLowRdo.Text = "Raise/Lower".Localize();
            m_brushRiseLowRdo.Tag = new RaiseLowerBrush(m_brushRiseLowRdo.Text);

            m_brushSmoothRdo.Text = "Smooth".Localize();
            m_brushSmoothRdo.Tag = new SmoothenBrush(m_brushSmoothRdo.Text);

            m_noiseRdo.Text = "Noise".Localize();
            m_noiseRdo.Tag = new NoiseBrush(m_noiseRdo.Text);
            
            m_paintEraseRdo.Text = "Paint/Erase".Localize();
            m_paintEraseRdo.Tag = new PaintEraseBrush(m_paintEraseRdo.Text);


            SizeChanged += (sender, e) =>
                {
                    m_propertyGrid.Width = Width - m_propertyGrid.Left;
                    m_brushProps.Width = Width - m_brushProps.Left;                    
                };            
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:59,代码来源:TerrainEditorControl.cs

示例12: OnPaint

        public override void OnPaint(PaintEventArgs pe, ISkinProvider skin)
        {
            StringFormat drawFormat = new StringFormat();

            pe.Graphics.DrawString(TextLabel, skin.PrimaryFont, skin.PrimaryFontColor, Margin.Left, Offset.Y + Margin.Top, drawFormat);
            pe.Graphics.DrawString(TextValue, skin.SecondaryFont, skin.SecondaryFontColor, Size.Width - TextRenderer.MeasureText(TextValue, skin.SecondaryFont).Width - Margin.Left, Offset.Y + Margin.Top, drawFormat);

            drawFormat.Dispose();
        }
开发者ID:rudolf-kajan,项目名称:GDIControlLibrary2015,代码行数:9,代码来源:LabelComponent.cs

示例13: OnPaint

        public override void OnPaint(PaintEventArgs pe, ISkinProvider skin)
        {
            StringFormat drawFormat = new StringFormat();

            pe.Graphics.DrawString(TextLabel, skin.PrimaryFont, skin.PrimaryFontColor, Margin.Left, Offset.Y + Margin.Top, drawFormat);
            pe.Graphics.DrawString(TextValue, skin.SecondaryFont, skin.SecondaryFontColor,
                new RectangleF(Margin.Left, Offset.Y + 3 * Margin.Top, Size.Width - (Margin.Left+Margin.Right), Size.Height - 3 * Margin.Top));

            drawFormat.Dispose();
        }
开发者ID:rudolf-kajan,项目名称:GDIControlLibrary2015,代码行数:10,代码来源:DescriptionComponent.cs

示例14: IsLoadingDialog_Paint

 private void IsLoadingDialog_Paint(object sender, PaintEventArgs e)
 {
     Graphics gr = e.Graphics;
     Font font = new Font(Font.FontFamily, 18F);
     StringFormat sf = new StringFormat();
     sf.Alignment = StringAlignment.Center;
     gr.DrawString(String.Format(RShare.Properties.Resources.StealthNetIsClosing,Core.Version), font, Brushes.AntiqueWhite, new RectangleF(new PointF(16F, 302F), new SizeF(489F, 37F)), sf);
     sf.Dispose();
     font.Dispose();
 }
开发者ID:Steeslice,项目名称:StealthNet-Alt,代码行数:10,代码来源:IsClosingDialog.cs

示例15: RepertoryImage

 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(20, 30, 50, 20);
     itemStringFormat.Alignment = StringAlignment.Center;
     itemStringFormat.LineAlignment = StringAlignment.Center;
     drawDestination.DrawLine(Pens.LightGray,20,10,20,50);
     drawDestination.DrawLine(Pens.Black,16,46,24,54);
     drawDestination.DrawLine(Pens.Black,24,46,16,54);
     drawDestination.DrawString("Stop",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     itemStringFormat.Dispose();
 }
开发者ID:xueliu,项目名称:MSC_Generator,代码行数:12,代码来源:ProcessStopExtension.cs


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