当前位置: 首页>>代码示例>>C#>>正文


C# Image.FadeTo方法代码示例

本文整理汇总了C#中System.Image.FadeTo方法的典型用法代码示例。如果您正苦于以下问题:C# Image.FadeTo方法的具体用法?C# Image.FadeTo怎么用?C# Image.FadeTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Image的用法示例。


在下文中一共展示了Image.FadeTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Footer

        public Footer()
        {
            this.Orientation = StackOrientation.Horizontal;
            this.BackgroundColor = Color.Black;
            this.VerticalOptions = LayoutOptions.End;

            var button = new Image {Source = "matches_icon2", WidthRequest = App.ScreenWidth / 4 ,HorizontalOptions = LayoutOptions.CenterAndExpand}; // make your image your button should be
            button.GestureRecognizers.Add (new TapGestureRecognizer (sender => {
                // Do whatever you want to do when its tapped
                button.Opacity = 0.6;
                button.FadeTo (1);
            }));

            this.Children.Add (button);

            var button2 = new Image {Source = "runner_icon2" , WidthRequest = App.ScreenWidth / 4 ,HorizontalOptions = LayoutOptions.CenterAndExpand}; // make your image your button should be
            button2.GestureRecognizers.Add (new TapGestureRecognizer (sender => {
                // Do whatever you want to do when its tapped
                button2.Opacity = 0.6;
                button2.FadeTo (1);
            }));

            this.Children.Add (button2);

            var button3 = new Image {Source = "settings_icon2" , WidthRequest = App.ScreenWidth / 4 ,HorizontalOptions = LayoutOptions.CenterAndExpand}; // make your image your button should be
            button3.GestureRecognizers.Add (new TapGestureRecognizer (sender => {
                // Do whatever you want to do when its tapped
                button3.Opacity = 0.6;
                button3.FadeTo (1);
            }));
            this.Children.Add (button3);

            var button4 = new Image {Source = "guide_icon2", WidthRequest = App.ScreenWidth / 4 ,HorizontalOptions = LayoutOptions.CenterAndExpand}; // make your image your button should be
            button4.GestureRecognizers.Add (new TapGestureRecognizer (sender => {
                // Do whatever you want to do when its tapped
                button4.Opacity = 0.6;
                button4.FadeTo (1);
            }));
            this.Children.Add (button4);
        }
开发者ID:adrianbrink,项目名称:be-my-guide,代码行数:40,代码来源:Footer.cs

示例2: RowTapped

 async void RowTapped (object sender, ItemTappedEventArgs e)
 {
     var item = e.Item as ImageInfo;
     _lightbox = new Image {
         WidthRequest = 100,
         HeightRequest = 100,
         HorizontalOptions = LayoutOptions.Center,
         VerticalOptions = LayoutOptions.Center,
         Opacity = 0,
         Source = item.Text
     };
     _lightbox.GestureRecognizers.Add (new TapGestureRecognizer {
         NumberOfTapsRequired = 1,
         Command = new Command (CloseLightBox)
     });
     RootGrid.Children.Add (_lightbox);
     RootGrid.ForceLayout ();
     _origBounds = _lightbox.Bounds;
     var fadeIn = _lightbox.FadeTo (1.0);
     var zoomIn = _lightbox.LayoutTo (RootGrid.Bounds);
     await Task.WhenAll (new[] { fadeIn, zoomIn });
 }
开发者ID:powerdude,项目名称:XamarinSamples,代码行数:22,代码来源:MainPage.xaml.cs

示例3: TodoItemPage

		public TodoItemPage ()
		{
			this.SetBinding (ContentPage.TitleProperty, "Name");
			BackgroundColor = Color.FromRgb (255, 244, 165);
			NavigationPage.SetHasNavigationBar (this, true);

			var nameLabel = new Label { Text = "Name", Font = Constants.Font };
			var nameEntry = new Entry { Placeholder = "what to do?" };
			
			nameEntry.SetBinding (Entry.TextProperty, "Name");

			var notesLabel = new Label { Text = "Notes", Font = Constants.Font  };
			var notesEntry = new Entry { Placeholder = "more info..." };
			notesEntry.SetBinding (Entry.TextProperty, "Notes");

			var doneLabel = new Label { Text = "Done", Font = Constants.Font, HorizontalOptions = LayoutOptions.StartAndExpand };

			doneImage =new Image {
				Source = ImageSource.FromFile("box.png"),
				HorizontalOptions = LayoutOptions.EndAndExpand,
			}; 
			var doneTap = new TapGestureRecognizer {
				NumberOfTapsRequired = 1
			};
			doneTap.Tapped += (object sender, EventArgs e) => {
				var todo = (TodoItem)BindingContext;
				todo.Done = !todo.Done;
				if (todo.Done)
					doneImage.Source = ImageSource.FromFile("checkbox.png"); 
				else
					doneImage.Source = ImageSource.FromFile("box.png"); 
			};
			doneImage.GestureRecognizers.Add (doneTap);


			var saveImage = new Image {Source = ImageSource.FromFile("save.png"), HorizontalOptions = LayoutOptions.CenterAndExpand};
			cancelImage = new Image {Source = ImageSource.FromFile("cancel.png"), HorizontalOptions = LayoutOptions.CenterAndExpand};
			var speakImage = new Image {Source = ImageSource.FromFile("speak.png"), HorizontalOptions = LayoutOptions.CenterAndExpand};

			var saveTap = new TapGestureRecognizer { NumberOfTapsRequired = 1 };
			var cancelTap = new TapGestureRecognizer { NumberOfTapsRequired = 1 };
			var speakTap = new TapGestureRecognizer { NumberOfTapsRequired = 1 };

			saveTap.Tapped += async (sender, e) => {
				await saveImage.FadeTo(0.3);
				var todoItem = (TodoItem)BindingContext;
				App.Database.SaveItem(todoItem);
				await Navigation.PopAsync();
			};
            cancelTap.Tapped += async (sender, e) =>
            {
                var todoItem = (TodoItem)BindingContext;
                if (todoItem.ID <= 0)
                {
                    await Navigation.PopAsync();
                }  else {
                    await cancelImage.FadeTo(0.3);
                    var doit = await DisplayAlert("Are you sure?", "Do you want to delete the task " + todoItem.Name + "?", "Delete", "Cancel");
                    if (doit)
                    {
                        App.Database.DeleteItem(todoItem.ID);
                        await Navigation.PopAsync();
                    }
                    await cancelImage.FadeTo(1.0);
                }
            };
			speakTap.Tapped += async (sender, e) => {
				await speakImage.FadeTo(0.3);
				var todoItem = (TodoItem)BindingContext;
				App.Speech.Speak(todoItem.Name + " " + todoItem.Notes);
				await speakImage.FadeTo(1.0);
			};
			saveImage.GestureRecognizers.Add (saveTap);
			cancelImage.GestureRecognizers.Add (cancelTap);
			speakImage.GestureRecognizers.Add (speakTap);


			if (Device.OS == TargetPlatform.iOS) {
				nameEntry.BackgroundColor = Color.FromRgb (255, 244, 165);
				notesEntry.BackgroundColor = Color.FromRgb (255, 244, 165);
			}
			if (Device.OS != TargetPlatform.iOS) { // WinPhone & Android
				nameEntry.TextColor = Color.Black;
				notesEntry.TextColor = Color.Black;

				nameLabel.TextColor = Color.Black;
				notesLabel.TextColor = Color.Black;
				doneLabel.TextColor = Color.Black;
			}

			Content = new StackLayout {
				VerticalOptions = LayoutOptions.StartAndExpand,
				Padding = new Thickness(20),
				Children = {
					nameLabel, nameEntry, 
					notesLabel, notesEntry,
					new StackLayout {
						Orientation = StackOrientation.Horizontal,
						HorizontalOptions = LayoutOptions.StartAndExpand,
						VerticalOptions = LayoutOptions.Center,
//.........这里部分代码省略.........
开发者ID:Randy3W,项目名称:xamarin-forms-samples,代码行数:101,代码来源:TodoItemPage.cs

示例4: Build

        async Task Build()
        {
            // hide all
            await boxViewCanvas.FadeTo(1, 0);

            StopAnimationLoop();
            await Task.Delay(1000);

            // Background;
            imageLogoBackground.Source = ImageSourceFromResource("LogoBackground");
            imageLogoBackground.IsVisible = false;
            ImageLogoBackgroundBounds = Rectangle.Zero;
  
            // Images 
            absoluteLayoutImages.Children.Clear();
            ImageLogo = AddImage("LogoTransparent", false);
            ImageLogoFull = AddImage("LogoFullTransparent", false);
            AddDetailImage(LogoDetail.Hill, "LogoTransparentHill");
            AddDetailImage(LogoDetail.OriginalSee, "LogoTransparentOriginalSee");
            AddDetailImage(LogoDetail.OriginalMeadow, "LogoTransparentOriginalMeadow");
            AddDetailImage(LogoDetail.See, "LogoTransparentSee");
            AddDetailImage(LogoDetail.Meadow, "LogoTransparentMeadow");
            AddDetailImage(LogoDetail.Street, "LogoTransparentStreet");
            AddDetailImage(LogoDetail.House7, "LogoTransparentHouse7");
            AddDetailImage(LogoDetail.House5, "LogoTransparentHouse5");
            AddDetailImage(LogoDetail.House, "LogoTransparentHouse");
            AddDetailImage(LogoDetail.Sun, "LogoTransparentSun");

            await Task.Delay(500);

            // Prepaire
            ImageDetailBounds = new Rectangle(DetailImages[LogoDetail.House].Bounds.X, DetailImages[LogoDetail.House].Bounds.Y, DetailImages[LogoDetail.House].Bounds.Width, DetailImages[LogoDetail.House].Bounds.Height);
            ImageDetailBounds.Height = ImageDetailBounds.Width;

            ImagesDetailBoundsLeftOut = new Rectangle(-ImageDetailBounds.Width, ImageDetailBounds.Y, ImageDetailBounds.Width, ImageDetailBounds.Height);
            ImagesDetailBoundsRightOut = new Rectangle(absoluteLayoutImages.Width, ImageDetailBounds.Y, ImageDetailBounds.Width, ImageDetailBounds.Height);

            var x = (absoluteLayoutImages.Width - ImageDetailBounds.Width) / 2;
            ImagesDetailBoundsTopOut = new Rectangle(x, -ImageDetailBounds.Height, ImageDetailBounds.Width, ImageDetailBounds.Height);
            ImagesDetailBoundsTopOutHalf = new Rectangle(x, -ImageDetailBounds.Height / 2, ImageDetailBounds.Width, ImageDetailBounds.Height);

            await Task.WhenAll(new Task[]
                {
                    imageLogoBackground.ScaleTo(0, 0),
                    imageLogoBackground.FadeTo(0, 0),
                    ImageLogo.FadeTo(0, 0),
                    ImageLogoFull.FadeTo(0, 0),

                    DetailImages[LogoDetail.Hill].LayoutTo(ImagesDetailBoundsTopOut, 0),
                    DetailImages[LogoDetail.OriginalSee].LayoutTo(ImagesDetailBoundsLeftOut, 0),
                    DetailImages[LogoDetail.OriginalMeadow].LayoutTo(ImagesDetailBoundsRightOut, 0),
                    DetailImages[LogoDetail.See].LayoutTo(ImagesDetailBoundsRightOut, 0),
                    DetailImages[LogoDetail.Meadow].LayoutTo(ImagesDetailBoundsLeftOut, 0),
                    DetailImages[LogoDetail.Street].FadeTo(0, 0),
                    DetailImages[LogoDetail.House].FadeTo(0, 0),
                    DetailImages[LogoDetail.House7].LayoutTo(ImagesDetailBoundsTopOutHalf, 0),
                    DetailImages[LogoDetail.House5].LayoutTo(ImagesDetailBoundsTopOutHalf, 0),
                    DetailImages[LogoDetail.Sun].FadeTo(0, 0),
                });

            // Labels 
            stackLayoutInfo.Children.Clear();
            AddDetailLabel(LogoDetail.Header, Color.Black, 20);
            AddDetailLabel(LogoDetail.Hill, Styles.Colors.Hill);
            AddDetailLabel(LogoDetail.See, Styles.Colors.See);
            AddDetailLabel(LogoDetail.Meadow, Styles.Colors.Meadow);
            AddDetailLabel(LogoDetail.Street, Styles.Colors.Street);
            AddDetailLabel(LogoDetail.House, Styles.Colors.House);

            WebViewIsVisible = false;
        }
开发者ID:rzee7,项目名称:Tausendblatt,代码行数:71,代码来源:PageTausendblatt.xaml.cs


注:本文中的System.Image.FadeTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。