ياريت حد يزودني
بشرح وافي ل timer وكيفيه استخدامه
وكيفيه استخدام دوال الgraphices
في الرسم مع التايمر
كمثال
نرسم شكل مثلا مستطيل (زرار مستطيل)
يتناقص حجمه حتي يختفي في زمن محدد بواسطه التايمر
ارجو سرعه الرد
واهتمام المشرفين
ياريت حد يزودني
بشرح وافي ل timer وكيفيه استخدامه
وكيفيه استخدام دوال الgraphices
في الرسم مع التايمر
كمثال
نرسم شكل مثلا مستطيل (زرار مستطيل)
يتناقص حجمه حتي يختفي في زمن محدد بواسطه التايمر
ارجو سرعه الرد
واهتمام المشرفين
تم تعديل هذه المشاركة بواسطة mr.qewan في 30 أبريل 2007 في 14:20
محدش عايز يفيدني ولا ايه
ايه يا جماعه البخل ده
السلام عليكم
يوجد أمثلة كثيرة في المنتدى حول إستعمال المؤقة وكيفية الرسم وهذه بعض المواضيع
وأنظر الى الرد الأخير في هذه الصفحة حيث إستعملت 3 مواقيت في نفس الكود لتصميم نافذة
وهذا كود آخر يرسم لك دوائر فوق بعضها بإعتماد مؤقتان أضف مؤقتان للنافذة الرئيسية و PictureBox
لم أستطع رفع ملف الكود كامل لذلك أنسخه بالشكل التالي:
using System;
using System.Data;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
namespace tt
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Bitmap bitmap;
private int X;
private int Y;
public Graphics gr;
public Rectangle rect;
public Bitmap bitmaptemp;
public SolidBrush AliceblueBrush = new SolidBrush(Color.AliceBlue);
private void Form1_Load(object sender, EventArgs e)
{
X = 20; Y = 20;
bitmap = new Bitmap(Application.StartupPath + "\\back.bmp");
bitmaptemp = (Bitmap)this.bitmap.Clone();
gr = Graphics.FromImage(bitmaptemp);
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
this.pictureBox1.Image = bitmaptemp;
bitmap = new Bitmap(Application.StartupPath + "\\back.bmp");
gr = Graphics.FromImage(bitmaptemp);
this.pictureBox1.Image = bitmaptemp;
// Create rectangle for the circle.
rect = new Rectangle(100, 100, X, Y);
// Fill circle on screen.
gr.FillEllipse(AliceblueBrush, rect);
gr.DrawEllipse(new System.Drawing.Pen(Color.Black, 1), rect);
}
private void btn_GO_Click(object sender, EventArgs e)
{ timer2.Interval = 800;
timer2.Enabled = true;
}
// draw Ellipse
private void DrawAgain(int x, int y)
{
Random RR = new Random();
// back.bmp is image witch should be with the debug folder
bitmap = new Bitmap(Application.StartupPath + "\\back.bmp");
gr = Graphics.FromImage(bitmaptemp);
this.pictureBox1.Image = bitmaptemp;
// Create rectangle for the Elipse with random size.
rect = new Rectangle(100, 100, RR.Next(100), RR.Next(100));
// Fill circle on screen.
gr.FillEllipse(AliceblueBrush, rect);
gr.DrawEllipse(new System.Drawing.Pen(Color.Black, 1), rect);
}
private void timer1_Tick(object sender, EventArgs e)
{ // draw others ellipse
int i = 10;
if (i < Y)
{ DrawAgain(i+1, i+1); }
timer2.Enabled = true;
timer1.Enabled = false;
}
private void timer2_Tick(object sender, EventArgs e)
{ timer1.Interval = 400;
timer1.Enabled = true;
}
}
}:oاقتباسمحدش عايز يفدني ولا ايه
لا تنسى أنك في الفريق العربي للبرمجة فطلباتك أوامر
اقتباسايه يا جماعة البخل ده
كيف يبخل المرء على نفسه :D
الله يخليك
والف شكر لتعاونك
هذا الموضوع مغلق.