C # High imitation Tencent QQ (the function navigation on the left of the main panel is drawn based on toolstrip) (source code)

Source: Internet
Author: User

There is no timeCodeIsolated to achieve general purpose, so let's change the code by yourself.

Figure:

Qq

Beautification method:

UseRendererAttributes andToolstriprendererClass CustomizationToolstripAppearance

Call Method

//Author: along)
//QQ: 646494711
//QQ: 57218890
//Website:Http://www.8timer.com
//Blog:Http://www.cnblogs.com/Along729/
//Disclaimer: No one may publish or sell the source code without the permission of the author. Please respect others' labor achievements. Thank you for your support.
Mainlefttool. Renderer = New Toolstrip ();
Toolstripbutton1.image = New Bitmap ( @" 1. PNG " );
Toolstripbutton2.image = New Bitmap ( @" 2. PNG " );
Toolstripbutton3.image = New Bitmap ( @" 3. PNG " );
Toolstripbutton4.image = New Bitmap ( @" 4. PNG " );
Toolstripbutton5.image = New Bitmap ( @" 5. PNG " );
Toolstripbutton6.image = New Bitmap ( @" 6. PNG " );
Toolstripbutton7.image = New Bitmap ( @" 7. PNG " );
Toolstripbutton8.image = New Bitmap ( @" 8. PNG " );
Toolstripbutton9.image = New Bitmap ( @" Panelcenterbtn.png " );

Re-paint toolstrip code

//Author: along)
//QQ: 646494711
//QQ: 57218890
//Website:Http://www.8timer.com
//Blog:Http://www.cnblogs.com/Along729/
//Disclaimer: No one may publish or sell the source code without the permission of the author. Please respect others' labor achievements. Thank you for your support.
Using System;
Using System. Collections. Generic;
Using System. text;
Using System. Windows. forms;
Using System. drawing;
Using System. Drawing. drawing2d;

Namespace Mainform
{
Public Class Toolstrip: toolstriprenderer
{
Private Int I;
Public Toolstrip ()
{
}

Protected Override Void Initializeitem (toolstripitem item)
{
Base . Initializeitem (item );
Item. autosize = False ;
Item. Height = 30 ;
Item. padding = New Padding ( 5 );
Item. Margin = New Padding ( 0 , 0 , 0 , 1 );
If (Item Is Toolstripbutton)
{
Toolstripbutton BTN = Item As Toolstripbutton;
Item. Width = 30 ;
}

}

# Region // Draw button
Protected Override Void Onrenderbuttonbackground (toolstripitemrendereventargs E)
{
Bool Chk = False ;
Chk = (E. Item As Toolstripbutton). checked;
If (E. Item. pressed && E. Item. Selected)
{
I = 2 ;
}
Else If (E. Item. Selected)
{
I = 1 ;
}
Else If (Chk)
{
I = 2 ;
}
Else
{I = 0 ;}
Imagedrawrect. drawrect (E. Graphics, Global : Mainform. properties. Resources. main_tabbtn, New Rectangle (point. Empty, E. Item. Size), rectangle. fromltrb ( 5 , 15 , 5 , 5 ), I, 2 );
}
# Endregion
}

}

For more information about the test code, see(Winform net technology exchange group: 57218890)Shared Group download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.