Click here to Skip to main content
15,906,628 members
Home / Discussions / C#
   

C#

 
AnswerRe: Classes containing Lists Pin
Jasmine250130-May-13 9:50
Jasmine250130-May-13 9:50 
QuestionHow to create a setup with two startup object in visual studio 2010? Pin
Viswanathan Ramamoorthy29-May-13 21:14
Viswanathan Ramamoorthy29-May-13 21:14 
AnswerRe: How to create a setup with two startup object in visual studio 2010? Pin
Eddy Vluggen29-May-13 22:00
professionalEddy Vluggen29-May-13 22:00 
AnswerRe: How to create a setup with two startup object in visual studio 2010? Pin
Amol_B30-May-13 20:19
professionalAmol_B30-May-13 20:19 
Questionresize chart in winform using c# Pin
mit6229-May-13 21:00
mit6229-May-13 21:00 
AnswerRe: resize chart in winform using c# Pin
Richard MacCutchan29-May-13 21:03
mveRichard MacCutchan29-May-13 21:03 
QuestionProblems in handling windows forms Pin
Arun kumar Gautam29-May-13 18:58
Arun kumar Gautam29-May-13 18:58 
AnswerRe: Problems in handling windows forms Pin
Richard MacCutchan29-May-13 21:09
mveRichard MacCutchan29-May-13 21:09 
AnswerRe: Problems in handling windows forms Pin
Anna King30-May-13 2:49
professionalAnna King30-May-13 2:49 
AnswerRe: Problems in handling windows forms Pin
Eddy Vluggen30-May-13 2:56
professionalEddy Vluggen30-May-13 2:56 
GeneralTo overcome the load screen flashes with user control and images and controls Pin
Lương Tuấn Anh29-May-13 18:30
Lương Tuấn Anh29-May-13 18:30 
AnswerRe: To overcome the load screen flashes with user control and images and controls Pin
Eddy Vluggen29-May-13 22:33
professionalEddy Vluggen29-May-13 22:33 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Lương Tuấn Anh30-May-13 4:56
Lương Tuấn Anh30-May-13 4:56 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Eddy Vluggen30-May-13 4:58
professionalEddy Vluggen30-May-13 4:58 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Lương Tuấn Anh30-May-13 8:24
Lương Tuấn Anh30-May-13 8:24 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Eddy Vluggen30-May-13 9:05
professionalEddy Vluggen30-May-13 9:05 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Lương Tuấn Anh30-May-13 16:00
Lương Tuấn Anh30-May-13 16:00 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Eddy Vluggen31-May-13 6:18
professionalEddy Vluggen31-May-13 6:18 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Lương Tuấn Anh31-May-13 16:54
Lương Tuấn Anh31-May-13 16:54 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Eddy Vluggen31-May-13 21:39
professionalEddy Vluggen31-May-13 21:39 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Lương Tuấn Anh1-Jun-13 7:41
Lương Tuấn Anh1-Jun-13 7:41 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Eddy Vluggen1-Jun-13 11:00
professionalEddy Vluggen1-Jun-13 11:00 
Lương Tuấn Anh wrote:
i will ask you if i dont know Big Grin | :-D
Please do so - wrote the example in a few spare moments, based on a new project;
C#
using System;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            SuspendUpdate.Suspend(this);
            InitializeComponent();
            SuspendUpdate.Resume(this);
        }
        public void button1_Click(object sender, EventArgs e)
        {
            SuspendUpdate.Suspend(this.pictureBox1);
            this.pictureBox1.Image = // load image here
            SuspendUpdate.Resume(this.pictureBox1);
        }
    }
    public static class SuspendUpdate
    {
        const int WM_SETREDRAW = 0x000B;
        public static void Suspend(Control control)
        {
            Message msgSuspendUpdate = Message.Create(
                control.Handle, WM_SETREDRAW, IntPtr.Zero, IntPtr.Zero);
            NativeWindow window = NativeWindow.FromHandle(control.Handle);
            window.DefWndProc(ref msgSuspendUpdate);
        }
        public static void Resume(Control control)
        {
            IntPtr wparam = new IntPtr(1); // Create a C "true" boolean as an IntPtr
            Message msgResumeUpdate = Message.Create(
                control.Handle, WM_SETREDRAW, wparam, IntPtr.Zero);
            NativeWindow window = NativeWindow.FromHandle(control.Handle);
            window.DefWndProc(ref msgResumeUpdate);
            control.Invalidate(); // Causes a repaint
        }
    }
}
Here we add in some help-routines in a new class; they should be in a separate file. Before updating something, call "Suspend" to stop the drawing temporarily and "Resume" to active it again. It'll speed up things on the UI-thread if it doesn't have to paint every change. I've also surrounded the "InitializeComponents" routine with those calls, to speed up the load-time. Again, it helps "a bit", it's not a miracle-worker. If your image is very large (>5 Mb), then it might be wiser to change the image.
Lương Tuấn Anh wrote:
Do you have Yahoo or mail ?
I'm every day available on CodeProject; whenever I open GMail, I also open CodeProjects' forum. I'd also get an email if you reply to one of my messages Smile | :)
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Lương Tuấn Anh1-Jun-13 17:51
Lương Tuấn Anh1-Jun-13 17:51 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Lương Tuấn Anh1-Jun-13 18:43
Lương Tuấn Anh1-Jun-13 18:43 
GeneralRe: To overcome the load screen flashes with user control and images and controls Pin
Eddy Vluggen2-Jun-13 0:40
professionalEddy Vluggen2-Jun-13 0:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.