Click here to Skip to main content
15,888,286 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I add two byte[1] + byte[2]? Pin
CPallini13-May-08 4:16
mveCPallini13-May-08 4:16 
AnswerRe: How can I add two byte[1] + byte[2]? Pin
merh13-May-08 4:27
merh13-May-08 4:27 
GeneralRe: How can I add two byte[1] + byte[2]? Pin
CPallini13-May-08 4:32
mveCPallini13-May-08 4:32 
AnswerRe: How can I add two byte[1] + byte[2]? Pin
merh13-May-08 5:53
merh13-May-08 5:53 
Questionhow to make a service automatic Pin
prasadbuddhika13-May-08 2:59
prasadbuddhika13-May-08 2:59 
AnswerRe: how to make a service automatic Pin
dan!sh 13-May-08 3:02
professional dan!sh 13-May-08 3:02 
QuestionDisassmble GAC-installed assembly Pin
ctoma200513-May-08 2:45
ctoma200513-May-08 2:45 
QuestionFlicker Problem in GDI+ Pin
hdv21213-May-08 2:12
hdv21213-May-08 2:12 
hi i have a panel and timer in my form, in timer.tick event handler, i want to draw a circle and increase pos.X in every timer interval, but when i run app and start animation, it has a flicker and not smoothing animation, also in constructor of my form, i write this code :
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);
and set Form.DoubleBuffered to true, but still my problem was not solve, how to remove flicker correctly ?
here is all of my code :
int lastX;<br />
        int lastY;<br />
        bool reverse = false;<br />
        Pen pen = new Pen(Brushes.Red, 2);<br />
<br />
        public Form1()<br />
        {<br />
            InitializeComponent();<br />
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);<br />
        }        <br />
<br />
        private void button1_Click(object sender, EventArgs e)<br />
        {            <br />
            this.timer1.Start();<br />
        }<br />
<br />
        private void Paint(Graphics g,int x,int y)<br />
        {<br />
            g.Clear(Color.White);<br />
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;<br />
            g.DrawEllipse(this.pen, new Rectangle(x, y, 100, 100));<br />
        }<br />
<br />
        private void timer1_Tick(object sender, EventArgs e)<br />
        {<br />
            if (!this.reverse)<br />
            {<br />
                if ((this.lastX + 102) <= this.panel1.Width)<br />
                {<br />
                    this.lastX += 2;<br />
                }<br />
                else<br />
                {<br />
                    this.reverse = true;<br />
                }<br />
            }<br />
            else<br />
            {<br />
                if (this.lastX >= 0)<br />
                {<br />
                    this.lastX -= 2;<br />
                }<br />
                else<br />
                {<br />
                    this.reverse = false;<br />
                }<br />
            }<br />
            this.Paint(this.panel1.CreateGraphics(), this.lastX, this.lastY);<br />
        }

thanks
AnswerRe: Flicker Problem in GDI+ Pin
Anthony Mushrow13-May-08 2:35
professionalAnthony Mushrow13-May-08 2:35 
GeneralRe: Flicker Problem in GDI+ Pin
hdv21213-May-08 5:58
hdv21213-May-08 5:58 
GeneralRe: Flicker Problem in GDI+ Pin
Anthony Mushrow13-May-08 6:07
professionalAnthony Mushrow13-May-08 6:07 
GeneralRe: Flicker Problem in GDI+ Pin
hdv21213-May-08 6:17
hdv21213-May-08 6:17 
GeneralRe: Flicker Problem in GDI+ Pin
Anthony Mushrow13-May-08 6:18
professionalAnthony Mushrow13-May-08 6:18 
GeneralRe: Flicker Problem in GDI+ Pin
hdv21213-May-08 6:19
hdv21213-May-08 6:19 
GeneralRe: Flicker Problem in GDI+ Pin
Anthony Mushrow13-May-08 6:34
professionalAnthony Mushrow13-May-08 6:34 
GeneralRe: Flicker Problem in GDI+ Pin
hdv21213-May-08 6:42
hdv21213-May-08 6:42 
GeneralRe: Flicker Problem in GDI+ Pin
Anthony Mushrow13-May-08 6:50
professionalAnthony Mushrow13-May-08 6:50 
GeneralRe: Flicker Problem in GDI+ Pin
hdv21213-May-08 6:58
hdv21213-May-08 6:58 
AnswerRe: Flicker Problem in GDI+ Pin
Horacio N. Hdez.13-May-08 3:13
Horacio N. Hdez.13-May-08 3:13 
Questionmouse recognizer Pin
mehrnoosh13-May-08 1:50
mehrnoosh13-May-08 1:50 
AnswerRe: mouse recognizer Pin
Ashfield13-May-08 2:00
Ashfield13-May-08 2:00 
QuestionHow I know that a property is related to a xml file Pin
Guru Call13-May-08 1:29
Guru Call13-May-08 1:29 
QuestionTo Unzip the Files using C# Pin
senthilsstil13-May-08 0:57
senthilsstil13-May-08 0:57 
AnswerRe: To Unzip the Files using C# Pin
Spunky Coder13-May-08 1:06
Spunky Coder13-May-08 1:06 
GeneralRe: To Unzip the Files using C# Pin
dan!sh 13-May-08 1:18
professional dan!sh 13-May-08 1:18 

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.