xcv 0 Report post Posted October 14, 2005 akum dan salam sejahtera... saya ader satu masalah kat sinie.. saya paintkan background kat form tuh.. nie utk compact frameworknyer... so sayer ader coding camneh.. private void menuTingkat_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawImage(backGround,this.ClientRectangle,new Rectangle(0,0,this.backGround.Width,this.backGround.Height),GraphicsUnit.Pixel); }saya dah boleh repaintkan background form maser form tuh load pertama kali.. tapik biler saya try tuka background (semasa program jalan) dengan tukarkan image backGround. Background tak tukar. Saya raser.. menuTingkat_Paint tuh tak dipanggil. Macam maner sayer nak tarik bender tuh?atau fungsi menuTingkat_Paint tuh? thanks... Quote Share this post Link to post Share on other sites
f a 0 Report post Posted October 14, 2005 nak tengok function ko tu dipanggil, cube le letak messagebox satu. sori, aku tak de c# kompiler la untuk ditest. aku da uninstall. free space aku mengecil Quote Share this post Link to post Share on other sites
xcv 0 Report post Posted October 15, 2005 sowi kalau soalan aku mengelirukan.. camnie.. menuTingkat_Paint tuh funtion form punyer. Bukan sayer yang create. So biler form tue di load kali pertama function tuh boleh dijalankan. biler saya cuber nak paintkan sekali lagi dalam form yang samer.. sayer tak lih nak repaint. Description untuk fungsi Paint tuh ialah Occurs when controls need repainting. Contoh probleam camnie :1)saya bukak form tuh.2)gambar A dapat paint.3) saya click button utk tukar gambar A tuh.cth tukar gambar Bsampai kat situ jer, sayer dah tak reti camner nak panggil menuTingkat_Paint tue. object sender nak letak per?System.Windows.Forms.PaintEventArgs e nak letak per? thanks... Quote Share this post Link to post Share on other sites
1kHz 0 Report post Posted October 16, 2005 Jangan panggil event handler secara terus, itu perbuatan yg tak sihat.Kita kena create event yg berkaitan. Dalam kes event Paint ni, sebenarnya benda yg kena dipanggil ialah menuTingkat.Invalidate() ..sejarah "invalidate" ni adalah dari zaman win32, dia mana utk ada function InvalidateRect yg fungsinya memberi tahu bhw paparan tersebut sudah tidak valid lagi, jadi event Repaint atau Paint akan dipanggil utk melukis balik paparan tu. Quote Share this post Link to post Share on other sites
f a 0 Report post Posted October 16, 2005 emm. betul tu. lupe lak pasal Invalidate method ahakscube tambah lepas ko klik button tu.. this.Invalidate() Quote Share this post Link to post Share on other sites
xcv 0 Report post Posted October 16, 2005 (edited) oho.. thanks.. aku akan cuba. Thanks bebanyak.. nanti aku bagitau result dier... err.. tambahan... Invalidate() nih akan panggey sumer function form tuh ea? <-- tul ker tak ayat aku... ker Paint jer? Load dan sebagainyer tak ea? Edited October 16, 2005 by xcv Quote Share this post Link to post Share on other sites
f a 0 Report post Posted October 16, 2005 oho.. thanks.. aku akan cuba. Thanks bebanyak.. nanti aku bagitau result dier... err.. tambahan... Invalidate() nih akan panggey sumer function form tuh ea? <-- tul ker tak ayat aku... ker Paint jer? Load dan sebagainyer tak ea?←macam 1kHz tu cakap. pastu yang kod aku bagi tu, die akan 'invalidate' form (this). mase method ni di panggil, then die akan menyebabkan paint message (biasenye OnPaint) dipanggil untuk kontrol tersebut (in this case, form a.k.a this). sebab tu la die kate "Occurs when controls need repainting". cube dulu k Quote Share this post Link to post Share on other sites