Welcome to Sign in | Help

Re: Background image to a button Visual C#

  •  05-23-2008, 5:38 PM

    Re: Background image to a button Visual C#

    Este un CustomControl. Eu de fapt vreau sa aliniez la stanga un text pe un buton. Dar nush sa converstesc anumite metode din Windows Control Library ... in Smart Device Control Library...pt ca metodele nu sunt aceleasi...asa ca m-am gandit sa inserez nishte imagini cu textul meu.

    Aveti vreo idee de conversie?

    Acesta este codul in Windows Control Library:

    protected override void OnPaint(PaintEventArgs e)

    {

    // Calling the base class OnPaint

    base.OnPaint(e);

    string text2 = " Biblioteca";

    using (Font font2 = new Font("Arial", 11, FontStyle.Bold, GraphicsUnit.Point))

    {

    Rectangle rect2 = new Rectangle(0, 0, 170, 30);

    // Create a TextFormatFlags with // Create a TextFormatFlags with left, vertical center and single line alignment.

    TextFormatFlags flags = TextFormatFlags.Left |

    TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine;

    // Draw the text and the surrounding rectangle.

    TextRenderer.DrawText(e.Graphics, text2, font2, rect2, Color.Black, flags);

    e.Graphics.DrawRectangle(Pens.Black, rect2);

    }

    }

     

    Mersi mult!

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems