Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [DllImport("user32.dll")]
- private static extern long LockWindowUpdate(long Handle);
- try {
- // Lock Window...
- LockWindowUpdate( frm.Handle );
- // Perform your painting / updates...
- } finally {
- // Release the lock...
- LockWindowUpdate( 0 );
- }
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using Microsoft.Win32;
- using System.Runtime.InteropServices;
- namespace WindowsTest
- {
- public partial class Form1 : Form
- {
- [DllImport("user32.dll")]
- public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
- private const int WM_SETREDRAW = 11;
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- SendMessage(this.Handle, WM_SETREDRAW, false, 0);
- // Do your thingies here
- SendMessage(this.Handle, WM_SETREDRAW, true, 0);
- this.Refresh();
- }
- }
- }
Add Comment
Please, Sign In to add comment