示例#1
0
        public void InitUpdatedValues()
        {
            switch (valueChanged)
            {
            case ValueChanged.Text:
            {
                reportCtrlProp.reportControlProperty.Text = Text_tbx.Text;
                value = Text_tbx.Text;
                break;
            }

            case ValueChanged.LocationX:
            {
                reportCtrlProp.reportControlProperty.Location._X = Convert.ToInt16(LocationX_nud.Value);
                value        = new Point((int)(LocationX_nud.Value), (int)(LocationY_nud.Value));
                valueChanged = ValueChanged.Location;
                break;
            }

            case ValueChanged.LocationY:
            {
                reportCtrlProp.reportControlProperty.Location._Y = Convert.ToInt16(LocationY_nud.Value);
                value        = new Point((int)(LocationX_nud.Value), (int)(LocationY_nud.Value));
                valueChanged = ValueChanged.Location;
                break;
            }

            case ValueChanged.Width:
            {
                reportCtrlProp.reportControlProperty.Size = new Size(Convert.ToInt32(Width_nud.Value), Convert.ToInt32(Height_nud.Value));
                value = (int)(Width_nud.Value);
                break;
            }

            case ValueChanged.Height:
            {
                reportCtrlProp.reportControlProperty.Size = new Size(Convert.ToInt32(Width_nud.Value), Convert.ToInt32(Height_nud.Value));
                value = (int)(Height_nud.Value);
                break;
            }

            case ValueChanged.Font:
            {
                Font f = (Font)value;
                ivlFont.FontFamily = f.FontFamily.ToString();
                ivlFont.FontStyle  = f.Style;
                ivlFont.FontSize   = f.Size;
                reportCtrlProp.reportControlProperty.Font           = ivlFont;
                reportCtrlProp.reportControlProperty.Font.FontColor = colorValue.Name;
                break;
            }

            case ValueChanged.ForeColor:
            {
                Font f = (Font)value;
                ivlFont.FontFamily = f.FontFamily.ToString();
                ivlFont.FontStyle  = f.Style;
                ivlFont.FontSize   = f.Size;
                reportCtrlProp.reportControlProperty.Font           = ivlFont;
                reportCtrlProp.reportControlProperty.Font.FontColor = colorValue.Name;
                break;
            }

            case ValueChanged.BorderStyle:
            {
                reportCtrlProp.reportControlProperty.Border = ((Bordertrue_radbtn.Checked));
                value = (bool)(Bordertrue_radbtn.Checked);
                break;
            }

            case ValueChanged.Multiline:
            {
                reportCtrlProp.reportControlProperty.MultiLine = ((Multilinetrue_radbtn.Checked));
                value = (bool)(Multilinetrue_radbtn.Checked);
                break;
            }

            case ValueChanged.ImageLocation:
            {
                reportCtrlProp.reportControlProperty.ImageName = ((NameOfTheImage_tbx.Text));
                value = (string)(NameOfTheImage_tbx.Text);
                break;
            }

            case ValueChanged.BindingType:
            {
                string enumValue = Binding_cbx.Text.TrimStart('$');
                reportCtrlProp.reportControlProperty.Binding = enumValue;
                if (Binding_cbx.Text != "$" + BindingType.None.ToString())
                {
                    Text_tbx.Text = Binding_cbx.Text;

                    value = (string)(Binding_cbx.Text);
                }
                else
                {
                    Text_tbx.Text = reportCtrlProp.reportControlProperty.Name;
                    value         = (string.Empty);
                }
                break;
            }

            case ValueChanged.ImageCount:
            {
                IVL_ImagePanel imagePanel = SelectedObject as IVL_ImagePanel;
                imagePanel.Images = (int)numberOfImages_nud.Value;
                reportCtrlProp.reportControlProperty.NumberOfImages = imagePanel.Images;
                break;
            }

            case ValueChanged.XMargin:
            {
                //if (reportCtrlProp.reportControlProperty.Binding!=BindingType.None)
                {
                    reportCtrlProp.reportControlProperty.MarginDecrementValue = Convert.ToInt32(XMarginValue_nud.Value);
                }
                break;
            }

            case ValueChanged.YMargin:
            {
                //if (reportCtrlProp.reportControlProperty.Binding!=BindingType.None)
                {
                    reportCtrlProp.reportControlProperty.YMarginDecrementValue = Convert.ToInt32(YPaddingValue_nud.Value);
                }
                break;
            }

            case ValueChanged.TextAlign:
            {
                //if (reportCtrlProp.reportControlProperty.Binding!=BindingType.None)
                {
                    value        = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), textAlign_Cmbx.SelectedItem.ToString());
                    TextAlignVal = (TextAlign)Enum.Parse(typeof(TextAlign), textAlign_Cmbx.SelectedItem.ToString());
                    reportCtrlProp.reportControlProperty.TextAlign = TextAlignVal;        // Convert.ToInt32(YPaddingValue_nud.Value);
                }
                break;
            }
            }
            //if (!reportCtrlProp.reportControlProperty.Name.ToLower().Contains("form"))
            UpdateReportControlPropertyList();
            if (!isControlsAdded && valueChanged != ValueChanged.XMargin && valueChanged != ValueChanged.YMargin)
            {
                SetPropertyInfo(value);
            }
        }
示例#2
0
        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;
        }