Click here to Skip to main content
15,922,007 members

Comments by hojatIzadi (Top 14 by date)

hojatIzadi 21-Jul-16 9:04am View    
Ok .thank you
hojatIzadi 21-Jul-16 8:52am View    
Griff please look at some more codes:
Int32 staff = 0;
Int32 triad = 0;


int h = (e.Y / 5) * 5;


if (e.Y >= 100 && e.Y < 300)
{
staff = 1;
noteloc = (h / 5) - 12;


}
else if (e.Y >= 340 && e.Y < 540)
{
staff = 2;
noteloc = (h / 5) - 60;
}
else if (e.Y >= 580 && e.Y < 780)
{
staff = 3;
noteloc = (h / 5) - 108;
}

if (e.X >= 100 && e.X < 300)
{
triad = 1;
}
else if (e.X >= 300 && e.X < 500)
{
triad = 2;
}
else if (e.X >= 500 && e.X < 700)
{
triad = 3;
}
else if (e.X >= 700 && e.X < 900)
{
triad = 4;
}

if (staff == 0 || triad == 0)
{
// MessageBox.Show("Out of range");
return;
}

if (staff > 4 || triad > 4)
{
MessageBox.Show("Out of range");
return;
}

if (!Staffs.Keys.Contains(staff))
{
Staffs.Add(staff, new Dictionary<int, list<int="">>());
}

if (!Staffs[staff].Keys.Contains(triad))
{
Staffs[staff].Add(triad, new List<int>());
}

if (Staffs[staff][triad].Count >= 4)
{
if(myVar.sitnote)
MessageBox.Show("Maximum notes reached");

return;
}
hojatIzadi 21-Jul-16 6:15am View    
Deleted
Hi OriginalGriff
you said true but I have this problem just when I have 4 items in the list .
result for 3 item (count=3) after remove is count=2.
result for 2 item (count=3) after remove is count=1.
result for 1 item (count=3) after remove is count=0.
hojatIzadi 21-Jul-16 6:14am View    
Hi OriginalGriff
you said true but I have this problem just when I have 4 items in the list .
result for 3 item (count=3) after remove is count=2.
result for 2 item (count=2) after remove is count=1.
result for 1 item (count=1) after remove is count=0.
hojatIzadi 21-Jul-16 3:56am View    
Dictionary<int32, dictionary<int32,="" list<int32="">>> Staffs = new Dictionary<int, dictionary<int,="" list<int="">>>();
//---------------
if (!Staffs.Keys.Contains(staff))
{
Staffs.Add(staff, new Dictionary<int, list<int="">>());
}

if (!Staffs[staff].Keys.Contains(triad))
{
Staffs[staff].Add(triad, new List<int>());
}

if (Staffs[staff][triad].Count >= 4)
{
if(myVar.sitnote)
MessageBox.Show("Maximum notes reached");

return;
}
//--------------------
if (staff == 1 && triad == 1)
{
triad1 = Staffs[1][1].ToArray(); Array.Sort(triad1);
mypoint.Add(newpoint);

}
//--------------------------
foreach (int value in Staffs[1][1])
{
if (value == noteloc)
{

a = true;
qq = value;

}
}
if (a)
Staffs[1][1].Remove(qq);
triad1 = Staffs[1][1].ToArray();