public AtmButtonControl(AtmButton atmButton) { InitializeComponent(); ButtonText0 = atmButton.Text0; ButtonText1 = atmButton.Text1; ButtonText2 = atmButton.Text2; ButtonText3 = atmButton.Text3; Text0Color = atmButton.Text0Color.ToString() != "#00000000" ? atmButton.Text0Color : Colors.White; Text1Color = atmButton.Text1Color.ToString() != "#00000000" ? atmButton.Text1Color : Colors.White; Text2Color = atmButton.Text2Color.ToString() != "#00000000" ? atmButton.Text2Color : Colors.White; Text3Color = atmButton.Text3Color.ToString() != "#00000000" ? atmButton.Text3Color : Colors.White; MainText.Text = atmButton.MainText; ImagePath = atmButton.ImagePath; Name = atmButton.Name + DateTime.Now.Ticks; ButtonImage.SetValue(NameProperty, Name); MainText.SetValue(NameProperty, Name); Text0.SetValue(NameProperty, Name); Text1.SetValue(NameProperty, Name); Text2.SetValue(NameProperty, Name); Text3.SetValue(NameProperty, Name); IsRightButton = atmButton.IsRightButton; if (IsRightButton) { ButtonGrid.HorizontalAlignment = HorizontalAlignment.Right; } }
public Footer_Button() { InitializeComponent(); LineSelector.SetBinding(BoxView.ColorProperty, new Binding(nameof(LineSelectorColor), source: this)); ButtonImage.SetBinding(Image.SourceProperty, new Binding(nameof(ButtonImageSource), source: this)); }
protected void Initialize() { Flex.SetBinding(FlexLayout.DirectionProperty, new Binding(nameof(Direction), source: this)); ButtonImage.SetBinding(Image.SourceProperty, new Binding(nameof(ImageSource), source: this)); ButtonLabel.SetBinding(Label.FontSizeProperty, new Binding(nameof(FontSize), source: this)); ButtonLabel.SetBinding(Label.FontFamilyProperty, new Binding(nameof(FontFamily), source: this)); ButtonLabel.SetBinding(Label.FontAttributesProperty, new Binding(nameof(FontAttributes), source: this)); ButtonLabel.SetBinding(Label.TextProperty, new Binding(nameof(Text), source: this)); ButtonLabel.SetBinding(Label.TextColorProperty, new Binding(nameof(TextColor), source: this)); ButtonLabel.SetBinding(Label.VerticalTextAlignmentProperty, new Binding(nameof(VerticalTextAlignment), source: this)); ButtonLabel.SetBinding(Label.HorizontalTextAlignmentProperty, new Binding(nameof(HorizontalTextAlignment), source: this)); this.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => { this.Tapped?.Invoke(this, EventArgs.Empty); if (Command != null) { if (Command.CanExecute(CommandParameter)) { Command.Execute(CommandParameter); } } }), }); }
private void oGrid_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.Cells[6].Controls.Count >0) { ButtonImage ct=( (ButtonImage) e.Item.Cells[6].Controls[1]); ct.NavigateUrl ="..\\Users\\UsersMaintenance.aspx?ProcessIDForUsers=" +((DataRowView) e.Item.DataItem)[0].ToString(); } }
protected override void Awake() { AudioSource = gameObject.AddComponent <AudioSource>(); ButtonText = CreateGameObject.CreateChildGameObject <ControlText>(transform).GetComponent <ControlText>(); gameObject.AddComponent <CanvasRenderer>(); ButtonImage = gameObject.AddComponent <CustomImage>(); ButtonImage.Initialize(Resources.Load <Sprite>("UI/Skin/background"), UnityEngine.UI.Image.Type.Sliced); RectTransform = GetComponent <RectTransform>(); }
public void LoadButtons(string actionGroup) { mLoadButtonFromResources(actionGroup); foreach (UIDisplayActionData action in actions) { ButtonImage button = ObjectPool.Instance.GetObject("ButtonImage").GetComponent <ButtonImage>(); button.actionData = action; button.transform.SetParent(buttonContent); } }
private void Initialize() { var inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService); var layout = inflater.Inflate(Resource.Layout.Control_AppBarButton, this, true); ButtonImage = (ImageView)layout.FindViewById(Resource.Id.buttonImage); ButtonImage.SetBackgroundResource(_imgId); ButtonLabel = (TextView)layout.FindViewById(Resource.Id.buttonLabel); ButtonLabel.Text = _labelText; }
/// <summary> /// Call this within SpirteBatch Begin()/End() blocks to draw that button centred at x,y /// </summary> /// <param name="spriteBatch">Sprite batch to use</param> /// <param name="button">ButtonImage enum button to draw</param> /// <param name="pos">position within the current viewport</param> /// <param name="scale">float scale to draw the text. 1 is 'normal' sized but 0.5f is often better.</param> public static void DrawButton(SpriteBatch spriteBatch, ButtonImage button, Vector2 pos,float scale) { String s=""; switch (button) { case ButtonImage.LeftThumbStick: s=" "; break; case ButtonImage.DPad: s="!"; break; case ButtonImage.RightThumbStick: s="\""; break; case ButtonImage.Back: s="#"; break; case ButtonImage.Guide: s="$"; break; case ButtonImage.Start: s="%"; break; case ButtonImage.X: s="&"; break; case ButtonImage.A: s="'"; break; case ButtonImage.Y: s="("; break; case ButtonImage.B: s=")"; break; case ButtonImage.RightBumper: s="*"; break; case ButtonImage.RightTrigger: s="+"; break; case ButtonImage.LeftTrigger: s=","; break; case ButtonImage.LeftBumper: s="-"; break; } Vector2 origin = buttons.MeasureString(s) / 2; spriteBatch.DrawString(buttons, s, pos, Color.White, 0, origin, scale, SpriteEffects.None, 1); }
private void EventImageAddedHandler(object sender, ArtworkCache.EventArgsArtwork e) { ButtonImage.BeginInvoke((Action)(() => { if (iImageLocations.Contains(e.Uri)) { NSImage img = GetImage(new Uri(e.Uri)); for (int i = 0; i < iImageLocations.Count; i++) { if (iImageLocations[i] == e.Uri) { ButtonImage.ItemAtIndex(i).Image = img; } } } })); }
public TestDefinition ButtonImage_NormalUsage() { // create the control bImg1 = new ButtonImage(); // prepare the testDefinition TestDefinition info = new TestDefinition(); info.testName = "ButtonImage_NormalUsage"; info.testDesc = "Test where the button Image is used in normal conditions. B1 will get the image, B2 will get the filename, B3 will clear."; info.testWidget = bImg1; info.buttonClick1 = new EventHandler(onClick1GetImage); info.buttonClick2 = new EventHandler(onClick1GetFilename); info.buttonClick3 = new EventHandler(onClick1Clear); return(info); }
public TestDefinition ButtonImage_ChangeSize() { // create the control bImg2 = new ButtonImage(16); // prepare the testDefinition TestDefinition info = new TestDefinition(); info.testName = "ButtonImage_ChangeSize"; info.testDesc = "Test where the button Image is Switching the size of the image. B1 is 16px, B2 is 32px, B3 is 128px"; info.testWidget = bImg2; info.buttonClick1 = new EventHandler(onClick2set16); info.buttonClick2 = new EventHandler(onClick2set32); info.buttonClick3 = new EventHandler(onClick2set128); return(info); }
public TestDefinition ButtonImage_LoadImages() { // create the control bImg3 = new ButtonImage(); // prepare the testDefinition TestDefinition info = new TestDefinition(); info.testName = "ButtonImage_LoadImages"; info.testDesc = "Test where the button Image is used to display an image. B1 will set an image, B2 will set a stock, B3 will clear."; info.testWidget = bImg3; info.buttonClick1 = new EventHandler(onClick3SetImage); info.buttonClick2 = new EventHandler(onClick3SetStock); info.buttonClick3 = new EventHandler(onClick3Clear); return(info); }
private bool disposedValue = false; // 要检测冗余调用 protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: 释放托管状态(托管对象)。 ButtonImage?.Dispose(); ButtonImage = null; CursorBitmap?.Dispose(); CursorBitmap = null; } // TODO: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器。 // TODO: 将大型字段设置为 null。 disposedValue = true; } }
protected void InstantiateButton() { cooldownPrefab.transform.localPosition = new Vector3(xPosition, yPosition); cooldownPrefab.transform.localScale = new Vector3(scale, scale); cooldownPrefab.GetComponent <CoolDownSkill>().coolDownTime = skill.GetCoolDownTime(); skill.SetCooldown(Instantiate(cooldownPrefab, canvas.transform, false)); virtualJoyStickPrefab.transform.localPosition = new Vector3(xPosition, yPosition); virtualJoyStickPrefab.transform.localScale = new Vector3(scale, scale); SimpleJoystick joyStick = virtualJoyStickPrefab.GetComponent <SimpleJoystick>(); joyStick.HorizontalAxisName = horizontalButtonName; joyStick.VerticalAxisName = verticalButtonName; SimpleButton button = virtualJoyStickPrefab.GetComponent <SimpleButton>(); button.ButtonName = simpleButtonName; ButtonImage buttonImg = virtualJoyStickPrefab.GetComponentInChildren <ButtonImage>(); buttonImg.changeImage(buttonImage); Instantiate(virtualJoyStickPrefab, canvas.transform, false); }
private void UpdateImages() { iImageLocations.Clear(); ButtonImage.RemoveAllItems(); iImageList = iSaveSupport.ImageList; foreach (KeyValuePair <uint, System.Uri> kvp in iImageList) { NSImage img = GetImage(kvp.Value); iImageLocations.Add(kvp.Value.OriginalString); ButtonImage.AddItemWithTitle(@""); ButtonImage.LastItem.Tag = (int)kvp.Key; if (img != null) { ButtonImage.LastItem.Image = img; } } if (iImageList.Count > 0) { ButtonImage.SelectItemAtIndex(0); } ToggleImageListVisibility(); }
/// <summary> /// Call this within SpirteBatch Begin()/End() blocks to draw that button centred at x,y /// </summary> /// <param name="spriteBatch">Sprite batch to use</param> /// <param name="button">ButtonImage enum button to draw</param> /// <param name="pos">position within the current viewport</param> /// <param name="scale">float scale to draw the text. 1 is 'normal' sized but 0.5f is often better.</param> public static void DrawButton(SpriteBatch spriteBatch, ButtonImage button, Vector2 pos, float scale) { String s = ""; switch (button) { case ButtonImage.LeftThumbStick: s = " "; break; case ButtonImage.DPad: s = "!"; break; case ButtonImage.RightThumbStick: s = "\""; break; case ButtonImage.Back: s = "#"; break; case ButtonImage.Guide: s = "$"; break; case ButtonImage.Start: s = "%"; break; case ButtonImage.X: s = "&"; break; case ButtonImage.A: s = "'"; break; case ButtonImage.Y: s = "("; break; case ButtonImage.B: s = ")"; break; case ButtonImage.RightBumper: s = "*"; break; case ButtonImage.RightTrigger: s = "+"; break; case ButtonImage.LeftTrigger: s = ","; break; case ButtonImage.LeftBumper: s = "-"; break; } Vector2 origin = buttons.MeasureString(s) / 2; spriteBatch.DrawString(buttons, s, pos, Color.White, 0, origin, scale, SpriteEffects.None, 1); }
/// <summary> /// Sets the button image /// </summary> /// <param name="img">The image to set</param> public void SetImage(ButtonImage img) { this.Image = ButtonImages[(int)img]; }
public IconButton(Vector2 position, Rectangle box, string hoverText, ButtonImage buttonImage) { Initialize(); SetPosition(position, box); _buttonImage = buttonImage; _hoverText = hoverText; switch (_buttonImage) { case ButtonImage.New: SourceRectangle.X = 16; SourceRectangle.Y = 0; break; case ButtonImage.Edit: SourceRectangle.X = 80; SourceRectangle.Y = 16; break; case ButtonImage.Open: SourceRectangle.X = 48; SourceRectangle.Y = 0; break; case ButtonImage.Expand: SourceRectangle.X = 144; SourceRectangle.Y = 25; SourceRectangle.Width = 10; SourceRectangle.Height = 5; CollRectangle.Width = SourceRectangle.Width * 2; CollRectangle.Height = SourceRectangle.Height * 2; break; case ButtonImage.Delete: SourceRectangle.X = 64; SourceRectangle.Y = 0; break; case ButtonImage.Rename: SourceRectangle.X = 80; SourceRectangle.Y = 0; break; case ButtonImage.Wall: SourceRectangle.X = 64; SourceRectangle.Y = 16; break; case ButtonImage.Play: SourceRectangle.X = 0; SourceRectangle.Y = 0; break; case ButtonImage.Back: SourceRectangle.X = 80; SourceRectangle.Y = 32; SourceRectangle.Width = SourceRectangle.Width * 2; CollRectangle.Width = CollRectangle.Width * 2; break; case ButtonImage.Save: SourceRectangle.X = 32; SourceRectangle.Y = 0; break; case ButtonImage.Brush: SourceRectangle.X = 96; SourceRectangle.Y = 0; break; case ButtonImage.Eraser: SourceRectangle.X = 96; SourceRectangle.Y = 16; break; case ButtonImage.Undo: SourceRectangle.X = 64; SourceRectangle.Y = 32; break; case ButtonImage.Settings: SourceRectangle.X = 48; SourceRectangle.Y = 16; break; case ButtonImage.Select: SourceRectangle.X = 16; SourceRectangle.Y = 48; break; case ButtonImage.Plus: SourceRectangle.X = 112; SourceRectangle.Y = 0; break; case ButtonImage.Minus: SourceRectangle.X = 112; SourceRectangle.Y = 16; break; case ButtonImage.LightBulb: SourceRectangle.X = 48; SourceRectangle.Y = 48; break; } }
private static void OnCommandChanged(DependencyObject a_dependencyObject, DependencyPropertyChangedEventArgs a_e) { Button button = a_dependencyObject as Button; if (button == null) { throw new InvalidOperationException(@"Button required"); } ICommand oldCommand = a_e.OldValue as ICommand; if (oldCommand != null) { button.Command = null; CommandToolTipHelper.ApplyCommandToolTip(button, null); ICommandDescriptionProvider oldDescProvider = a_e.OldValue as ICommandDescriptionProvider; if (GetOverrideContent(button) && oldDescProvider != null) { button.Content = null; } } ICommand newCommand = a_e.NewValue as ICommand; if (newCommand != null) { button.Command = newCommand; CommandToolTipHelper.ApplyCommandToolTip(button, newCommand); ICommandDescriptionProvider newDescProvider = a_e.NewValue as ICommandDescriptionProvider; if (GetOverrideContent(button) && newDescProvider != null) { var textContent = new TextBlock() { TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.Wrap, }; BindingOperations.SetBinding( textContent, TextBlock.TextProperty, new Binding("Text") { Source = newDescProvider.Description }); Uri imageUri = CommandImageHelper.GetCommandImageUri(newCommand); if (imageUri != null) { Dock?useText = GetAppendText(button); ButtonImage image = new ButtonImage() { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Source = new BitmapImage(imageUri), }; if (useText.HasValue) { Label text = new Label() { Margin = new Thickness(2), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Content = textContent, }; DockPanel.SetDock(text, useText.Value); DockPanel container = new DockPanel(); container.LastChildFill = true; container.Children.Add(text); container.Children.Add(image); button.Content = container; } else { button.Content = image; } } else { button.Content = textContent; } } } }
public override void Shown() { try { root = new RootDisposable(); VideoTypes videoType; //video = Video.Init(VideoTypes.D3D11 | VideoTypes.D3D9 | VideoTypes.OpenGL | VideoTypes.XNA | VideoTypes.Vita, out videoType, root, this, true); video = Video.Init(VideoTypes.D3D11, out videoType, root, this, true); DiffuseTextureMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); DiffuseTextureMaterial.ApplyInstanceConstantsCallback = applyInstanceData; var materialTypes = new Dictionary<string,Type>(); materialTypes.Add("Material", typeof(DiffuseTextureMaterial)); materialTypes.Add("Material.001", typeof(DiffuseTextureMaterial)); var materialFieldTypes = new List<MaterialFieldBinder>(); materialFieldTypes.Add(new MaterialFieldBinder("Material", "Roxy_dds", "Diffuse")); materialFieldTypes.Add(new MaterialFieldBinder("Material.001", "Wolf_dds", "Diffuse")); var extOverrides = new Dictionary<string,string>(); #if SILVERLIGHT || VITA || (LINUX && ARM) extOverrides.Add(".dds", ".png"); #endif #if iOS extOverrides.Add(".dds", ".pvr"); #endif #if ANDROID if (((Reign.Video.OpenGL.Video)video).Caps.TextureCompression_ATC) extOverrides.Add(".dds", ".atc"); else if (((Reign.Video.OpenGL.Video)video).Caps.TextureCompression_PVR) extOverrides.Add(".dds", ".pvr"); #endif var emptyBinders = new List<MaterialFieldBinder>(); model = new Model(video, "Data/boxes.rm", "Data/", materialTypes, emptyBinders, emptyBinders, emptyBinders, emptyBinders, materialFieldTypes, extOverrides, 0, null); var frame = FrameSize; viewPort = ViewPortAPI.New(video, 0, 0, frame.Width, frame.Height); camera = new Camera(viewPort, new Vector3(5, 5, 5), new Vector3(), new Vector3(5, 5+1, 5), 1, 50, MathUtilities.DegToRad(45)); rasterizerState = RasterizerStateAPI.New(video, RasterizerStateDescAPI.New(RasterizerStateTypes.Solid_CullCW)); depthStencilState = DepthStencilStateAPI.New(video, DepthStencilStateDescAPI.New(DepthStencilStateTypes.ReadWrite_Less)); blendState = BlendStateAPI.New(video, BlendStateDescAPI.New(BlendStateTypes.None)); samplerState = SamplerStateAPI.New(video, SamplerStateDescAPI.New(SamplerStateTypes.Linear_Wrap)); InputTypes inputType; input = Input.Init(InputTypes.WinForms, out inputType, root, this); mouse = MouseAPI.New(input); keyboard = KeyboardAPI.New(input); // ----------------------- FontMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); var fontTexture = Texture2DAPI.New(video, "Data/WhiteFont.png", null); font = new Font(video, FontMaterial.Shader, fontTexture, "Data/WhiteFont.font", null); UISolidColorMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); UISolidTextureMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); UISolidTexture2Material.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); UISolidTexture3Material.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); ui = new UI(root, video, UISolidColorMaterial.Shader, UISolidTextureMaterial.Shader, UISolidTexture2Material.Shader, UISolidTexture3Material.Shader, font, 16, mouse); button = new Reign.UI.Button(ui, "Hello World!", 10, 10, 128, 32); ui.AddElement(button); var idleTexture = Texture2DAPI.New(video, "Data/PlayIdle.png", null); var rolloverTexture = Texture2DAPI.New(video, "Data/PlayRollover.png", null); var pressedTexture = Texture2DAPI.New(video, "Data/PlayPressed.png", null); buttonImage = new ButtonImage(ui, idleTexture, rolloverTexture, pressedTexture, 400, 10, 64, 64); ui.AddElement(buttonImage); // ----------------------- loaded = true; } catch (Exception e) { dispose(); Message.Show("Error", e.Message); } }