Treceți la conținutul principal

desene cnet

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace desene
{
    
    public partial class Form1 : Form
    {
        Graphics g;
        Pen p;
        Color c;
        bool linie;
        int vx, vy;
        public Form1()
        {
            InitializeComponent();
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void cb1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
            if (cb1.Text == "Cerc")
            {
                l1.Text = "Raza:";
                l1.Visible = true;
                tb1.Visible = true;
                groupBox3.Visible = true;
                groupBox4.Visible = true;
            }
            else if (cb1.Text == "Patrat")
            {
                l1.Text = "Latura:";
                l1.Visible = true;
                tb1.Visible = true;
                groupBox3.Visible = true;
                groupBox4.Visible = true;
            }
            else if (cb1.Text == "Triunghi echilateral")
            {
                l1.Text = "Latura:";
                l1.Visible = true;
                tb1.Visible = true;
                groupBox3.Visible = true;
                groupBox4.Visible = true;
            }
            else
            {
                l1.Visible = false;
                tb1.Visible = false;
                groupBox3.Visible = false;
                if (cb1.Text == "Punct") groupBox4.Visible = false;
                else groupBox4.Visible = true;
            }
        }

        private void pb1_Click(object sender, EventArgs e)
        {
            int x, y, r, l;
            int tip=0;
            r = 0;
            l = (int)numericUpDown1.Value;
            p = new Pen(c, l);
            SolidBrush b = new SolidBrush(c);
            if (rb1.Checked) tip = 1;
            if (rb2.Checked) tip = 2;
            x = MousePosition.X-this.Left-pb1.Left-panel2.Left-5;
            y = MousePosition.Y-this.Top-pb1.Top-panel2.Top-30;
            if(tb1.Text!="") r = Int32.Parse(tb1.Text);
            if (cb1.Text == "Cerc")
                if (r != 0)
                    if (tip == 2)  g.DrawEllipse(p, x - r, y - r, 2 * r, 2 * r);
                    else g.FillEllipse(b, x - r, y - r, 2 * r, 2 * r);
                else g.DrawEllipse(p, x, y, 1, 1);
            else
                if (cb1.Text == "Patrat")
                    if (tip == 2) g.DrawRectangle(p, x, y, r, r);
                    else g.FillRectangle(b, x, y, r, r);
                else
                    if (cb1.Text == "Punct")
                        g.DrawEllipse(p, x, y, 1, 1);
                    else
                        if (cb1.Text == "Linie" || cb1.Text == "Poligon" )
                        {
                            if (!linie)
                            {
                                linie = true;
                                vx = x;
                                vy = y;
                                g.DrawEllipse(p, x, y, 1, 1);
                            }
                            else
                            {
                                g.DrawLine(p, vx, vy, x, y);
                                if (cb1.Text == "Poligon")
                                {
                                    vx = x; vy = y;
                                }
                                else
                                {
                                    linie = false;
                                }
                            }
                        }
                        else
                            if (cb1.Text == "Triunghi echilateral")
                            {
                                Point[] tri = new Point[3];
                                tri[0] = new Point(x, y);
                                tri[1] = new Point(x - r / 2, (int)(y + r/2*Math.Sqrt(3)));
                                tri[2] = new Point(x + r / 2, (int)(y + r/2* Math.Sqrt(3)));
                                if (tip == 2) g.DrawPolygon(p, tri);
                                else g.FillPolygon(b,tri);
                            }

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            l1.Visible = false;
            tb1.Visible = false;
            rb1.Checked = false;
            rb2.Checked = true;
            g = this.pb1.CreateGraphics();
            c = new Color();
            c = Color.Black;
            p = new Pen(c, 1);
            linie = false;
            groupBox3.Visible = false;
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (cd1.ShowDialog() == DialogResult.OK)
            {
                c = cd1.Color;
                pictureBox1.BackColor = c;
            }

        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {

        }
    }
}

Comentarii

Postări populare de pe acest blog

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

NUMERE PRIME ALGORITM C++

// NUMERE PRIME ALGORITM C++//  reediting from scratch //on this page is just the study for a next algoritm for generating the parime nr series like Fibonnaci or ....if possibile

74111121313417374414124343447 if u know the red part you can generate the orange part
1 0 1 111112222 1 1 23

o aplicatie php localitati romania

//APLICATIA SE REFERA LA BAZA DE DATE SIRUTA

//dragtable.js


/* dragtable v1.0 June 26, 2008 Dan Vanderkam, http://danvk.org/dragtable/ http://code.google.com/p/dragtable/ \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable) - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/) - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…