public ChoiceField(RectangleF frame, ShareViewController controller, string title) : base(frame, controller, title) { ValueLabel = new LabelButton() { BackgroundColor = UIColor.Clear, Font = TextEditorFont, TextColor = UIColor.DarkTextColor, TextAlignment = UITextAlignment.Right, AutoresizingMask = UIViewAutoresizing.FlexibleWidth, }; var tf = TitleLabel.Frame; #if !__UNIFIED__ ValueLabel.Frame = new RectangleF(tf.Right, 0, frame.Width - tf.Right, frame.Height - 1); #else // ValueLabel.Frame = new RectangleF ((float)tf.Right, 0, (float)((nfloat)frame.Width - tf.Right), (float)(frame.Height - 1)); ValueLabel.Frame = new RectangleF(0, 0, (float)((nfloat)frame.Width - tf.Left), (float)(frame.Height - 1)); #endif ValueLabel.TouchUpInside += HandleTouchUpInside; AddSubview(ValueLabel); Picker = new CheckedPickerView(new RectangleF(0, 0, 320, 216)); Picker.Hidden = true; Picker.SelectedItemChanged += delegate { ValueLabel.Text = Picker.SelectedItem; }; controller.View.AddSubview(Picker); ValueLabel.Text = Picker.SelectedItem; }
public void UpdateListing() { Children.Clear(); buttons.Clear(); int y = 0; foreach (var e in model.Undo.Skip(scroll.index).Take(Height - y)) { var b = new LabelButton($"<{e.Name}", () => UndoTo(e)) { Position = new Point(0, y) }; Children.Add(b); buttons.Add(b); y++; } foreach (var e in model.Redo.Reverse().Skip(scroll.index - model.Undo.Count()).Take(Height - y)) { var b = new LabelButton($">{e.Name}", () => RedoTo(e)) { Position = new Point(0, y) }; Children.Add(b); buttons.Add(b); y++; } }
private void AddControlBox(WindowButtons button) { if (windowButtonList == null) { windowButtonList = new Dictionary <WindowButtons, Label>(); } if (windowButtonList.ContainsKey(button)) { return; } LabelButton newButton = new LabelButton(); if (button == WindowButtons.Close) { newButton.Text = "r"; newButton.Name = "btnClose"; newButton.FlatAppearance.MouseOverBackColor = Color.Red; newButton.FlatAppearance.MouseDownBackColor = Color.OrangeRed; btnClose = newButton; } else if (button == WindowButtons.Minimize) { newButton.Text = "0"; newButton.Name = "btnMin"; btnMin = newButton; } else if (button == WindowButtons.Maximize) { newButton.Name = "btnMax"; if (WindowState == FormWindowState.Normal) { newButton.Text = "1"; } else { newButton.Text = "2"; } btnMax = newButton; } newButton.Tag = button; newButton.AutoSize = false; newButton.Size = new Size(30, 25); newButton.Font = new Font("Webdings", 9.25f); newButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; newButton.TextAlign = ContentAlignment.MiddleCenter; newButton.BackColor = ControlBoxBackColor; newButton.ForeColor = ControlBoxForeColor; newButton.TabStop = false; newButton.Click += new EventHandler(ControlBox_Click); Controls.Add(newButton); windowButtonList.Add(button, newButton); }
public static void SetReverseStyles(this LabelButton retButton) { retButton.DeselectedLabelStyle = LabelButton.CreateLabelStyle(Color.Black, NORMAL_BUTTON_FONT_SIZE, FontAttributes.None); retButton.SelectedLabelStyle = LabelButton.CreateLabelStyle(Color.White, SELECTED_BUTTON_FONT_SIZE, FontAttributes.Bold); retButton.DisabledLabelStyle = LabelButton.CreateLabelStyle(Color.Gray, NORMAL_BUTTON_FONT_SIZE, FontAttributes.None); retButton.DeselectedButtonStyle = LabelButton.CreateViewButtonStyle(Color.Transparent); retButton.SelectedButtonStyle = LabelButton.CreateViewButtonStyle(Color.Black); retButton.DisabledButtonStyle = LabelButton.CreateViewButtonStyle(Color.Transparent); }
private void MenuClickHandler(LabelButton btn) { if (btn == selectedMenu) { return; } highImage.gameObject.SetActive(true); jumpButton.gameObject.SetActive(false); if (selectedMenu != null) { highImage.DOAnchorPos(btn.mRectTransform.anchoredPosition, 0.3f).OnComplete(() => { jumpButton.gameObject.SetActive(true); }); } else { highImage.anchoredPosition = btn.mRectTransform.anchoredPosition; jumpButton.gameObject.SetActive(true); } selectedMenu = btn; }
// Called when the node enters the scene tree for the first time. public override void _Ready() { Global.HUD = this; Global.PreviousHighScore = Global.SaveFile.Score; PauseMode = PauseModeEnum.Process; _scoreText = FindNode("ScoreText") as Label; _healthText = FindNode("HealthText") as Label; _highScoreText = FindNode("HighScoreText") as Label; _muteButton = FindNode("MuteButton") as LabelButton; _highScoreText.Text = Global.PreviousHighScore.ToString(); _scoreText.Visible = false; _healthText.Visible = false; _highScoreText.Visible = false; if (Global.SaveFile.PlaySounds == true) { _muteButton.Text = _muteButton.BaseText = "MUTE"; } else { _muteButton.Text = _muteButton.BaseText = "UNMUTE"; } }
public override void UpdateInfo(BookModel.PageInfo info) { selectedMenu = null; this.identify = info.uid; var list = info.menus; for (int i = 0; i < menus.Count; i += 1) { if (i < list.Count) { menus[i].Show(); menus[i].identify = "index-" + i; menus[i].UpdateLabel(list[i].name, list[i].page + ""); menus[i].AddClickListener(MenuClickHandler); } else { menus[i].Hide(); menus[i].AddClickListener(null); } if (i == 0) { //selectedMenu = menus[i]; highImage.anchoredPosition = menus[i].mRectTransform.anchoredPosition; } } //if (info.page % 2 == 0) //{ // jumpButton.rectTransform().anchoredPosition = new Vector2(301, 0); //} //else //{ // jumpButton.rectTransform().anchoredPosition = new Vector2(-301, 0); //} highImage.gameObject.SetActive(false); jumpButton.gameObject.SetActive(false); }
public override T Create <T>() { T control = null; if (typeof(T) == typeof(IAutocomplete)) { //result = new Autocomplete() as T; } else if (typeof(T) == typeof(IButton)) { control = new Button() as T; } else if (typeof(T) == typeof(ICalendar)) { control = new Calendar() as T; } else if (typeof(T) == typeof(ICheckBox)) { control = new CheckBox() as T; } else if (typeof(T) == typeof(IHyperLink)) { control = new HyperLink() as T; } else if (typeof(T) == typeof(IImage)) { control = new Image() as T; } else if (typeof(T) == typeof(IImageButton)) { control = new ImageButton() as T; } else if (typeof(T) == typeof(ILabel)) { control = new Label() as T; } else if (typeof(T) == typeof(ILabelButton)) { control = new LabelButton() as T; } else if (typeof(T) == typeof(IListPicker)) { control = new ListPicker() as T; } else if (typeof(T) == typeof(IPasswordTextBox)) { control = new PasswordTextBox() as T; } else if (typeof(T) == typeof(ITextArea)) { control = new TextArea() as T; } else if (typeof(T) == typeof(ITextBox)) { control = new TextBox() as T; } else if (typeof(T) == typeof(IGrid)) { control = new Grid() as T; } else if (typeof(T) == typeof(IStack)) { control = new Stack() as T; } return(control); }
public ChoiceField (RectangleF frame, ShareViewController controller, string title) : base (frame, controller, title) { ValueLabel = new LabelButton () { BackgroundColor = UIColor.White, Font = TextEditorFont, TextColor = UIColor.DarkTextColor, AutoresizingMask = UIViewAutoresizing.FlexibleWidth, }; var tf = TitleLabel.Frame; ValueLabel.Frame = new RectangleF (tf.Right, 0, frame.Width - tf.Right, frame.Height - 1); ValueLabel.TouchUpInside += HandleTouchUpInside; AddSubview (ValueLabel); Picker = new CheckedPickerView (new RectangleF (0, 0, 320, 216)); Picker.Hidden = true; Picker.SelectedItemChanged += delegate { ValueLabel.Text = Picker.SelectedItem; }; controller.View.AddSubview (Picker); ValueLabel.Text = Picker.SelectedItem; }
public void UpdateListing(string filepath) { folderListing.ForEach(b => this.Children.Remove(b)); folderListing.Clear(); int i = 2; if (string.IsNullOrWhiteSpace(filepath)) { filepath = Environment.CurrentDirectory; } else { filepath = Path.GetFullPath(filepath); } if (Directory.Exists(filepath)) { i++; var b = new LabelButton("..", () => textbox.text = Directory.GetParent(filepath).FullName) { Position = new Point(folderListingX, i), }; folderListing.Add(b); ShowDirectories(Directory.GetDirectories(filepath).Where(p => p.StartsWith(filepath))); ShowFiles(Directory.GetFiles(filepath).Where(p => p.StartsWith(filepath))); } else { var parent = Directory.GetParent(filepath)?.FullName; if (Directory.Exists(parent)) { i++; var b = new LabelButton("..", () => textbox.text = parent) { Position = new Point(folderListingX, i), }; folderListing.Add(b); ShowDirectories(Directory.GetDirectories(parent).Where(p => p.StartsWith(filepath))); ShowFiles(Directory.GetFiles(parent).Where(p => p.StartsWith(filepath))); } } foreach (var button in folderListing.Take(64)) { Children.Add(button); } void ShowDirectories(IEnumerable <string> directories) { foreach (var directory in directories) { i++; var b = new LabelButton(Path.GetFileName(directory) + "\\", () => { textbox.text = directory + "\\"; textbox.index = textbox.text.Length; }) { Position = new Point(folderListingX, i), }; folderListing.Add(b); } } void ShowFiles(IEnumerable <string> files) { foreach (var file in files) { i++; var b = new LabelButton(Path.GetFileName(file), Load) { Position = new Point(folderListingX, i), }; b.MouseEnter += (e, args) => { ShowPreview(file); }; folderListing.Add(b); void Load() { EnterFile(file); } } } }
public FileMenu(int width, int height, FileMode mode) : base(width, height) { DefaultBackground = Color.Black; this.recentFiles = File.Exists(RECENTFILES) ? ASECIILoader.DeserializeObject <HashSet <string> >(File.ReadAllText(RECENTFILES)).Where(f => File.Exists(f)).ToHashSet() : new HashSet <string>(); this.preloaded = new Dictionary <string, ILoadResult>(); this.recentListing = new List <LabelButton>(); int n = 3; if (recentFiles.Any()) { folderListingX = 32; foreach (var f in recentFiles) { var p = Path.GetFileName(f); var b = new LabelButton(p, Load, () => textbox.text = f) { Position = new Point(4, n), }; b.MouseEnter += (e, args) => { ShowPreview(f); }; this.Children.Add(b); recentListing.Add(b); n++; void Load() { mode.Enter(this, f); //AddRecentFile(f); } } } else { folderListingX = 8; } this.mode = mode; UseMouse = true; UseKeyboard = true; IsFocused = true; FocusOnMouseClick = true; folderListing = new List <LabelButton>(); textbox = new TextField(width - folderListingX) { Position = new Point(folderListingX, 1), UseKeyboard = true, UseMouse = true, IsFocused = true, text = mode.InitialPath, }; textbox.TextChanged += tf => UpdateListing(textbox.text); textbox.EnterPressed += tf => EnterFile(); this.Children.Add(textbox); UpdateListing(textbox.text); }
/// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Win32AddressBar)); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.imageList2 = new System.Windows.Forms.ImageList(this.components); this.foward1 = new System.Windows.Forms.LabelButton(); this.back1 = new System.Windows.Forms.LabelButton(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, "back0.png"); this.imageList1.Images.SetKeyName(1, "BACK1.png"); this.imageList1.Images.SetKeyName(2, "BACK2.png"); this.imageList1.Images.SetKeyName(3, "back3.png"); this.imageList1.Images.SetKeyName(4, "foward0.png"); this.imageList1.Images.SetKeyName(5, "foward1.png"); this.imageList1.Images.SetKeyName(6, "foward2.png"); this.imageList1.Images.SetKeyName(7, "foward3.png"); // // toolTip1 // this.toolTip1.ShowAlways = true; // // pictureBox1 // this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pictureBox1.BackColor = System.Drawing.Color.Transparent; this.pictureBox1.Location = new System.Drawing.Point(58, 2); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(287, 22); this.pictureBox1.TabIndex = 23; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint); // // comboBox1 // this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.comboBox1.BackColor = System.Drawing.Color.White; this.comboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.comboBox1.FormattingEnabled = true; this.comboBox1.Location = new System.Drawing.Point(57, 1); this.comboBox1.Margin = new System.Windows.Forms.Padding(0); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(304, 24); this.comboBox1.TabIndex = 27; this.comboBox1.TabStop = false; this.comboBox1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.comboBox1_DrawItem); this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedValueChanged); this.comboBox1.Leave += new System.EventHandler(this.comboBox1_Leave); this.comboBox1.MouseLeave += new System.EventHandler(this.comboBox1_Leave); // // label1 // this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.ImageIndex = 0; this.label1.ImageList = this.imageList2; this.label1.Location = new System.Drawing.Point(60, 3); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(22, 20); this.label1.TabIndex = 28; // // imageList2 // this.imageList2.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList2.ImageStream"))); this.imageList2.TransparentColor = System.Drawing.Color.Transparent; this.imageList2.Images.SetKeyName(0, "folder.png"); this.imageList2.Images.SetKeyName(1, "空.png"); this.imageList2.Images.SetKeyName(2, "我的电脑.png"); this.imageList2.Images.SetKeyName(3, "文档.png"); this.imageList2.Images.SetKeyName(4, "桌面1.png"); this.imageList2.Images.SetKeyName(5, "null.ico"); this.imageList2.Images.SetKeyName(6, "回收站.png"); this.imageList2.Images.SetKeyName(7, "txt1.png"); // // foward1 // this.foward1.BackColor = System.Drawing.Color.Transparent; this.foward1.BorderColor = System.Drawing.Color.Transparent; this.foward1.DefautColor = System.Drawing.Color.Transparent; this.foward1.DefautImage = ((System.Drawing.Image)(resources.GetObject("foward1.DefautImage"))); this.foward1.Image = ((System.Drawing.Image)(resources.GetObject("foward1.Image"))); this.foward1.Location = new System.Drawing.Point(29, 1); this.foward1.MouseDownColor = System.Drawing.Color.Transparent; this.foward1.MouseDownImage = ((System.Drawing.Image)(resources.GetObject("foward1.MouseDownImage"))); this.foward1.MouseEnterColor = System.Drawing.Color.Transparent; this.foward1.MouseEnterImage = ((System.Drawing.Image)(resources.GetObject("foward1.MouseEnterImage"))); this.foward1.Name = "foward1"; this.foward1.Size = new System.Drawing.Size(24, 24); this.foward1.TabIndex = 25; this.foward1.EnabledChanged += new System.EventHandler(this.foward1_EnabledChanged); this.foward1.Click += new System.EventHandler(this.向右_Click); this.foward1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.前进_MouseDown); this.foward1.MouseEnter += new System.EventHandler(this.前进_MouseEnter); // // back1 // this.back1.BackColor = System.Drawing.Color.Transparent; this.back1.BorderColor = System.Drawing.Color.Transparent; this.back1.DefautColor = System.Drawing.Color.Transparent; this.back1.DefautImage = ((System.Drawing.Image)(resources.GetObject("back1.DefautImage"))); this.back1.Image = ((System.Drawing.Image)(resources.GetObject("back1.Image"))); this.back1.Location = new System.Drawing.Point(3, 1); this.back1.MouseDownColor = System.Drawing.Color.Transparent; this.back1.MouseDownImage = ((System.Drawing.Image)(resources.GetObject("back1.MouseDownImage"))); this.back1.MouseEnterColor = System.Drawing.Color.Transparent; this.back1.MouseEnterImage = ((System.Drawing.Image)(resources.GetObject("back1.MouseEnterImage"))); this.back1.Name = "back1"; this.back1.Size = new System.Drawing.Size(24, 24); this.back1.TabIndex = 25; this.back1.EnabledChanged += new System.EventHandler(this.back1_EnabledChanged); this.back1.Click += new System.EventHandler(this.向左_Click); this.back1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.返回_MouseDown); this.back1.MouseEnter += new System.EventHandler(this.返回_MouseEnter); // // Win32AddressBar // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label1); this.Controls.Add(this.foward1); this.Controls.Add(this.back1); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.comboBox1); this.DoubleBuffered = true; this.Name = "Win32AddressBar"; this.Size = new System.Drawing.Size(373, 29); this.Resize += new System.EventHandler(this.Win32AddressBar_Resize); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); }
public override T Create <T>() { T control = null; if (typeof(T) == typeof(IAutocomplete)) { control = new Autocomplete() as T; } else if (typeof(T) == typeof(IButton)) { control = new Button() as T; } else if (typeof(T) == typeof(ICalendar)) { control = new Calendar() as T; } else if (typeof(T) == typeof(ICheckBox)) { control = new CheckBox() as T; } else if (typeof(T) == typeof(IHyperLink)) { control = new HyperLink() as T; } else if (typeof(T) == typeof(IImage)) { control = new Image() as T; } else if (typeof(T) == typeof(IImageButton)) { control = new ImageButton() as T; } else if (typeof(T) == typeof(ILabel)) { control = new Label() as T; } else if (typeof(T) == typeof(ILabelButton)) { control = new LabelButton() as T; } else if (typeof(T) == typeof(IListPicker)) { control = new ListPicker() as T; } else if (typeof(T) == typeof(IPasswordTextBox)) { control = new PasswordTextBox() as T; } else if (typeof(T) == typeof(ITextArea)) { control = new TextArea() as T; } else if (typeof(T) == typeof(ITextBox)) { control = new TextBox() as T; } else if (typeof(T) == typeof(IGrid)) { control = new Grid() as T; } else if (typeof(T) == typeof(IStack)) { control = new Stack() as T; } //give a default name to all controls to allow events to be correclty triggered control.Name = "ctr_" + Random.Next(); return(control); }