Je veux faire une simulation simple en utilisant des ellipses. Dans l'interface utilisateur, il y aura un bouton. L'utilisateur appuiera sur le bouton, puis avec une seconde d'intervalle, les ellipses seront dessinées dans pictureBox. Comme un feu de circulation ...Comment dessiner des ellipses avec un intervalle dans PictureBox
Je suppose que j'ai besoin d'utiliser Timer Event, mais je ne sais pas comment. Comment puis-je l'atteindre?
Mes meilleures salutations ...
CodeWork:
public void Button1_Click(Object sender, EventArgs e)
{
DrawMap ortamcizdir = new DrawMap(p_box_map, bmp, ZoomControl, panel1);
DrawCell hucrecizdir = new DrawCell (p_box_map, bmp, a, ZoomControl, ZoomKontrolBolen);
}
class DrawCell
{
for (int z = 0; z < Ortamlar.HucreSayisi; z++)
{
Pen Kalem = new Pen(Brushes.CadetBlue);
Rectangle rect = new Rectangle(((Ortamlar.HUCREKorX[z]/ScaleFactor - Ortamlar.HUCREYaricap[z]/ScaleFactor)
* ZoomKontrolCarpan)/ZoomKontrolBolen, (Ortamlar.HUCREKorY[z]/ScaleFactor - Ortamlar.HUCREYaricap[z]/ScaleFactor) *
ZoomKontrolCarpan/ZoomKontrolBolen, (2 * Ortamlar.HUCREYaricap[z]/ScaleFactor) * ZoomKontrolCarpan/ZoomKontrolBolen
, (2 * Ortamlar.HUCREYaricap[z]/ScaleFactor) * ZoomKontrolCarpan/ZoomKontrolBolen);
if (Ortamlar.HUCREYZ[z] == "001:400")
{
g.DrawString(Ortamlar.HUCREKB[z].ToString(), Font, Brushes.Black, ((Ortamlar.HUCREKorX[z]/ScaleFactor)
* ZoomKontrolCarpan)/ZoomKontrolBolen, 600 - (Ortamlar.HUCREKorY[z]/ScaleFactor) *
ZoomKontrolCarpan/ZoomKontrolBolen);
g.MultiplyTransform(new Matrix(1, 0, 0, -1, 0, 600));
g.DrawEllipse(Kalem, rect);
g.FillEllipse(Brushes.Wheat, rect);
g.ResetTransform();
picturebox1.Image = bmp;
bmp1 = (Bitmap)picturebox1.Image;
}
if (Ortamlar.HUCREYZ[z] == "401:800")
{
g.DrawString(Ortamlar.HUCREKB[z].ToString(), Font, Brushes.Black, ((Ortamlar.HUCREKorX[z]/ScaleFactor)
* ZoomKontrolCarpan)/ZoomKontrolBolen, 600 - (Ortamlar.HUCREKorY[z]/ScaleFactor) *
ZoomKontrolCarpan/ZoomKontrolBolen);
g.MultiplyTransform(new Matrix(1, 0, 0, -1, 0, 600));
g.DrawEllipse(Kalem, rect);
g.FillEllipse(Brushes.Yellow, rect);
g.ResetTransform();
picturebox1.Image = bmp;
bmp2 = (Bitmap)picturebox1.Image;
}
if (Ortamlar.HUCREYZ[z] == "801:120")
{
g.DrawString(Ortamlar.HUCREKB[z].ToString(), Font, Brushes.Black, ((Ortamlar.HUCREKorX[z]/ScaleFactor)
* ZoomKontrolCarpan)/ZoomKontrolBolen, 600 - (Ortamlar.HUCREKorY[z]/ScaleFactor) *
ZoomKontrolCarpan/ZoomKontrolBolen);
g.MultiplyTransform(new Matrix(1, 0, 0, -1, 0, 600));
g.DrawEllipse(Kalem, rect);
g.FillEllipse(Brushes.Green, rect);
g.ResetTransform();
picturebox1.Image = bmp;
bmp3 = (Bitmap)picturebox1.Image;
}
if (Ortamlar.HUCREYZ[z] == "121:161")
{
g.DrawString(Ortamlar.HUCREKB[z].ToString(), Font, Brushes.Black, ((Ortamlar.HUCREKorX[z]/ScaleFactor)
* ZoomKontrolCarpan)/ZoomKontrolBolen, 600 - (Ortamlar.HUCREKorY[z]/ScaleFactor) *
ZoomKontrolCarpan/ZoomKontrolBolen);
g.MultiplyTransform(new Matrix(1, 0, 0, -1, 0, 600));
g.DrawEllipse(Kalem, rect);
g.FillEllipse(Brushes.Blue, rect);
g.ResetTransform();
picturebox1.Image = bmp;
bmp4 = (Bitmap)picturebox1.Image;
}
}
}
Vous voulez que nous écrivions le code pour vous? Passer. –
@Cody Grey J'ai juste besoin d'idées ou de suggestions? –
Avez-vous lu la [documentation] (http://msdn.microsoft.com/fr-fr/library/system.windows.forms.timer.aspx)? –