public DUIRuler() { this.Height = 20; this.brush = new DUISolidBrush(this.ForeColor); this.dividingBrush = new DUIThreadSafeBitmapBrush(new Size(1, 1), (g, s) => { using (DUIPen pen = new DUIPen(this.ForeColor)) { for (int i = 0; i < 10; i++) { if (i == 0) { g.DrawLine(pen, new PointF(i * this.DividingInterval, this.ClientSize.Height), new PointF(i * this.DividingInterval, this.ClientSize.Height - 3 * DividingHeight)); } else if (i == 5) { g.DrawLine(pen, new PointF(i * this.DividingInterval, this.ClientSize.Height), new PointF(i * this.DividingInterval, this.ClientSize.Height - 2 * DividingHeight)); } else { g.DrawLine(pen, new PointF(i * this.DividingInterval, this.ClientSize.Height), new PointF(i * this.DividingInterval, this.ClientSize.Height - DividingHeight)); } } } }); }
public FmDUIScaleableControlDemo() { InitializeComponent(); DUIThreadSafeBitmapBrush backMeshBrush = new DUIThreadSafeBitmapBrush(new Size(20, 20), (g, s) => { using (DUISolidBrush brushMeshDark = new DUISolidBrush(Color.FromArgb(29, 29, 29))) using (DUISolidBrush brushMeshLight = new DUISolidBrush(Color.FromArgb(159, 159, 159))) { g.FillRectangle(brushMeshDark, new Rectangle(0, 0, 10, 10)); g.FillRectangle(brushMeshDark, new Rectangle(10, 10, 10, 10)); g.FillRectangle(brushMeshLight, new Rectangle(10, 0, 10, 10)); g.FillRectangle(brushMeshLight, new Rectangle(0, 10, 10, 10)); } }); DUIImage dUIImage = DUIImage.FromFile(@"Resources\1.jpg"); DUIScaleableControl dUIScaleableControl = new DUIScaleableControl() { Dock = DockStyle.Fill }; dUIScaleableControl.Paint += (s, e) => { backMeshBrush.Draw(e.Graphics, dUIScaleableControl.ScaleableBounds); e.Graphics.DrawImage(dUIImage, 0, 0); }; this.duiNativeControl1.DUIControls.Add(dUIScaleableControl); }