Click here to Skip to main content
15,898,588 members

Comments by kastriotlimani (Top 7 by date)

kastriotlimani 6-May-13 14:39pm View    
Deleted
Pen lapsi = new Pen(Color.Black, 3);

Rectangle katrori = new Rectangle(250, 200, 200, 200);
Rectangle katrori2 = new Rectangle(350, 200, 200, 200);
Rectangle katrori3 = new Rectangle(150, 200, 200, 200);

Rectangle katrori4 = new Rectangle(200, 110, 200, 200);
Rectangle katrori5 = new Rectangle(200, 285, 200, 200);
Rectangle katrori6 = new Rectangle(295, 110, 200, 200);
Rectangle katrori7 = new Rectangle(300, 282, 200, 200);

Graphics g = this.CreateGraphics();

g.DrawEllipse(lapsi, katrori); //kryesor
g.DrawEllipse(lapsi, katrori2); //djatht
g.DrawEllipse(lapsi, katrori3); //majt
g.DrawEllipse(lapsi, katrori4); //nalt-majt
g.DrawEllipse(lapsi, katrori5); //posht-majt
g.DrawEllipse(lapsi, katrori6); //nalt-djatht
g.DrawEllipse(lapsi, katrori7);//posht djatht

I have drawn 7 circles so far, but i only want to show the one in the middle containing rossete. How to get rid of those extra lines outside the main circle..
kastriotlimani 6-May-13 14:14pm View    
Deleted
Pen lapsi = new Pen(Color.Black, 3);
SolidBrush brusha = new SolidBrush(Color.Red);
SolidBrush brusha1 = new SolidBrush(Color.Orange);
SolidBrush brusha2 = new SolidBrush(Color.Blue);
SolidBrush brusha3 = new SolidBrush(Color.Gray);
SolidBrush brusha4 = new SolidBrush(Color.Green);
SolidBrush brusha5 = new SolidBrush(Color.Purple);
SolidBrush brusha6 = new SolidBrush(Color.DarkSeaGreen);

Rectangle katrori = new Rectangle(250, 200, 200, 200);
Rectangle katrori2 = new Rectangle(350, 200, 200, 200);
Rectangle katrori3 = new Rectangle(150, 200, 200, 200);

Rectangle katrori4 = new Rectangle(200, 110, 200, 200);
Rectangle katrori5 = new Rectangle(200, 285, 200, 200);
Rectangle katrori6 = new Rectangle(295, 110, 200, 200);
Rectangle katrori7 = new Rectangle(300, 282, 200, 200);

Graphics g = this.CreateGraphics();

g.DrawEllipse(lapsi, katrori); //kryesor
g.DrawEllipse(lapsi, katrori2); //djatht
g.DrawEllipse(lapsi, katrori3); //majt
g.DrawEllipse(lapsi, katrori4); //nalt-majt
g.DrawEllipse(lapsi, katrori5); //posht-majt
g.DrawEllipse(lapsi, katrori6); //nalt-djatht
g.DrawEllipse(lapsi, katrori7);//posht djatht

I have drawn 7 circles so far, but i only want to show the one in the middle containing rossete. How to get rid of those extra lines outside the main circle..
kastriotlimani 8-Apr-13 10:59am View    
Well, I realized that I need to know the coordinates of regular hexagon shape, then to join those points with same tension using Graphics.DrawCurve. But the problem is how to draw a regular hexagon first ...
kastriotlimani 28-Mar-13 11:36am View    
Thank You, it worked finally :)
Have a nice day !
kastriotlimani 28-Mar-13 10:51am View    
Deleted
I have a character (bitmap image) controlled with wasd keys, and collecting dots with that.
I want those dots to be (ex: coins).
here it is all the coding i made:


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;
using System.Media;

namespace LojaMePika
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}


Bitmap creature;
Bitmap background;
Graphics g;
Graphics scG;
Rectangle area;

Rectangle[] rects;


Timer t;

bool right;
bool left;
bool up;
bool down;

int collectedNumber = 0;


private void Form1_Load(object sender, EventArgs e)
{
creature = new Bitmap(@"C:\Users\kasske\Desktop\LojaTomi.png");
creature.MakeTransparent(Color.White);

background = new Bitmap(this.Width, this.Height);

area = new Rectangle(50, 50, 100, 100);

rects = new Rectangle[10];

makerect();

g = this.CreateGraphics();
scG = Graphics.FromImage(background);

t = new Timer();
t.Interval = 10;
t.Tick += new EventHandler(t_Tick);
t.Start();
}

void t_Tick(object sender, EventArgs e)
{
if (up) { area.Y -= 5; }
if (left) { area.X -= 5; }
if (down) { area.Y += 5; }
if (right) { area.X += 5; }


g.DrawImage(Draw(), new Point(0, 0));

for (int i = 0; i < rects.Length; i++)
{
if (area.IntersectsWith(rects[i]))
{
collectedNumber++;
rects[i] = new Rectangle(-100, -100, 1, 1);
SoundPlayer zeri = new SoundPlayer(@"C:\Users\kasske\Desktop\bell-ringing-05.wav");
zeri.Play();

if (collectedNumber == 10)
{
MessageBox.Show("Keni mbledhur te gjitha pikat");
this.Close();
}

}

}

}







public Rectangle[] makerect()
{
Random r = new Random();

for (int i = 0; i < rects.Length; i++)
{
rects[i] = new Rectangle(r.Next(0,this.Width),r.Next(0,this.Height),10,10);
}
return rects;
}

public Bitmap Draw()
{

scG.Clear(Color.FromArgb(255, Color.DarkBlue));
scG.FillRectangles(Brushes.Gold, rects);
scG.DrawImage(creature, area);
scG.DrawString(collectedNumber.ToString(), new Font("Arial", 15), Brushes.Gold, new PointF(10,10));
return background;

}



private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.W) { up = true; }
if (e.KeyCode == Keys.A) { left = true; }
if (e.KeyCode == Keys.S) { down = true; }
if (e.KeyCode == Keys.D) { right = true; }
}

private void Form1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.W) { up = false; }
if (e.KeyCode == Keys.A) { left = false; }
if (e.KeyCode == Keys.S) { down = false; }
if (e.KeyCode == Keys.D) { right = false; }
}
}
}