• 01-11-2009, 22:12:48
    #1
    mrb. arkadaşalar c buılder da analog saat ödevi verildi.bu kodu yazabilcek arkadaslar warmı ? şimdiden teşkkurler.
  • 01-11-2009, 22:27:18
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    c# işini görürse buyur
    using System.Collections.Generic;
    
    using System.ComponentModel;
    
    using System.Data;
    
    using System.Drawing;
    
    using System.Text;
    
    using System.Windows.Forms;
    
    
    
    namespace saat
    
    {
    
    public partial class Form1 : Form
    
    {
    
    public Form1()
    
    {
    
    InitializeComponent();
    
    }
    
    
    
    private void Form1_Load(object sender, EventArgs e)
    
    {
    
    this.ClientSize = new Size(300, 300);
    
    Timer zaman = new Timer();
    
    zaman.Interval = 1000;
    
    zaman.Start();
    
    zaman.Tick += new System.EventHandler(zaman_Tick);
    
    }
    
    private void zaman_Tick(object sender, System.EventArgs e)
    
    {
    
    float yari_çap, xorta, yorta, xx, yx; 
    
    Graphics çizim;
    
    çizim = this.CreateGraphics();
    
    çizim.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
    
    yari_çap=this.ClientSize.Width / 2;
    
    çizim.DrawEllipse(new Pen(Color.Black, 2), 0, 0, 2 * yari_çap, 2 * yari_çap);
    
    çizim.DrawEllipse(new Pen(Color.Black,2), 10, 10, 2 * yari_çap - 20, 2 * yari_çap - 20);
    
    çizim.FillEllipse(new SolidBrush(this.BackColor), 15, 15, 2 * yari_çap - 25, 2 * yari_çap - 25);
    
    xorta = yari_çap;
    
    yorta = yari_çap;
    
    yari_çap -= 10;
    
    int saat, dakika, saniye, aci, x, y, x1, y1;
    
    for (aci = 0; aci <= 360; aci += 6)
    
    {
    
    x = (int)(xorta + (yari_çap + 10) * Math.Cos(aci * 3.1415 / 180));
    
    y = (int)(yorta - (yari_çap + 10) * Math.Sin(aci * 3.1415 / 180));
    
    x1 = (int)(xorta + (yari_çap) * Math.Cos(aci * 3.1415 / 180));
    
    y1 = (int)(yorta - (yari_çap) * Math.Sin(aci * 3.1415 / 180));
    
    if ((aci % 30) == 0)
    
    çizim.DrawLine(new Pen(Color.Red, 10), x, y, x1, y1);
    
    else
    
    çizim.DrawLine(new Pen(Color.Blue, 5), x, y, x1, y1);
    
    }
    
    System.Drawing.Drawing2D.GraphicsPath biçim;
    
    biçim = new System.Drawing.Drawing2D.GraphicsPath();
    
    saat = System.DateTime.Now.TimeOfDay.Hours;
    
    aci = -saat * 30 + 90;
    
    xx = (int)(xorta + yari_çap * 2 / 3 * Math.Cos(aci * 3.1415 / 180));
    
    yx = (int)(yorta - yari_çap * 2 / 3 * Math.Sin(aci * 3.1415 / 180));
    
    x = (int)(xorta - 10 * Math.Cos(aci * 3.1415 / 180 + Math.PI / 2));
    
    y = (int)(yorta + 10 * Math.Sin(aci * 3.1415 / 180 + Math.PI / 2));
    
    x1 = (int)(xorta + 10 * Math.Cos(aci * 3.1415 / 180 + Math.PI / 2));
    
    y1 = (int)(yorta - 10 * Math.Sin(aci * 3.1415 / 180 + Math.PI / 2));
    
    biçim.AddLine(x, y, xx, yx);
    
    biçim.AddLine(x1, y1, xx, yx);
    
    biçim.AddLine(x, y, x1, y1);
    
    dakika = System.DateTime.Now.Minute;
    
    aci = -dakika * 6 + 90;
    
    xx = (int)(xorta + yari_çap * Math.Cos(aci * 3.1415 / 180));
    
    yx = (int)(yorta - yari_çap * Math.Sin(aci * 3.1415 / 180));
    
    x = (int)(xorta - 5 * Math.Cos(aci * 3.1415 / 180 + Math.PI / 2));
    
    y = (int)(yorta + 5 * Math.Sin(aci * 3.1415 / 180 + Math.PI / 2));
    
    x1 = (int)(xorta + 5 * Math.Cos(aci * 3.1415 / 180 + Math.PI / 2));
    
    y1 = (int)(yorta - 5 * Math.Sin(aci * 3.1415 / 180 + Math.PI / 2));
    
    biçim.AddLine(x, y, xx, yx);
    
    biçim.AddLine(x1, y1, xx, yx);
    
    biçim.AddLine(x, y, x1, y1);
    
    saniye = System.DateTime.Now.TimeOfDay.Seconds;
    
    aci = -saniye * 6 + 90;
    
    xx = (int)(xorta + yari_çap * Math.Cos(aci * 3.1415 / 180));
    
    yx = (int)(yorta - yari_çap * Math.Sin(aci * 3.1415 / 180));
    
    x = (int)(xorta - 1 * Math.Cos(aci * 3.1415 / 180 + Math.PI / 2));
    
    y = (int)(yorta + 1 * Math.Sin(aci * 3.1415 / 180 + Math.PI / 2));
    
    x1 = (int)(xorta + 1 * Math.Cos(aci * 3.1415 / 180 + Math.PI / 2));
    
    y1 = (int)(yorta - 1 * Math.Sin(aci * 3.1415 / 180 + Math.PI / 2));
    
    biçim.AddLine(x, y, xx, yx);
    
    biçim.AddLine(x1, y1, xx, yx);
    
    biçim.AddLine(x, y, x1, y1);
    
    çizim.FillEllipse(new SolidBrush(Color.Black), xorta-20, yorta-10, 30, 30);
    
    çizim.DrawPath(new Pen(Color.Blue), biçim);
    
    
    
    }
    
    }
    
    }
  • 01-11-2009, 22:30:26
    #3
    birde küçük bir aramdan sonra şu var
    Alıntı
    C++ analog saat bileşeni
    Alıntı:

    Horloge.h


    #ifndef HorlogeH
    #define HorlogeH
    //---------------------------------------------------------------------------
    #include <SysUtils.hpp>
    #include <Controls.hpp>
    #include <Classes.hpp>
    //---------------------------------------------------------------------------
    class PACKAGE THorloge : public TGraphicControl
    {
    private:
    TTimer *Timer1;
    Graphics::TBitmap *Image1;
    bool FSec;
    bool __fastcall CanResize(int &NewWidth, int &NewHeight);
    protected:
    void __fastcall Tempo(TObject* Owner);
    void __fastcall Paint();
    public:
    __fastcall THorloge(TComponent* Owner);
    virtual __fastcall ~THorloge();
    __published:
    __property Anchors;
    __property ParentShowHint;
    __property ShowHint;
    __property Visible;

    __property bool Seconde = {read=FSec, write=FSec, default=true};
    };
    //---------------------------------------------------------------------------
    #endif
  • 15-11-2009, 18:36:55
    #4
    C de mi C++ da mı C# da mı hangi dilde olucak C builder bir derleyici değil mi ya ?