private void UpdateScreenTipSizeAndShape(IScreenTipContent content) { RadScreenTipElement element = (RadScreenTipElement)content; if (element.TipSize != Size.Empty) { element.MinSize = element.TipSize; element.MaxSize = new Size(element.TipSize.Width, element.MaxSize.Height); } this.radScreenTipControl1.Size = Screen.FromPoint(Control.MousePosition).WorkingArea.Size; this.radScreenTipControl1.SetScreenTipElement(element); this.radScreenTipControl1.LoadElementTree(); this.radScreenTipControl1.RootElement.InvalidateMeasure(true); this.radScreenTipControl1.RootElement.UpdateLayout(); this.radScreenTipControl1.Size = this.radScreenTipControl1.RootElement.DesiredSize.ToSize(); this.Size = this.radScreenTipControl1.Size; if (this.radScreenTipControl1.RootElement.Shape == null) { return; } if (this.Region != null) { this.Region.Dispose(); } using (GraphicsPath path = this.radScreenTipControl1.RootElement.Shape.CreatePath(this.DisplayRectangle)) this.Region = new Region(path); }
private void templateBox_SelectedIndexChanged(object sender, EventArgs e) { //System.Diagnostics.Debug.WriteLine("SelectedIndexChanged: " + this.templateBox.SelectedIndex.ToString()); if (!this.updateCurrentValue) { return; } //by fdc,his.templateBox.SelectedItem => this.templateBox.SelectedItem.GetType() if (this.currentValue != null && this.templateBox.SelectedItem.GetType() == this.currentValue.GetType()) { return; } this.currentValue = null; if (this.templateBox.SelectedIndex != 0) { //this.currentValue = Activator.CreateInstance((this.templateBox.SelectedItem as TypeItem).TemplateType) as IScreenTipContent;// as RadScreenTipElement if (this.originalValue != null) { this.host.DestroyComponent(this.originalValue as IComponent); } this.currentValue = this.host.CreateComponent(this.templateBox.SelectedItem as Type) as IScreenTipContent; // as RadScreenTipElement if (this.currentValue is Control) { IScreenTipContent tempValue = (this.currentValue as RadScreenTip).ScreenTipElement; tempValue.TemplateType = (this.currentValue as RadScreenTip).TemplateType; this.currentValue = tempValue; } //this.persistChange = true; this.updateCurrentValue = true; //this.stylableElements.Items.Clear(); PopulateElementsBox(this.currentValue.TipItems); } }
private void templateBox_SelectedIndexChanged(object sender, EventArgs e) { if (!this.updateCurrentValue || this.currentValue != null && (object)(System.Type) this.templateBox.SelectedItem == (object)this.currentValue.GetType()) { return; } this.currentValue = (IScreenTipContent)null; if (this.templateBox.SelectedIndex == 0) { return; } if (this.originalValue != null) { this.host.DestroyComponent(this.originalValue as IComponent); } this.currentValue = this.host.CreateComponent(this.templateBox.SelectedItem as System.Type) as IScreenTipContent; if (this.currentValue is Control) { IScreenTipContent screenTipElement = (IScreenTipContent)(this.currentValue as RadScreenTip).ScreenTipElement; screenTipElement.TemplateType = (this.currentValue as RadScreenTip).TemplateType; this.currentValue = screenTipElement; } this.updateCurrentValue = true; this.PopulateElementsBox(this.currentValue.TipItems); }
private void UpdateScreenTipSizeAndShape(IScreenTipContent content) { RadScreenTipElement screenTipElement = (RadScreenTipElement)content; if (screenTipElement.TipSize != Size.Empty) { screenTipElement.MinSize = screenTipElement.TipSize; screenTipElement.MaxSize = new Size(screenTipElement.TipSize.Width, screenTipElement.MaxSize.Height); } Point currentMousePosition = Control.MousePosition; Screen currentScreen = Screen.FromPoint(currentMousePosition); this.radScreenTipControl1.Size = currentScreen.WorkingArea.Size; this.radScreenTipControl1.SetScreenTipElement(screenTipElement); this.radScreenTipControl1.LoadElementTree(); this.radScreenTipControl1.RootElement.InvalidateMeasure(true); this.radScreenTipControl1.RootElement.UpdateLayout(); this.radScreenTipControl1.Size = radScreenTipControl1.RootElement.DesiredSize.ToSize(); this.Size = this.radScreenTipControl1.Size; if (this.radScreenTipControl1.RootElement.Shape != null) { if (this.Region != null) { this.Region.Dispose(); } using (GraphicsPath path = this.radScreenTipControl1.RootElement.Shape.CreatePath(this.DisplayRectangle)) { this.Region = new Region(path); } } }
public void End() { this.typeSvc = (ITypeDiscoveryService)null; this.host = (IDesignerHost)null; this.editor = (ScreenTipEditor)null; this.edSvc = (IWindowsFormsEditorService)null; this.originalValue = (object)null; this.currentValue = (IScreenTipContent)null; }
public void End() { this.typeSvc = null; this.host = null; this.editor = null; this.edSvc = null; this.originalValue = null; this.currentValue = null; //this.chordConverter = null; }
public void Show(IScreenTipContent content, Point pivotPoint, int delay) { if (pivotPoint.IsEmpty || content == null) { return; } if (delay >= 0) { this.showDelay = delay; } this.pivotPoint = pivotPoint; this.UpdateScreenTipSizeAndShape(content); this.UpdateScreenTipState(); }
public void Initialize(IWindowsFormsEditorService edSvc, ITypeDiscoveryService typeSvc, IDesignerHost host, IComponentChangeService changeSvc, object value) { this.host = host; this.edSvc = edSvc; this.typeSvc = typeSvc; this.changeSvc = changeSvc; this.currentValue = value as IScreenTipContent; this.originalValue = value; this.updateCurrentValue = false; if (templates == null) { templates = this.typeSvc.GetTypes(typeof(IScreenTipContent), false); if (templates == null) { return; } foreach (Type type in templates) { if (type.IsAbstract || type.IsInterface || type.IsAbstract || !type.IsPublic || this.templateBox.Items.Contains(type) || !type.IsVisible || typeof(Control).IsAssignableFrom(type)) { continue; } this.templateBox.Items.Add(type); } } if (this.currentValue != null) { Type templateType = (value as IScreenTipContent).TemplateType; int typeIndex = templateType != null?this.templateBox.Items.IndexOf(templateType) : -1; if (typeIndex > -1) { this.templateBox.SelectedItem = this.templateBox.Items[typeIndex]; } PopulateElementsBox(this.currentValue.TipItems); } this.updateCurrentValue = true; }
private void button2_Click(object sender, EventArgs e) { this.currentValue = (IScreenTipContent)null; this.EditorService.CloseDropDown(); }