Пример #1
0
        protected override void WndProc(ref Message m)
        {
            int msg = m.Msg;

            if (msg <= 15)
            {
                if (msg != 5)
                {
                    if (msg == 15)
                    {
                        MdiClientController.PAINTSTRUCT pAINTSTRUCT = default(MdiClientController.PAINTSTRUCT);
                        IntPtr hdc = MdiClientController.BeginPaint(m.HWnd, ref pAINTSTRUCT);
                        using (Graphics graphics = Graphics.FromHdc(hdc))
                        {
                            Rectangle clipRect = new Rectangle(pAINTSTRUCT.rcPaint.left, pAINTSTRUCT.rcPaint.top, pAINTSTRUCT.rcPaint.right - pAINTSTRUCT.rcPaint.left, pAINTSTRUCT.rcPaint.bottom - pAINTSTRUCT.rcPaint.top);
                            int       width    = (this.mdiClient.ClientRectangle.Width > 0) ? this.mdiClient.ClientRectangle.Width : 0;
                            int       height   = (this.mdiClient.ClientRectangle.Height > 0) ? this.mdiClient.ClientRectangle.Height : 0;
                            using (Image image = new Bitmap(width, height))
                            {
                                using (Graphics graphics2 = Graphics.FromImage(image))
                                {
                                    IntPtr  hdc2    = graphics2.GetHdc();
                                    Message message = Message.Create(m.HWnd, 792, hdc2, IntPtr.Zero);
                                    base.DefWndProc(ref message);
                                    graphics2.ReleaseHdc(hdc2);
                                    if (this.image != null)
                                    {
                                        this.DrawImage(graphics2, clipRect);
                                    }
                                    this.OnPaint(new PaintEventArgs(graphics2, clipRect));
                                }
                                graphics.DrawImage(image, this.mdiClient.ClientRectangle);
                            }
                        }
                        MdiClientController.EndPaint(m.HWnd, ref pAINTSTRUCT);
                        return;
                    }
                }
                else
                {
                    this.mdiClient.Invalidate();
                }
            }
            else
            {
                if (msg == 20)
                {
                    return;
                }
                if (msg == 131)
                {
                    if (!this.autoScroll)
                    {
                        MdiClientController.ShowScrollBar(m.HWnd, 3, 0);
                    }
                }
            }
            base.WndProc(ref m);
        }
Пример #2
0
 private static extern bool EndPaint(IntPtr hWnd, ref MdiClientController.PAINTSTRUCT paintStruct);