Draw
how i can draw AND GATE in c#
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 17, 2009, 2:13 AM EST
A small request.
When you post questions, please mention it clearly. Otherwise, you will not get the correct answer or we will waste our time.
In your question you have said that you want to draw an AND gate. But what you actually wanted is to program(implement) an AND gate.
rafal3 reputationPosted Dec 16, 2009, 10:53 AM EST
Poorly know English: /
LINK
http://moja-z-dziecmi.ovh.org/gateAND.rar
CODE
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Close();
}
private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
if ((radioButton2.Checked == true) && (radioButton4.Checked == true))
label2.Text = "1";
else
label2.Text = "0";
}
}
}
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 16, 2009, 9:28 PM EST
I wrote a simple example to show you, how to draw a AND gate.
public partial class Form1 : Form { public Form1() { InitializeComponent(); this.Paint += new PaintEventHandler(f1_paint); } private void f1_paint(object sender, PaintEventArgs e) { System.Drawing.Graphics formGraphics = this.CreateGraphics(); System.Drawing.Pen myPen; myPen = new System.Drawing.Pen(System.Drawing.Color.Black); formGraphics.DrawArc(myPen, 40, 40, 40, 40, 90, -180); formGraphics.DrawLine(myPen, 60, 40, 60, 80); formGraphics.DrawLine(myPen, 20, 55, 60, 55); formGraphics.DrawLine(myPen, 20, 65, 60, 65); formGraphics.DrawLine(myPen, 80, 60, 120, 60); myPen.Dispose(); formGraphics.Dispose(); } }Run this and see the result.
Please check 'Do you like this answer' check box, if this helps you.