Forum » Programiranje » c#, free hand risanje
c#, free hand risanje
japol ::
Pri mouse move imam kodo:
seveda je mousepath že pred tem določen z
mousepath = new System......
in
private System...... mousepath;
S to kodo rišeš prosto na form, dela, ampak ko hočeš risati 2 "čački" ali več, te "čačke" poveže med sabo - in tega bi se rad rešil.
nekaj podobno temu iščem:
http://www.codeproject.com/KB/GDI-plus/...
http://www.java2s.com/Code/CSharp/2D-Gr...
a pa še nekaj: rišeš na form in ko ga miniziraš in nato maksimiziraš ni več slik na formu, kako to rešit? Hvala
if (e.Button == MouseButtons.Left)
{
int mouseX = e.X;
int mouseY = e.Y;
mousepath.AddLine (mouse.X, mouse.Y,mouse.X, mouse.Y);
System.Drawing.Graphics formgraphics20;
formgraphics20 = this.CreateGraphics();
Pen p = new Pen (panel1.BackColor, deb);
formgraphisc20.DrawPath(p, mousepath);
}
}
seveda je mousepath že pred tem določen z
mousepath = new System......
in
private System...... mousepath;
S to kodo rišeš prosto na form, dela, ampak ko hočeš risati 2 "čački" ali več, te "čačke" poveže med sabo - in tega bi se rad rešil.
nekaj podobno temu iščem:
http://www.codeproject.com/KB/GDI-plus/...
http://www.java2s.com/Code/CSharp/2D-Gr...
a pa še nekaj: rišeš na form in ko ga miniziraš in nato maksimiziraš ni več slik na formu, kako to rešit? Hvala
- spremenil: Gandalfar ()
japol ::
Še en primer (sestavljen iz drugega linka):
in tu je counter = 0; s tem sem ločil prejšnjo čačko od nove, sam mi pa prejšnjo izbriše, tega pa nočem, kakšna ideja?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
// 1.
using System.Data;
using System.Drawing.Drawing2D;
namespace Risanje_z_MISKO_freehand_risanje
{
public partial class Form1 : Form
{
// 2.
private Point[] thePoints;
private int counter;
public Form1()
{
InitializeComponent();
// 3.
thePoints = new Point[1000];
for (int i = 0; i < thePoints.Length; i++)
thePoints[i] = new Point(0, 0);
counter = 0;
}
// 4.
protected override void OnPaint(PaintEventArgs e)
{
if (counter == 0)
return;
Pen greenPen = new Pen(Color.Red, 4);
Point[] curvePoints = new Point[counter];
for (int i = 0; i < curvePoints.Length; i++)
{
curvePoints[i] = new Point(0, 0);
curvePoints[i].X = thePoints[i].X;
curvePoints[i].Y = thePoints[i].Y;
}
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
e.Graphics.DrawCurve(greenPen, curvePoints);
}
//5.
protected override void OnLoad(System.EventArgs e)
{
MouseMove += new MouseEventHandler(Form1_MouseMove);
MouseUp += new MouseEventHandler(Form1_MouseUp);
}
//6.1.
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
thePoints[counter].X = e.X;
thePoints[counter].Y = e.Y;
Label l = new Label();
this.SuspendLayout();
counter++;
if (counter > 4)
this.Refresh();
}
}
//6.2.
private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
thePoints[counter].X = e.X;
thePoints[counter].Y = e.Y;
//Label l = new Label();
//this.SuspendLayout();
// ta povezuje krivulje med sabo
//counter++;
//if (counter > 4)
//this.Refresh();
// s tem pa rišeš ponovno vsako zase a prejšnjo ?a?ko izbriše!:
counter = 0;
}
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
in tu je counter = 0; s tem sem ločil prejšnjo čačko od nove, sam mi pa prejšnjo izbriše, tega pa nočem, kakšna ideja?
Zgodovina sprememb…
- spremenil: Gandalfar ()
japol ::
Še vedno noben k bi to znou narest? Kako popraut to kodo (drugi post) da mi bo čačke ločevalo med sabo in da ko bom hotu še kako drugo zrisat, da mi prve ne zbriše.
DubleG ::
V array list shrani vse kar rišeš.
GA-P55M-UD2,i5,12GB RAM,Radeon HD 4850,Crucial SSD 64GB,
WD 320GB,WD 5000GB,RevoDrive X2 100GB
WD 320GB,WD 5000GB,RevoDrive X2 100GB
Vredno ogleda ...
| Tema | Ogledi | Zadnje sporočilo | |
|---|---|---|---|
| Tema | Ogledi | Zadnje sporočilo | |
| » | c# formOddelek: Programiranje | 2024 (1538) | FuI2cY |
| » | [c#] ukaz radirkaOddelek: Programiranje | 1261 (1054) | japol |
| » | [c#] picturebox, slika na slikoOddelek: Programiranje | 1213 (1023) | japol |
| » | [c#] Risanje z miškoOddelek: Programiranje | 1536 (1217) | japol |
| » | Kako se tole naredi?Oddelek: Izdelava spletišč | 1620 (1320) | njok |