public CustomPropertyGridHost(DesignSurfaceManagerExt surfaceManager) { imageNameSettingWindow = new ImageNameSettingsWindow(); bindingTypeAdd = new List <string>(); const string _signature_ = _Name_ + @"::ctor()"; InitializeComponent(); prop = new PropertyGrid(); reportCtrlList = new List <ReportControlsStructure>(); this.Dock = DockStyle.Fill; fontUC = new Font_UC(); if (!File.Exists(bindingFileName)) { foreach (BindingType item in Enum.GetValues(typeof(BindingType)) as BindingType[]) { bindingTypeAdd.Add("$" + item.ToString()); } } else { Deserialize(); } Binding_cbx.DataSource = bindingTypeAdd; LocationX_nud.Value = XLocation; LocationY_nud.Value = YLocation; NameOfTheImage_tbx.Text = logoDefaultValue; panel1.Controls.Add(fontUC); ivlFont = new IVLFont(); //- the surface manager strictly tied with PropertyGridHost if (null == surfaceManager) { throw new ArgumentNullException("surfaceManager", _signature_ + " - Exception: invalid argument (null)!"); } fontUC.Dock = DockStyle.Fill; fontUC.fontValueUpdate += fontUC_fontValueUpdate; SurfaceManager = surfaceManager; }
public void SetSelctedObjectProperties(object seletedctrl) { if (seletedctrl is Form) { Form frm = ((Form)SelectedObject); numberOfImages_nud.Enabled = false; Property_tbx.Text = ((Form)SelectedObject).Name; //Text_tbx.Text = frm.Text; if (frm.Location.X > 0) { LocationX_nud.Value = frm.Location.X; } if (frm.Location.Y > 0) { LocationY_nud.Value = frm.Location.Y; } Width_nud.Value = frm.Width; Height_nud.Value = frm.Height; controlDisplayText = ""; } else { { isControlsAdded = true; if (reportCtrlList.Where(x => x.reportControlProperty.Name == ((Control)SelectedObject).Site.Name).Count() == 0) { reportCtrlProp = new ReportControlsStructure(); ivlFont = new IVLFont(); ((Control)SelectedObject).Font = new Font(new FontFamily(Common.CommonStaticMethods.GetDescription(CustomFontFamilies.Times_New_Roman)), 9); DisableAllControls(); } else { if (reportCtrlProp != null) { if (reportCtrlProp.reportControlProperty.Name != ((Control)SelectedObject).Site.Name) { DisableAllControls(); } } else { DisableAllControls(); } reportCtrlProp = reportCtrlList.Where(x => x.reportControlProperty.Name == ((Control)SelectedObject).Site.Name).First(); ivlFont = reportCtrlProp.reportControlProperty.Font; } prop.SelectedObject = SelectedObject; reportCtrlProp.reportControlProperty.Name = ((Control)SelectedObject).Site.Name; setPropertyText(((Control)SelectedObject).Site.Name); GetPropertyInfo(reportCtrlProp.reportControlProperty); reportCtrlProp.reportControlProperty.Size = new Size(Width, Height); reportCtrlProp.reportControlProperty.Type = ((Control)SelectedObject).GetType().Name; if (((Control)SelectedObject).GetType() == typeof(PictureBox)) { if (reportCtrlList.Where(x => x.reportControlProperty.Name == ((Control)SelectedObject).Site.Name).Count() == 0) { PictureBox ctrl = (Control)SelectedObject as PictureBox; ctrl.ImageLocation = logoDefaultValue; if (File.Exists(logoDefaultValue)) { reportCtrlProp.reportControlProperty.ImageName = logoDefaultValue; } else if (File.Exists(@"ImageResources\" + logoDefaultValue)) { reportCtrlProp.reportControlProperty.ImageName = @"ImageResources\" + logoDefaultValue; } ctrl.SizeMode = PictureBoxSizeMode.Zoom; } } if (((Control)SelectedObject).GetType() == typeof(Label)) { textAlign_Cmbx.Enabled = true; } if (((Control)SelectedObject).GetType() == typeof(ReportUtils.IVL_ImagePanel)) { IVL_ImagePanel IVLt = (Control)SelectedObject as IVL_ImagePanel; numberOfImages_nud.Enabled = true; rowsCount = Convert.ToByte(IVLt.RowCount); colsCount = Convert.ToByte(IVLt.ColumnCount); } if (((Control)SelectedObject).GetType() == typeof(TableLayoutPanel)) { TableLayoutPanel IVLt = (Control)SelectedObject as TableLayoutPanel; //if (IVLt.RowCount != Rows_nud.Value || IVLt.ColumnCount != Column_nud.Value) // IVLt.UpdateRowsCols((int)Rows_nud.Value, (int)Column_nud.Value); rowsCount = Convert.ToByte(IVLt.RowCount); colsCount = Convert.ToByte(IVLt.ColumnCount); IVLt.RowStyles.Clear(); for (int i = 1; i <= IVLt.RowCount; i++) { IVLt.RowStyles.Add(new RowStyle(SizeType.Percent, (100 / IVLt.RowCount))); } IVLt.ColumnCount = IVLt.ColumnCount; IVLt.ColumnStyles.Clear(); for (int i = 1; i <= IVLt.ColumnCount; i++) { IVLt.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50)); } } fontUC.ReloadFontChanges(((Control)SelectedObject), reportCtrlProp.reportControlProperty); AddReportControlPropertyList(); EnableControls(); showControlProperties(); } } isControlsAdded = false; }