public void ReadResxImages(string resxPath) { using (ResXResourceSet resxSet = new ResXResourceSet(resxPath)) { foreach (string grid in Grids.Keys) { foreach (ResourceImage image in grids[grid].Images.Values) { image.ImageData = (System.Drawing.Image)resxSet.GetObject(image.Name); } if (!grids[grid].Images.ContainsKey($"{grid}.Images")) { ResourceImage asterisk = new ResourceImage(); asterisk.Name = $"{grid}.Images"; asterisk.ImageData = Resources.image_asterisk; grids[grid].Images.Add(asterisk.Name, asterisk); } } } }
public static void ProcessGridProperty(Dictionary <string, C1TrueDBGrid> grids, Dictionary <string, C1DataColumn> columns, Dictionary <string, ValueItem> valueItemsDict, string line) { //Verify if the line is the assignment of a known grid GroupCollection groups = RegularExpressions.ComplexProperty.Matches(line)[0].Groups; C1TrueDBGrid grid = grids[groups[1].Value]; int index = -1; if (groups[4].Value != "") { index = int.Parse(groups[4].Value); } string value = groups[15].Value; string subLine = groups[5].Value; string property = groups[2].Value; switch (property.ToUpper()) { case nameof(SplitProperties.ALTERNATINGROWS): grid.Splits[0].Properties["AlternatingRowStyle"] = Utilities.FirstCharToUpper(value); break; case nameof(GridProperties.CAPTION): grid.Properties["Caption"] = Utilities.RemoveBeginEndQuotes(value); break; case nameof(GridProperties.BACKCOLOR): grid.TimesReadBackColor++; grid.Properties["BackColor"] = value; break; case nameof(StyleProperties.FONT): grid.Styles["Style"].Properties["Font"] = Utilities.ProcessFontProperty(value); break; case nameof(GridProperties.HEIGHT): grid.Height = Utilities.PropertyValueTwipsToPixels(value); break; case nameof(SplitProperties.HSCROLLBAR): if (groups[5].Value.Equals("Style")) { grid.Splits[0].Properties["HBarStyle"] = Utilities.EnumValueToString(value); } break; case nameof(GridProperties.IMAGES): string imageName = RegularExpressions.GetObject.Matches(groups[12].Value)[0].Groups[1].Value; ResourceImage image = new ResourceImage(); image.Name = imageName; grid.Images[imageName] = image; break; case nameof(GridProperties.NAME): grid.Properties["Name"] = value; grid.TimesReadName++; break; case nameof(GridProperties.PREVIEWINFO): PreviewInfoPropertyReader.ProcessPreviewInfoProperty(grid.PreviewInfo, subLine, value); break; case nameof(GridProperties.PRINTINFO): PrintInfoPropertyReader.ProcessPrintInfoProperty(grid.PrintInfo, subLine, value); break; case nameof(GridProperties.ROWDIVIDER): GridLinesPropertyReader.ProcessGridLinesProperty(grid.RowDivider, subLine, value); break; case nameof(GridProperties.SIZE): GroupCollection groupsSize = RegularExpressions.Size.Matches(line)[0].Groups; grid.Width = Int32.Parse(groupsSize[1].Value); grid.Height = Int32.Parse(groupsSize[2].Value); break; case nameof(GridProperties.STYLES): grid.IncorrectPropertiesInDesigner = true; break; case nameof(SplitProperties.VSCROLLBAR): if (groups[5].Value.Equals("Style")) { grid.Splits[0].Properties["VBarStyle"] = Utilities.EnumValueToString(value); } break; case nameof(GridProperties.COLUMNS): grid.IncorrectPropertiesInDesigner = true; if (groups[7].Value == "Add") { string argument = groups[12].Value; if (!argument.StartsWith("new ")) { string columnName = argument.Split('.')[1]; grid.DataCols.Add(columns[columnName]); } } else { int columnIndex = Utilities.StringToIndex(groups[4].Value); C1DataColumn column = Utilities.GetCreateListElement <C1DataColumn>(grid.DataCols, columnIndex); ColumnPropertyReader.ProcessColumnProperty(column, valueItemsDict, subLine, value); } break; case nameof(GridProperties.WIDTH): grid.Width = Int32.Parse(value); break; case nameof(GridProperties.SPLITS): grid.IncorrectPropertiesInDesigner = true; int splitIndex = Utilities.StringToIndex(groups[4].Value); Split split = Utilities.GetCreateListElement <Split>(grid.Splits, splitIndex); SplitPropertyReader.ProcessSplitProperty(split, subLine, value); break; default: if (grid.Splits[0].Properties.ContainsKey(property) && !grid.Properties.ContainsKey(property)) { grid.Splits[0].Properties[property] = Utilities.CleanXMLProperty(value); } else if (grid.Styles.ContainsKey(property)) { grid.IncorrectPropertiesInDesigner = true; StylePropertyReader.ProcessStyleProperty(grid.Styles[property], subLine, value); } else if (groups[11].Value == "") // if it isn't a method call from the grid { grid.Properties[property] = Utilities.CleanGridProperty(value); } break; } }