public virtual void Synchronize() { if (this.Data.ChatMessagesViewElement.ShowAvatars) { if (this.Data.MessageType == ChatMessageType.Single || this.Data.MessageType == ChatMessageType.First) { this.AvatarPictureElement.Visibility = ElementVisibility.Visible; } else { this.AvatarPictureElement.Visibility = ElementVisibility.Hidden; } } else { this.AvatarPictureElement.Visibility = ElementVisibility.Collapsed; } if (this.Data.MessageType == ChatMessageType.Single || this.Data.MessageType == ChatMessageType.First) { this.NameLabelElement.Visibility = ElementVisibility.Visible; } else { this.NameLabelElement.Visibility = ElementVisibility.Collapsed; } this.StatusLabelElement.Visibility = this.Data.MessageType == ChatMessageType.Single || this.Data.MessageType == ChatMessageType.Last ? ElementVisibility.Visible : ElementVisibility.Collapsed; this.IsOwnMessage = this.Data.IsOwnMessage; this.AvatarPictureElement.Image = this.Data.Message.Author.Avatar; this.AvatarPictureElement.MaxSize = TelerikDpiHelper.ScaleSize(Size.Round(this.Data.ChatMessagesViewElement.AvatarSize), new SizeF(1f / this.DpiScaleFactor.Width, 1f / this.DpiScaleFactor.Height)); this.NameLabelElement.Text = this.GetNameLabelText(); this.StatusLabelElement.Text = this.Data.Status; this.Data.ChatMessagesViewElement.ChatElement.OnItemFormatting(new ChatItemElementEventArgs(this)); }
protected override void ShowPopupCore(Size size, Point location) { SizeF dpiScaleFactor = this.ownerAlert.DpiScaleElement.DpiScaleFactor; bool isEmpty = this.LastShowDpiScaleFactor.IsEmpty; if (this.LastShowDpiScaleFactor != dpiScaleFactor) { if (isEmpty) { this.LastShowDpiScaleFactor = new SizeF(1f, 1f); } SizeF factor = new SizeF(dpiScaleFactor.Width / this.LastShowDpiScaleFactor.Width, dpiScaleFactor.Height / this.LastShowDpiScaleFactor.Height); this.LastShowDpiScaleFactor = dpiScaleFactor; this.Scale(factor); if (isEmpty) { size = TelerikDpiHelper.ScaleSize(size, new SizeF(1f / factor.Width, 1f / factor.Height)); } } this.SetBoundsCore(location.X, location.Y, size.Width, size.Height, BoundsSpecified.All); Telerik.WinControls.NativeMethods.ShowWindow(this.Handle, 4); if (DWMAPI.IsCompositionEnabled && this.EnableAeroEffects) { this.UpdateAeroEffectState(); } ControlHelper.BringToFront(this.Handle, false); }
private Size GetDropDownSize() { Size size = Size.Empty; SizeF scaleFactor1 = this.PopupControl == null || this.PopupControl.OwnerElement == null ? new SizeF(1f, 1f) : this.PopupControl.OwnerElement.DpiScaleFactor; int val1 = TelerikDpiHelper.ScaleInt(185, scaleFactor1); size = new Size(Math.Max(val1, this.dateTimePickerElement.ControlBoundingRectangle.Width), Math.Max(val1, TelerikDpiHelper.ScaleInt(this.dropDownHeight, scaleFactor1))); if (this.dateTimePickerElement.ElementTree != null) { if (size.Width == -1) { size.Width = this.dateTimePickerElement.ElementTree.Control.Width; } size.Height = TelerikDpiHelper.ScaleInt(this.dropDownHeight, scaleFactor1) + (this.DropDownSizingMode != SizingMode.None ? 10 : 0); if (this.dateTimePickerElement.CalendarSize != new Size(100, 156)) { size = this.dateTimePickerElement.CalendarSize; } size = new Size(size.Width, size.Height); if (this.cachedSize != Size.Empty) { size = this.cachedSize; } if (this.LastShowDpiScale != scaleFactor1) { SizeF scaleFactor2 = new SizeF(this.DateTimePickerElement.DpiScaleFactor.Width / this.LastShowDpiScale.Width, this.DateTimePickerElement.DpiScaleFactor.Height / this.LastShowDpiScale.Height); this.LastShowDpiScale = this.DateTimePickerElement.DpiScaleFactor; size = TelerikDpiHelper.ScaleSize(size, scaleFactor2); } } return(size); }
private void HandleDpiChanged() { float num = 1f; if (this.oldDpi != 0) { num = (float)this.currentDpi / (float)this.oldDpi; } else if (this.oldDpi == 0) { num = (float)this.currentDpi / 96f; } if ((double)num == 1.0) { return; } this.maxSizeState = this.MaximumSize; this.minSizeState = this.MinimumSize; this.MinimumSize = Size.Empty; this.MaximumSize = Size.Empty; this.SaveAnchorStates(); this.Scale(new SizeF(num, num)); this.RestoreAnchorStates(); this.MinimumSize = TelerikDpiHelper.ScaleSize(this.minSizeState, new SizeF(num, num)); this.MaximumSize = TelerikDpiHelper.ScaleSize(this.maxSizeState, new SizeF(num, num)); }
private int GetHorizontalLocation(RadDesktopAlert alert) { Size size = alert.Popup.NonAnimatedSize; if (alert.Popup.LastShowDpiScaleFactor.IsEmpty) { size = TelerikDpiHelper.ScaleSize(size, alert.DpiScaleElement.DpiScaleFactor); } switch (alert.ScreenPosition) { case AlertScreenPosition.BottomRight: case AlertScreenPosition.TopRight: return(this.activeScreen.WorkingArea.X + this.activeScreen.WorkingArea.Width - size.Width); case AlertScreenPosition.BottomCenter: case AlertScreenPosition.TopCenter: return(this.activeScreen.WorkingArea.X + (this.activeScreen.WorkingArea.Width - size.Width) / 2); case AlertScreenPosition.BottomLeft: case AlertScreenPosition.TopLeft: return(this.activeScreen.WorkingArea.X); default: return(this.activeScreen.WorkingArea.X); } }
public void Show() { if (DesktopAlertManager.Instance.ContainsAlert(this)) { return; } RadPopupOpeningEventArgs args = new RadPopupOpeningEventArgs(this.popup.Location); this.OnPopupOpening((object)this, args); if (args.Cancel) { return; } SizeF monitorDpi = Telerik.WinControls.NativeMethods.GetMonitorDpi(Screen.FromPoint(this.Popup.Location), Telerik.WinControls.NativeMethods.DpiType.Effective); this.DpiScaleElement.DpiScaleChanged(monitorDpi); Size size = this.GetPopupSize(); if (this.Popup.LastShowDpiScaleFactor.IsEmpty) { size = TelerikDpiHelper.ScaleSize(size, new SizeF(1f / monitorDpi.Width, 1f / monitorDpi.Height)); } this.popup.Size = size; DesktopAlertManager.Instance.AddAlert(this); this.popup.Show(this.popup.Location); if (!PopupManager.Default.ContainsPopup((IPopupControl)this.popup) || !this.playSound || this.soundToPlay == null) { return; } this.soundToPlay.Play(); }
protected override SizeF MeasureOverride(SizeF availableSize) { if (this.imageEditorElement != null && this.imageEditorElement.CurrentBitmap != null) { return((SizeF)TelerikDpiHelper.ScaleSize(this.imageEditorElement.CurrentBitmap.Size, this.imageEditorElement.ZoomFactor)); } return(base.MeasureOverride(availableSize)); }
protected override Size GetBackupSize() { SizeF scaleFactor = new SizeF(1f, 1f); if (this.LastShowDpiScaleFactor.IsEmpty) { scaleFactor = new SizeF(1f / this.OwnerElement.DpiScaleFactor.Width, 1f / this.OwnerElement.DpiScaleFactor.Height); } return(TelerikDpiHelper.ScaleSize(this.Size, scaleFactor)); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (TelerikHelper.IsMaterialTheme(this.ThemeName)) { this.ClientSize = TelerikDpiHelper.ScaleSize(new Size(438, 377), this.RootElement.DpiScaleFactor); } else { this.ClientSize = TelerikDpiHelper.ScaleSize(new Size(292, 251), this.RootElement.DpiScaleFactor); } }
private int GetBottomTopLocation(RadDesktopAlert alert) { Size size = alert.Popup.NonAnimatedSize; if (alert.Popup.LastShowDpiScaleFactor.IsEmpty) { size = TelerikDpiHelper.ScaleSize(size, alert.DpiScaleElement.DpiScaleFactor); } int initialOffset = this.activeScreen.WorkingArea.Height - size.Height + this.activeScreen.WorkingArea.Y; this.EvaluateAlertOffset(alert, ref initialOffset, false); return(initialOffset); }
protected override SizeF MeasureOverride(SizeF availableSize) { SizeF sizeF1 = base.MeasureOverride(availableSize); if (this.Data == null) { return(sizeF1); } this.MainMessageElement.Measure((SizeF)TelerikDpiHelper.ScaleSize(((MediaMessageDataItem)this.Data).MediaMessage.Size, this.DpiScaleFactor)); SizeF sizeF2 = new SizeF(this.AvatarPictureElement.DesiredSize.Width + this.MainMessageElement.DesiredSize.Width + (float)this.Margin.Horizontal, Math.Max(this.AvatarPictureElement.DesiredSize.Height, this.MainMessageElement.DesiredSize.Height) + this.NameLabelElement.DesiredSize.Height + (float)this.Margin.Vertical); this.Data.ActualSize = sizeF2; return(sizeF2); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (TelerikHelper.IsMaterialTheme(this.ThemeName)) { this.ClientSize = TelerikDpiHelper.ScaleSize(new Size(438, 684), this.RootElement.DpiScaleFactor); } else { this.ClientSize = TelerikDpiHelper.ScaleSize(new Size(292, 456), this.RootElement.DpiScaleFactor); } this.radSpinEditorHorizontalPosition.Maximum = (Decimal)this.ImageEditorElement.CurrentBitmap.Width; this.radSpinEditorVerticalPosition.Maximum = (Decimal)this.ImageEditorElement.CurrentBitmap.Height; this.radTrackBarHorizontalPosition.LargeTickFrequency = this.ImageEditorElement.CurrentBitmap.Width; this.radTrackBarVerticalPosition.LargeTickFrequency = this.ImageEditorElement.CurrentBitmap.Height; this.radTrackBarHorizontalPosition.Maximum = (float)this.ImageEditorElement.CurrentBitmap.Width; this.radTrackBarVerticalPosition.Maximum = (float)this.ImageEditorElement.CurrentBitmap.Height; }
private void MeasureWithFillPanel() { int availableLength = this.layoutInfo.availableLength; int num1 = 0; int count = this.layoutInfo.layoutTargets.Count; for (int index = 0; index < count; ++index) { SplitPanel layoutTarget = this.layoutInfo.layoutTargets[index]; if (layoutTarget != this.layoutInfo.fillPanel) { num1 += this.GetLength(layoutTarget.SizeInfo.AbsoluteSize); } } SplitPanelSizeInfo sizeInfo = this.layoutInfo.fillPanel.SizeInfo; int num2 = this.layoutInfo.availableLength - this.layoutInfo.totalSplitterLength; int num3 = 0; int minLength = sizeInfo.minLength; if (num1 + minLength > num2) { num3 = num1 + minLength - num2; } int num4 = num3; for (int index = 0; index < this.layoutInfo.layoutTargets.Count; ++index) { SplitPanel layoutTarget = this.layoutInfo.layoutTargets[index]; if (layoutTarget != this.layoutInfo.fillPanel) { int length = this.GetLength(TelerikDpiHelper.ScaleSize(layoutTarget.SizeInfo.AbsoluteSize, new SizeF(1f / layoutTarget.SplitPanelElement.DpiScaleFactor.Width, 1f / layoutTarget.SplitPanelElement.DpiScaleFactor.Height))); if (num4 > 0 && layoutTarget.SizeInfo.SizeMode != SplitPanelSizeMode.Absolute) { int num5 = Math.Max(1, (int)((double)((float)length / (float)num1) * (double)num3)); num4 -= num5; length -= num5; } layoutTarget.SizeInfo.MeasuredLength = length; availableLength -= layoutTarget.SizeInfo.MeasuredLength + this.layoutInfo.splitterLength; } } this.layoutInfo.fillPanel.SizeInfo.MeasuredLength = availableLength; }
protected override void OnThemeChanged() { base.OnThemeChanged(); RadDateTimePickerCalendar currentBehavior = this.dateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar; if (currentBehavior == null) { return; } currentBehavior.Calendar.ThemeName = this.ThemeName; currentBehavior.PopupControl.ThemeName = this.ThemeName; if (currentBehavior.ShowTimePicker && currentBehavior.TimePicker != null) { currentBehavior.TimePicker.ThemeName = this.ThemeName; if (currentBehavior.ShowFooter) { currentBehavior.FooterPanel.ThemeName = this.ThemeName; } } if (!TelerikHelper.IsMaterialTheme(this.ThemeName)) { return; } Size size = TelerikDpiHelper.ScaleSize(new Size(300, 390), this.RootElement.DpiScaleFactor); if (this.dateTimePickerElement.ShowTimePicker) { currentBehavior.Calendar.MinimumSize = TelerikDpiHelper.ScaleSize(new Size(300, 0), this.RootElement.DpiScaleFactor); size.Width = 590; } currentBehavior.DropDownMinSize = size; RadCalendarElement calendarElement = currentBehavior.Calendar.CalendarElement; calendarElement.DrawBorder = true; calendarElement.BorderBoxStyle = BorderBoxStyle.FourBorders; calendarElement.BorderGradientStyle = GradientStyles.Solid; calendarElement.BorderBottomColor = calendarElement.BorderBottomShadowColor = calendarElement.BorderRightColor = calendarElement.BorderRightShadowColor = calendarElement.BorderLeftShadowColor = calendarElement.BorderTopShadowColor = Color.Transparent; calendarElement.BorderLeftColor = calendarElement.BorderTopColor = Color.FromArgb(236, 236, 236); }
protected virtual Size GetPopupSize() { Size defaultSize = RadDesktopAlert.DefaultSize; SizeF scaleFactor = RadControl.EnableDpiScaling ? Telerik.WinControls.NativeMethods.GetMonitorDpi(Screen.FromPoint(this.Popup.Location), Telerik.WinControls.NativeMethods.DpiType.Effective) : new SizeF(1f, 1f); if (this.fixedSize != Size.Empty) { if (this.FixedSize.Width == 0 || (this.FixedSize.Height != 0 || !this.AutoSize)) { return(TelerikDpiHelper.ScaleSize(this.fixedSize, scaleFactor)); } defaultSize.Width = this.FixedSize.Width; } Size desiredSize = new Size(defaultSize.Width, defaultSize.Height); this.popup.Size = desiredSize; this.popup.LoadElementTree(desiredSize); SizeF sizeF = new SizeF((float)defaultSize.Width, this.popup.AlertElement.DesiredSize.Height); sizeF = TelerikDpiHelper.ScaleSizeF(sizeF, scaleFactor); return(sizeF.ToSize()); }
protected override Size GetPopupSize(RadPopupControlBase popup, bool measure) { Size size = this.defaultPopupSize; if (this.popup != null && popup.Controls.Count > 0) { if (this.DropDownSizingMode == SizingMode.None) { size = new Size(popup.Controls[0].Size.Width, popup.Controls[0].Size.Height); } else { int height = this.popup.SizingGrip.MinSize.Height; size = new Size(popup.Controls[0].Size.Width, popup.Controls[0].Size.Height + height); } } SizeF scaleFactor = new SizeF(1f, 1f); if (this.popup.LastShowDpiScaleFactor != this.DpiScaleFactor) { scaleFactor = new SizeF(this.DpiScaleFactor.Width / this.popup.LastShowDpiScaleFactor.Width, this.DpiScaleFactor.Height / this.popup.LastShowDpiScaleFactor.Height); } return(TelerikDpiHelper.ScaleSize(size, scaleFactor)); }
protected virtual Rectangle GetImageDrawRectangle() { Size size = TelerikDpiHelper.ScaleSize(this.imageEditorElement.CurrentBitmap.Size, this.imageEditorElement.ZoomFactor); return(new Rectangle(this.Size.Width > size.Width ? (this.Size.Width - size.Width) / 2 : 0, this.Size.Height > size.Height ? (this.Size.Height - size.Height) / 2 : 0, size.Width, size.Height)); }
protected override SizeF MeasureOverride(SizeF availableSize) { base.MeasureOverride(availableSize); SizeF empty = SizeF.Empty; return(SizeF.Add(this.Direction == ArrowDirection.Left || this.Direction == ArrowDirection.Right ? (SizeF)TelerikDpiHelper.ScaleSize(ArrowPrimitive.MinHorizontalSize, this.DpiScaleFactor) : (SizeF)TelerikDpiHelper.ScaleSize(ArrowPrimitive.MinVerticalSize, this.DpiScaleFactor), (SizeF)this.Padding.Size)); }