hd2010hd
شنبه 01 آذر 1393, 22:03 عصر
سلام خدمت اساتید
ما یک پروژه داریم به این صورت عکس فرم :
125946
حالا من کدش رو تا یه جایی نوشتم ولی مشکل داره کل برنامه به این صورت هستش که نوع خط رو انتخاب میکنیم . رنگش رو توی تکست هم ضخامت خط رو ولی وقتی برنامه اجرا میکنم فقط بگ گراند رو رنگش رو عوض میکنه
اینم کد هاش ممنون میشم اشکالات کوچیکش رو حل کنید برام بزارید
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Drawing
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int selectDash;
int selectColor;
int width1;
Color c;
Pen pen1;
private void setcolor()
{
switch (selectColor)
{
case 1:
c = Color.Red;
break;
case 2:
c = Color.Green;
break;
case 3:
c = Color.Blue;
break;
}
}
void setDash()
{
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
}
private void button1_Click(object sender, EventArgs e)
{
Graphics graphic1;
graphic1 = this.CreateGraphics();
graphic1.Clear(Color.Red);
width1 = Convert.ToInt16(textBox1.Text);
setcolor();
setDash();
int i;
for(i=20,i<=220,i+=20);
{
graphic1.DrawLine(pen1,i,10,i,150);
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
selectDash = 1;
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
selectDash = 2;
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
selectDash = 3;
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
selectDash = 4;
}
private void radioButton5_CheckedChanged(object sender, EventArgs e)
{
selectDash = 5;
}
}
}
ما یک پروژه داریم به این صورت عکس فرم :
125946
حالا من کدش رو تا یه جایی نوشتم ولی مشکل داره کل برنامه به این صورت هستش که نوع خط رو انتخاب میکنیم . رنگش رو توی تکست هم ضخامت خط رو ولی وقتی برنامه اجرا میکنم فقط بگ گراند رو رنگش رو عوض میکنه
اینم کد هاش ممنون میشم اشکالات کوچیکش رو حل کنید برام بزارید
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Drawing
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int selectDash;
int selectColor;
int width1;
Color c;
Pen pen1;
private void setcolor()
{
switch (selectColor)
{
case 1:
c = Color.Red;
break;
case 2:
c = Color.Green;
break;
case 3:
c = Color.Blue;
break;
}
}
void setDash()
{
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
}
private void button1_Click(object sender, EventArgs e)
{
Graphics graphic1;
graphic1 = this.CreateGraphics();
graphic1.Clear(Color.Red);
width1 = Convert.ToInt16(textBox1.Text);
setcolor();
setDash();
int i;
for(i=20,i<=220,i+=20);
{
graphic1.DrawLine(pen1,i,10,i,150);
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
selectDash = 1;
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
selectDash = 2;
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
selectDash = 3;
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
selectDash = 4;
}
private void radioButton5_CheckedChanged(object sender, EventArgs e)
{
selectDash = 5;
}
}
}