基本信息
源码名称:QQ风格自定义控件源码(C#)
源码大小:3.15M
文件格式:.7z
开发语言:C#
更新时间:2018-07-28
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using ControlExs; namespace Demo { public partial class FormDemo : FormEx { #region Constructor public FormDemo():base() { InitializeComponent(); } #endregion #region Override protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; if (!DesignMode) { cp.ExStyle |= (int)WindowStyle.WS_CLIPCHILDREN; } return cp; } } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); DrawFromAlphaMainPart(this, e.Graphics); } #endregion #region Private /// <summary> /// 绘制窗体主体部分白色透明层 /// </summary> /// <param name="form"></param> /// <param name="g"></param> public static void DrawFromAlphaMainPart(Form form, Graphics g) { Color[] colors = { Color.FromArgb(5, Color.White), Color.FromArgb(30, Color.White), Color.FromArgb(145, Color.White), Color.FromArgb(150, Color.White), Color.FromArgb(30, Color.White), Color.FromArgb(5, Color.White) }; float[] pos = { 0.0f, 0.04f, 0.10f, 0.90f, 0.97f, 1.0f }; ColorBlend colorBlend = new ColorBlend(6); colorBlend.Colors = colors; colorBlend.Positions = pos; RectangleF destRect = new RectangleF(0, 0, form.Width, form.Height); using (LinearGradientBrush lBrush = new LinearGradientBrush(destRect, colors[0], colors[5], LinearGradientMode.Vertical)) { lBrush.InterpolationColors = colorBlend; g.FillRectangle(lBrush, destRect); } } private void SetStyles() { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); UpdateStyles(); } #endregion private void FormDemo_Load(object sender, EventArgs e) { this.Left = (Screen.PrimaryScreen.WorkingArea.Width - Width) / 2; this.Top = (Screen.PrimaryScreen.WorkingArea.Height - Height) / 2; } private void qqButton3_Click(object sender, EventArgs e) { QQMessageBox.Show( this, "更改用户信息成功!", "提示", QQMessageBoxIcon.OK, QQMessageBoxButtons.OK); } } }