private void lv_SelectedIndexChanged(object sender, EventArgs e) { if (lv.SelectedIndices.Count != 0) { Shape shape = null; if (intSelectedIndex != -1) { lv.Items[intSelectedIndex].BackColor = Color.White; lv.Items[intSelectedIndex].ForeColor = Color.Black; shape = refManager.GetShape((short)lv.Items [intSelectedIndex].SubItems[0].Tag); UpdateShape(chkLstProperties2, shape); } intSelectedIndex = lv.SelectedIndices[0]; txtShapeName2.Text = lv.SelectedItems[0].SubItems[1].Text; lv.Items[intSelectedIndex].BackColor = Color.FromArgb(49, 106, 197); lv.Items[intSelectedIndex].ForeColor = Color.White; //update the checked listbox with the selected shape's properties shape = refManager.GetShape((short)lv.SelectedItems[0].SubItems[0].Tag); UpdateChkList(chkLstProperties2, shape); txtPropExplain2.Text = ""; } }
private void write_ColorEnumeration() { sbBeginCode.Append("public enum eShapeColor\r\n{\r\n"); int intResult = 0; int intCount = manager.ShapeCount; bool isFirstEnum = true; for (short i = 0; i < intCount; i++) { Shape shape = manager.GetShape(i); if (shape.GetShapeBounds(true).IntersectsWith(AreaBounds)) { if ((bool)shape.GetGDIValue(sGDIProperty.EditColor)) { if (shape.painter.PaintFill) { if (shape.painter.ColorCount == 1) { colorEnumCount++; if (isFirstEnum) { isFirstEnum = false; } else { sbBeginCode.Append(", "); } sbBeginCode.Append(shape.Name + "FillColor"); Math.DivRem(colorEnumCount, 4, out intResult); if (intResult == 0) { sbBeginCode.Append("\r\n"); } } else { colorEnumCount++; if (isFirstEnum) { isFirstEnum = false; } else { sbBeginCode.Append(", "); } sbBeginCode.Append(shape.Name + "FillColor1"); Math.DivRem(colorEnumCount, 4, out intResult); if (intResult == 0) { sbBeginCode.Append("\r\n"); } colorEnumCount++; sbBeginCode.Append(", " + shape.Name + "FillColor2"); Math.DivRem(colorEnumCount, 4, out intResult); if (intResult == 0) { sbBeginCode.Append("\r\n"); } } } if (shape.painter.PaintBorder) { colorEnumCount++; if (isFirstEnum) { isFirstEnum = false; } else { sbBeginCode.Append(", "); } sbBeginCode.Append(shape.Name + "BorderColor"); Math.DivRem(colorEnumCount, 4, out intResult); if (intResult == 0) { sbBeginCode.Append("\r\n"); } } } } } sbBeginCode.Append("}\r\n"); }