protected override void OnResize(EventArgs e) { base.OnResize(e); Rectangle clientRectangle = base.ClientRectangle; if (clientRectangle.Width > 0) { clientRectangle = base.ClientRectangle; if (clientRectangle.Height > 0) { this._buffer.Dispose(); this._graphics.Dispose(); this._bkgBuffer.Dispose(); clientRectangle = base.ClientRectangle; int width = clientRectangle.Width; clientRectangle = base.ClientRectangle; this._buffer = new Bitmap(width, clientRectangle.Height, PixelFormat.Format32bppPArgb); this._graphics = Graphics.FromImage(this._buffer); ChannelAnalyzer.ConfigureGraphics(this._graphics); clientRectangle = base.ClientRectangle; int width2 = clientRectangle.Width; clientRectangle = base.ClientRectangle; this._bkgBuffer = new Bitmap(width2, clientRectangle.Height, PixelFormat.Format32bppPArgb); this._drawBackgroundNeeded = true; this.Perform(this._channelArray); } } }
private void DrawBackground() { using (SolidBrush solidBrush = new SolidBrush(Color.Silver)) { using (Pen pen = new Pen(Color.FromArgb(80, 80, 80))) { using (new Pen(Color.DarkGray)) { using (Font font = new Font("Arial", 8f)) { using (Graphics graphics = Graphics.FromImage(this._bkgBuffer)) { ChannelAnalyzer.ConfigureGraphics(graphics); graphics.Clear(Color.Black); pen.DashStyle = DashStyle.Dash; int num = 20; Rectangle clientRectangle = base.ClientRectangle; int num2 = (clientRectangle.Height - 4) / num; for (int i = 1; i <= num2; i++) { Graphics graphics2 = graphics; Pen pen2 = pen; clientRectangle = base.ClientRectangle; int y = clientRectangle.Height - 2 - i * num; clientRectangle = base.ClientRectangle; int x = clientRectangle.Width - 2; clientRectangle = base.ClientRectangle; graphics2.DrawLine(pen2, 2, y, x, clientRectangle.Height - 2 - i * num); } for (int j = 1; j <= num2; j++) { string text = (j * num / 2 - 10).ToString(); SizeF sizeF = graphics.MeasureString(text, font); float width = sizeF.Width; float height = sizeF.Height; Graphics graphics3 = graphics; string s = text; Font font2 = font; SolidBrush brush = solidBrush; clientRectangle = base.ClientRectangle; graphics3.DrawString(s, font2, brush, 4f, (float)(clientRectangle.Height - 2 - j * num) - height + 1f); } } } } } } }
protected override void OnPaint(PaintEventArgs e) { ChannelAnalyzer.ConfigureGraphics(e.Graphics); e.Graphics.DrawImageUnscaled(this._buffer, 0, 0); }