public PopupWindow(ColorPopup content) { if (content == null) { throw new ArgumentNullException("content"); } this.content = content; this.AutoSize = false; this.DoubleBuffered = true; this.ResizeRedraw = true; //create a host that will host the content host = new ToolStripControlHost(content); this.Padding = Margin = host.Padding = host.Margin = Padding.Empty; this.MinimumSize = content.MinimumSize; content.MinimumSize = content.Size; MaximumSize = new Size(content.Size.Width + 1, content.Size.Height + 1); content.MaximumSize = new Size(content.Size.Width + 1, content.Size.Height + 1); Size = new Size(content.Size.Width + 1, content.Size.Height + 1); content.Location = Point.Empty; //add the host to the list Items.Add(host); }
/// <summary> /// RGB button picker /// </summary> /// <param name="sender">The sender<see cref="object"/></param> /// <param name="e">The e<see cref="EventArgs"/></param> private async void btnRGBColorPicker_Tapped(object sender, EventArgs e) { var oButton = (TintedCachedImage)sender; var oDevice = (Models.Device)oButton.BindingContext; var oColorPicker = new ColorPopup(oDevice, _viewModel.RefreshFavoriteCommand); await PopupNavigation.Instance.PushAsync(oColorPicker); RefreshListView(true); }
private void btnTextColor_Click(object sender, EventArgs e) { if (CurrentCondition == null) { return; } ColorPopup popup = new ColorPopup(this); if (CurrentCondition.TextFill is SolidFill) { popup.Color = (CurrentCondition.TextFill as SolidFill).Color; } popup.ColorSelected += new EventHandler(popup_ColorSelected); popup.Show(btnTextColor, 0, btnTextColor.Height); }
public static void Init(CE_WSB_Dialogue _ce, SerializedProperty _text, int _index) { if (popup) { popup.Close(); } property = _text; index = _index; ce = _ce; popup = ScriptableObject.CreateInstance <ColorPopup>(); Vector2 _pos = GUIUtility.GUIToScreenPoint(Event.current.mousePosition); popup.position = new Rect(_pos.x, _pos.y, 100, 75); popup.ShowPopup(); }
void RichTextButtons(SerializedProperty _text, int _index) { EditorGUILayout.BeginHorizontal(); lastTextSelected = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); // Adds <b> and </b> with the selected text between if (GUILayout.Button("Bold")) { if (!string.IsNullOrEmpty(lastTextSelected.text) && lastTextSelected.hasSelection) { lastTextSelected.ReplaceSelection($"<b>{lastTextSelected.SelectedText}</b>"); _text.GetArrayElementAtIndex(_index).stringValue = lastTextSelected.text; } } // Adds <u> and </u> with the selected text between if (GUILayout.Button("Underline")) { if (!string.IsNullOrEmpty(lastTextSelected.text) && lastTextSelected.hasSelection) { lastTextSelected.ReplaceSelection($"<u>{lastTextSelected.SelectedText}</u>"); _text.GetArrayElementAtIndex(_index).stringValue = lastTextSelected.text; } } // Adds <i> and </i> with the selected text between if (GUILayout.Button("Italic")) { if (!string.IsNullOrEmpty(lastTextSelected.text) && lastTextSelected.hasSelection) { lastTextSelected.ReplaceSelection($"<i>{lastTextSelected.SelectedText}</i>"); _text.GetArrayElementAtIndex(_index).stringValue = lastTextSelected.text; } } if (GUILayout.Button("Color")) { ColorPopup.Init(this, _text, _index); } if (GUILayout.Button("Size")) { SizePopup.Init(this, _text, _index); } EditorGUILayout.EndHorizontal(); }
/// <summary> /// 初始化加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_Load(object sender, EventArgs e) { //Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); //string key = config.AppSettings.Settings["ColorIndex"].Value; string sPath = Application.StartupPath + "\\IniFile"; if (!Directory.Exists(sPath)) { Directory.CreateDirectory(sPath); } string key = settingFile.ReadString("SETTING", "ColorIndex", "0"); Change_ColorScheme(int.Parse(key)); _popControl = new ColorPopup(this); _pop = new Popup(_popControl); this.comPanel3.Configer.Init_ConfigCom(); this.wolPanel1.Load_Inifile(); naviBar1.Collapsed = true; AnimateWindow(this.Handle, 800, AW_SLIDE + AW_CENTER); }
private void CreateColorPopup(PopupControlContainer container) { //CHAUTV : Bị lỗi tại phương thức này nên đã thiết kế lớp ColorPopup mới cp = new ProtocolVN.Framework.Win.Trial.ColorPopup(container, iFontColor, this); }