public FormColumnTitle(ColumnTitle columnTitle)
		{
			InitializeComponent();
			_columnTitle = columnTitle;

			xtraTabPageBanner.PageEnabled = MainController.Instance.Lists.Banners.MainFolder.ExistsLocal();
			xtraTabPageWidget.PageEnabled = MainController.Instance.Lists.Widgets.MainFolder.ExistsLocal();

			buttonEditFont.ButtonClick += EditorHelper.FontEdit_ButtonClick;
			buttonEditFont.Click += EditorHelper.FontEdit_Click;

			Load += OnFormLoad;

			if ((base.CreateGraphics()).DpiX > 96)
			{
				laColumn1BackColor.Font = new Font(laColumn1BackColor.Font.FontFamily, laColumn1BackColor.Font.Size - 2, laColumn1BackColor.Font.Style);
				laForeColor.Font = new Font(laForeColor.Font.FontFamily, laForeColor.Font.Size - 2, laForeColor.Font.Style);
				laFont.Font = new Font(laFont.Font.FontFamily, laFont.Font.Size - 2, laFont.Font.Style);
				laColumn1Alignment.Font = new Font(laColumn1Alignment.Font.FontFamily, laColumn1Alignment.Font.Size - 2, laColumn1Alignment.Font.Style);
				ckEnableText.Font = new Font(ckEnableText.Font.FontFamily, ckEnableText.Font.Size - 2, ckEnableText.Font.Style);
				rbAlignmentCenter.Font = new Font(rbAlignmentCenter.Font.FontFamily, rbAlignmentCenter.Font.Size - 2, rbAlignmentCenter.Font.Style);
				rbAlignmentLeft.Font = new Font(rbAlignmentLeft.Font.FontFamily, rbAlignmentLeft.Font.Size - 2, rbAlignmentLeft.Font.Style);
				rbAlignmentRight.Font = new Font(rbAlignmentRight.Font.FontFamily, rbAlignmentRight.Font.Size - 2, rbAlignmentRight.Font.Style);
				ckApplyForAllColumnTitles.Font = new Font(ckApplyForAllColumnTitles.Font.FontFamily, ckApplyForAllColumnTitles.Font.Size - 2, ckApplyForAllColumnTitles.Font.Style);
				xtraTabControlWindowProperties.Appearance.Font = new Font(xtraTabControlWindowProperties.Appearance.Font.FontFamily, xtraTabControlWindowProperties.Appearance.Font.Size - 2, xtraTabControlWindowProperties.Appearance.Font.Style);
				xtraTabControlWindowProperties.AppearancePage.Header.Font = new Font(xtraTabControlWindowProperties.AppearancePage.Header.Font.FontFamily, xtraTabControlWindowProperties.AppearancePage.Header.Font.Size - 2, xtraTabControlWindowProperties.AppearancePage.Header.Font.Style);
				xtraTabControlWindowProperties.AppearancePage.HeaderActive.Font = new Font(xtraTabControlWindowProperties.AppearancePage.HeaderActive.Font.FontFamily, xtraTabControlWindowProperties.AppearancePage.HeaderActive.Font.Size - 2, xtraTabControlWindowProperties.AppearancePage.HeaderActive.Font.Style);
				xtraTabControlWindowProperties.AppearancePage.HeaderDisabled.Font = new Font(xtraTabControlWindowProperties.AppearancePage.HeaderDisabled.Font.FontFamily, xtraTabControlWindowProperties.AppearancePage.HeaderDisabled.Font.Size - 2, xtraTabControlWindowProperties.AppearancePage.HeaderDisabled.Font.Style);
				xtraTabControlWindowProperties.AppearancePage.HeaderHotTracked.Font = new Font(xtraTabControlWindowProperties.AppearancePage.HeaderHotTracked.Font.FontFamily, xtraTabControlWindowProperties.AppearancePage.HeaderHotTracked.Font.Size - 2, xtraTabControlWindowProperties.AppearancePage.HeaderHotTracked.Font.Style);
			}
		}
		public ColumnTitleControl(ColumnTitle data)
		{
			InitializeComponent();
			Data = data;

			BackColor = Data.Settings.BackgroundColor;
			labelControlText.BackColor = Data.Settings.BackgroundColor;

			if (Data.Banner.Enable && Data.Banner.DisplayedImage != null)
			{
				labelControlText.Appearance.Image = Data.Banner.DisplayedImage;
			}
			else if (Data.Widget.Enabled && Data.Widget.DisplayedImage != null)
			{
				labelControlText.Appearance.Image = Data.Widget.DisplayedImage;
			}
			else
				labelControlText.Appearance.Image = null;

			var alignment = Data.Banner.Enable && Data.Banner.DisplayedImage != null
				? Data.Banner.ImageAlignement
				: Data.Settings.HeaderAlignment;
			switch (alignment)
			{
				case HorizontalAlignment.Left:
					labelControlText.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
					break;
				case HorizontalAlignment.Center:
					labelControlText.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
					break;
				case HorizontalAlignment.Right:
					labelControlText.Appearance.TextOptions.HAlignment = HorzAlignment.Far;
					break;
			}

			if (Data.Banner.Enable && Data.Banner.TextEnabled && !String.IsNullOrEmpty(Data.Banner.Text.Trim()))
			{
				labelControlText.Text = Data.Banner.Text;
				labelControlText.Font = Data.Banner.Font;
				labelControlText.ForeColor = Data.Banner.ForeColor;
			}
			else if (Data.Settings.ShowText && !String.IsNullOrEmpty(Data.Settings.Text.Trim()))
			{
				labelControlText.Text = Data.Settings.Text;
				labelControlText.Font = Data.Settings.HeaderFont;
				labelControlText.ForeColor = Data.Settings.ForeColor;
			}
		}
		private static void ImportData(
			this SoapColumn target,
			ColumnTitle source)
		{
			var imageConverter = TypeDescriptor.GetConverter(typeof(Bitmap));
			target.pageId = source.Page.ExtId.ToString();
			target.libraryId = source.Page.Library.ExtId.ToString();
			target.name = source.Settings.Text;
			target.order = source.ColumnOrder;
			target.backColor = source.Settings.BackgroundColor.ToHex();
			target.foreColor = source.Settings.ForeColor.ToHex();
			target.showText = source.Settings.ShowText;
			target.alignment = source.Settings.HeaderAlignment.ToString().ToLower();
			target.enableWidget = source.Widget.Enabled;
			target.widget = Convert.ToBase64String((byte[])imageConverter.ConvertTo(source.Widget.DisplayedImage, typeof(byte[])));
			target.font = new Font();
			target.font.name = source.Settings.HeaderFont.Name;
			target.font.size = (int)Math.Round(source.Settings.HeaderFont.Size, 0);
			target.font.isBold = source.Settings.HeaderFont.Bold;
			target.font.isItalic = source.Settings.HeaderFont.Italic;
			target.dateModify = source.LastModified.ToString("MM/dd/yyyy hh:mm:ss tt");
		}
Esempio n. 4
0
		public void ApplyColumnTitleSettings(ColumnTitle templateColumnTitle)
		{
			if (!Settings.ApplyForAllColumnTitles) return;
			foreach (var targetColumnTitle in ColumnTitles.Where(f => f.ExtId != templateColumnTitle.ExtId))
			{
				targetColumnTitle.Settings = templateColumnTitle.Settings.Clone<ColumnTitle.ColumnTitleSettings>(targetColumnTitle);
				targetColumnTitle.Widget = templateColumnTitle.Widget.Clone<WidgetSettings>(targetColumnTitle);
				targetColumnTitle.Banner = templateColumnTitle.Banner.Clone<BannerSettings>(targetColumnTitle);
				targetColumnTitle.MarkAsModified();
			}
		}