先看效果图
下面是代码
protected override void OnPaint(PaintEventArgs e) {e.Graphics.SetGDIHigh();var rect = new Rectangle(0, 0, this.Width, this.Height);// 创建变换矩阵Matrix transformMatrix = new Matrix();// 使用平行四边形的方法近似梯形transformMatrix.Shear(-lidu * 0.3f, 0);// 应用变换e.Graphics.Transform = transformMatrix;var rectNew = new RectangleF(lidu * 0.3f * this.Width, lidu * 0.3f * this.Height, this.Width, (1 - lidu * 0.3f) * this.Height);e.Graphics.DrawImage(bitCache, rectNew, new Rectangle(0, 0, bitCache.Width, bitCache.Height), GraphicsUnit.Pixel); }