Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8281009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:53:07+00:00 2026-06-08T09:53:07+00:00

I use a library for drawing outline text from here http://www.codeproject.com/Articles/42529/Outline-Text I Wrote a

  • 0

I use a library for drawing outline text from here http://www.codeproject.com/Articles/42529/Outline-Text

I Wrote a function for test amd I tried to save outlineText Graphics object as Bitmap
Graphic object draw on control Correctly but when I save it as image the result image is empty

        Graphics graphic = this .CreateGraphics();
        graphic.SmoothingMode = SmoothingMode.AntiAlias;
        StringFormat fmt = new StringFormat(StringFormat.GenericTypographic);
        Int32 lNum = (Int32)Math.Log((Double)this.TextAlign, 2);
        fmt.LineAlignment = (StringAlignment)(lNum / 4);
        fmt.Alignment = (StringAlignment)(lNum % 4);

        OutlineText m_OutlineText = new OutlineText();            

        m_OutlineText.EnableShadow(true);
        m_OutlineText.SetNullShadow();
        m_OutlineText.Shadow(ShadowColor, ShadowSize, new Point(4, 4));
        FontFamily fontFamily = this.Font.FontFamily;
        float fStartX = 0.0f;
        float fStartY = 0.0f;
        float fDestWidth = 0.0f;
        float fDestHeight = 0.0f;
        m_OutlineText.MeasureString(
            graphic,
            fontFamily,
            this.Font.Style,
            (int)this.Font.Size,
            this.Text,
            new Point(10, 10),
            fmt,
            ref fStartX,
            ref fStartY,
            ref fDestWidth,
            ref fDestHeight);

        LinearGradientBrush gradientBrush = new LinearGradientBrush(new RectangleF(fStartX, fStartY, fDestWidth - (fStartX - 10), fDestHeight - (fStartY - 10)),
           GrediantA, GrediantB, LinearGradientMode.Vertical);
        m_OutlineText.TextOutline(gradientBrush, OutlineColor, OutlineSize);
        if (_myRc == null)
        {
            _myRc = ClientRectangle;
        }
        m_OutlineText.DrawString(graphic, fontFamily, this.Font.Style, (int)this.Font.Size, this.Text, _myRc, fmt);


      _textImage = new Bitmap(this.Width, this.Height, graphic);
      _textImage.Save(@"C:\bmp.jpg");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:53:10+00:00Added an answer on June 8, 2026 at 9:53 am

    Constructor: Bitmap(Int32, Int32, Graphics) initializes a new instance of the Bitmap class with the specified size and with the resolution of the specified Graphics object. It should be empty. Only resolution of Graphics will be used.

    If you want to draw something on the bitmap and save that, than create graphics from bitmap:

    using(Bitmap bitmap = new Bitmap(Width, Height))
    using (Graphics graphics = Graphics.FromImage(bitmap))
    {
        Rectangle rect = new Rectangle(0, 0, Width, Height);
        graphics.FillRectangle(new SolidBrush(BackColor), rect);
        graphics.DrawString("Hello, World", Font, new SolidBrush(ForeColor), rect);
        bitmap.Save(@"D:\hello_world.bmp");
    } 
    

    If you want to draw on your control and save it’s image to file, use Control.DrawToBitmap method.

    BTW bitmap should have .bmp extension, it’s not JPEG image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

such as the CreateTeapot function - http://msdn.microsoft.com/en-us/library/windows/desktop/bb172798(v=vs.85).aspx Is there an equivalent in DX10? If
I'm trying to make a working program from this example: http://msdn.microsoft.com/en-us/library/ms741870.aspx . I think
I followed the video tutorial on http://graphsharp.com on how to use graph# library with
I use SharpSvn library from CollabNET. I would like to set revision author while
I use this library: https://github.com/robbiehanson/CocoaAsyncSocket My test code: #import <UIKit/UIKit.h> @class GCDAsyncUdpSocket; @interface ThirdViewController
I am trying to use FileHelper library for parsing a text file. Ultimately the
I use some javascript library for drawing charts. It need to pass arrays with
i use gpgraph library for charts drawing. i need to dinamicaly create graphs, so
I am trying to use Aspose.Words library through COM Interop. There is one critical
In the project I am currently working on http://sourcecodecloud.codeplex.com/ I have a library containing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.