• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# AppKit.NSButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MonoMac.AppKit.NSButton的典型用法代码示例。如果您正苦于以下问题:C# NSButton类的具体用法?C# NSButton怎么用?C# NSButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NSButton类属于MonoMac.AppKit命名空间,在下文中一共展示了NSButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ViewDidLoad

		public override void ViewDidLoad ()
		{
			View = new NSView (new RectangleF (0, 0, 320, 400));
			base.ViewDidLoad ();

			var textEditFirst = new NSTextField(new System.Drawing.RectangleF(0,0,320,40));
			View.AddSubview (textEditFirst);
			var textEditSecond = new NSTextField(new System.Drawing.RectangleF(0,50,320,40));
			View.AddSubview(textEditSecond);
			var slider = new NSSlider(new System.Drawing.RectangleF(0,150,320,40));
			slider.MinValue = 0;
			slider.MaxValue = 100;
			slider.IntValue = 23;
			View.AddSubview(slider);
			var labelFull = new NSTextField(new System.Drawing.RectangleF(0,100,320,40));
			labelFull.Editable = false;
			labelFull.Bordered = false;
			labelFull.AllowsEditingTextAttributes = false;
			labelFull.DrawsBackground = false;
			View.AddSubview (labelFull);
			var sw = new NSButton(new RectangleF(0,200,320,40));
			sw.SetButtonType (NSButtonType.Switch);
			View.AddSubview (sw);
			//sw.AddObserver()

			var set = this.CreateBindingSet<SecondViewController, SecondViewModel> ();
			set.Bind (textEditFirst).For(v => v.StringValue).To (vm => vm.FirstName);
			set.Bind (textEditSecond).For(v => v.StringValue).To (vm => vm.LastName);
			set.Bind (labelFull).Described("SliderValue + ' ' + OnOffValue").For("StringValue");	
			set.Bind (slider).For("IntValue").To (vm => vm.SliderValue);
			set.Bind (sw).For(c => c.State).To (vm => vm.OnOffValue);


			set.Apply ();
		}
开发者ID:Dexyon,项目名称:MvvmCross-Samples,代码行数:35,代码来源:FirstViewController.cs


示例2: useNumbersPressed

partial         void useNumbersPressed(NSButton sender)
        {
            if( sender.IntValue == 0 )
                useNumbers = false;
            else
                useNumbers = true;
        }
开发者ID:mkoby,项目名称:PasswordGenerator,代码行数:7,代码来源:MainWindowController.cs


示例3: useLowerCaseLettersPressed

partial         void useLowerCaseLettersPressed(NSButton sender)
        {
            if( sender.IntValue == 0 )
                useLowercaseLetters = false;
            else
                useLowercaseLetters = true;
        }
开发者ID:mkoby,项目名称:PasswordGenerator,代码行数:7,代码来源:MainWindowController.cs


示例4: lightPointalize

		partial void lightPointalize (NSButton sender)
		{
			if (controls.ContentFilters == null || controls.ContentFilters.Count() == 0)
				Pointalize();	
			
			var path = string.Format ("contentFilters.pointalize.{0}", CIFilter.InputRadiusKey);
			controls.SetValueForKeyPath (NSNumber.FromFloat (1.0f), (NSString)path);
		}
开发者ID:kangaroo,项目名称:monomac,代码行数:8,代码来源:FilteredView.cs


示例5: MvxNSButtonTitleTargetBinding

 public MvxNSButtonTitleTargetBinding(NSButton button)
     : base(button)
 {
     if (button == null)
     {
         MvxBindingTrace.Trace(MvxTraceLevel.Error, "Error - NSButton is null in MvxNSButtonTitleTargetBinding");
     }
 }
开发者ID:indazoo,项目名称:MvvmCross_DesignData,代码行数:8,代码来源:MvxNSButtonTitleTargetBinding.cs


示例6: removeLastBox

		// Action for Remove pushbutton
		partial void removeLastBox (NSButton sender)
		{
			if (simpleView.Subviews.Length == 0)
				return;
			
			simpleView.Subviews.Last ().RemoveFromSuperview ();
			layout ();
		}
开发者ID:kangaroo,项目名称:monomac,代码行数:9,代码来源:AnimatingViewsWindowController.cs


示例7: makeFast

		partial void makeFast (NSButton sender)
		{
			CABasicAnimation frameOriginAnimation = new CABasicAnimation();
			frameOriginAnimation.Duration = 0.1f;
			NSDictionary animations = NSDictionary.FromObjectAndKey(frameOriginAnimation,
			                                                        (NSString)"frameOrigin");
			myView.Mover.Animations = animations;
		}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:8,代码来源:MainWindowController.cs


示例8: heavyPointalize

		partial void heavyPointalize (NSButton sender)
		{
			if (controls.ContentFilters == null || controls.ContentFilters.Count() == 0)
				Pointalize();	
			
			string path = string.Format ("contentFilters.pointalize.{0}", CIFilterInputKey.Radius);
			controls.SetValueForKeyPath (NSNumber.FromFloat (5), (NSString)path);
		}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:8,代码来源:FilteredView.cs


示例9: generatePasswordClicked

partial         void generatePasswordClicked(NSButton sender)
        {
            gen = new Generator(Int32.Parse( passwordLengthText.StringValue ),
                                useUppercaseLetters,
                                useLowercaseLetters,
                                useNumbers,
                                useSpecialCharacters);
            generatedPasswordText.StringValue = gen.GeneratePassword();
        }
开发者ID:mkoby,项目名称:PasswordGenerator,代码行数:9,代码来源:MainWindowController.cs


示例10: requestAction

 partial void requestAction (NSButton sender)
 {
         myTimer = NSTimer.CreateScheduledTimer (3.0, delegate {
                 if (popupRequestType.Cell.SelectedItemIndex == 0)
                         NSApp.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest);
                 else
                         NSApp.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest);
         });
 }
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:9,代码来源:MainWindowController.cs


示例11: openInDefaultBrowser

		partial void openInDefaultBrowser (NSButton sender)
		{
			CLLocation currentLocation = locationManager.Location;
			
			var urlPath = String.Format("http://maps.google.com/maps?ll={0},{1}&amp;spn={2},{3}",
						    currentLocation.Coordinate.Latitude,currentLocation.Coordinate.Longitude,
						    latitudeRangeForLocation (currentLocation), longitudeRangeForLocation (currentLocation));

			var externalBrowserURL = new NSUrl (urlPath);
			NSWorkspace.SharedWorkspace.OpenUrl (externalBrowserURL);
		}
开发者ID:roblillack,项目名称:monomac,代码行数:11,代码来源:MainWindowController.cs


示例12: DeleteButtonClicked

		partial void DeleteButtonClicked (NSButton sender)
		{
			if (bookmarkTableView.SelectedRowCount != 1)
				return;
			
			var index = bookmarkTableView.SelectedRow;
			if (index < 0 || index > bookmarkTableView.RowCount)
				return;
			var temp = BookmarkDeleted;
			if (temp != null)
				temp (index);
		}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:12,代码来源:BookmarkAssistant.cs


示例13: Canvas

        public Canvas()
        {
            root = new RootNode ();
            renderers = new List<object> ();
            uisync = new UISyncInvoke ();
            Motion.Tweener.Sync = uisync;

            testButton = new NSButton (new System.Drawing.RectangleF (100, 100, 100, 50));
            testButton.BezelStyle = NSBezelStyle.Rounded;

            testButton.FrameCenterRotation = 40;

            AddSubview (testButton);
        }
开发者ID:Clancey,项目名称:Canvas,代码行数:14,代码来源:Canvas.cs


示例14: startStopAction

		partial void startStopAction (NSButton sender) 
		{
			if (sender.Title == "Start") {
				counter.Start ();
				sender.Title = "Stop";
				GrowlApplicationBridge.Notify ("The two-minute rule is magic.", 
				                               "You now have two minutes to Get Your Things Done.", "Start", null, 0, false, null);
			} else {
				counter.Stop ();
				sender.Title = "Start";
				if (counter.TimerMark.Minutes > 0 && counter.TimerMark.Seconds > 0)
					GrowlApplicationBridge.Notify ("Action Completed", String.Format ("You still have {0} left.  Step back and breath.  " + "Take a second and contemplate what you have achieved.  " + "You'll be suprised how many two-minute actions you can " + "perform even on your most critical projects", counter.TimeLeft), "Stop", null, 0, true, null);
			}
		}
开发者ID:kangaroo,项目名称:monomac,代码行数:14,代码来源:MainWindowController.cs


示例15: goFullScreen

		partial void goFullScreen (NSButton sender)
		{
			isInFullScreenMode = true;
			
			// Pause the non-fullscreen view
			openGLView.StopAnimation ();
			
			RectangleF mainDisplayRect;
			RectangleF viewRect;
			
			// Create a screen-sized window on the display you want to take over
			// Note, mainDisplayRect has a non-zero origin if the key window is on a secondary display
			mainDisplayRect = NSScreen.MainScreen.Frame;
			
			fullScreenWindow = new NSWindow (mainDisplayRect, NSWindowStyle.Borderless, NSBackingStore.Buffered, true);
			
			// Set the window level to be above the menu bar
			fullScreenWindow.Level = NSWindowLevel.MainMenu + 1;
			
			// Perform any other window configuration you desire
			fullScreenWindow.IsOpaque = true;
			fullScreenWindow.HidesOnDeactivate = true;
			
			// Create a view with a double-buffered OpenGL context and attach it to the window
			// By specifying the non-fullscreen context as the shareContext, we automatically inherit the 
			// OpenGL objects (textures, etc) it has defined
			viewRect = new RectangleF (0, 0, mainDisplayRect.Size.Width, mainDisplayRect.Size.Height);
			
			fullScreenView = new MyOpenGLView (viewRect, openGLView.OpenGLContext);
			fullScreenWindow.ContentView = fullScreenView;
			
			// Show the window
			fullScreenWindow.MakeKeyAndOrderFront (this);
			
			// Set the scene with the full-screen viewport and viewing transformation
			Scene.setViewportRect (viewRect);
			
			// Assign the view's MainController to self
			fullScreenView.MainController = this;
			
			if (!isAnimating) {
				// Mark the view as needing drawing to initalize its contents
				fullScreenView.NeedsDisplay = true;
			} else {
				// Start playing the animation
				fullScreenView.StartAnimation ();
				
			}
		}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:49,代码来源:MainWindowController.cs


示例16: AddButtonClicked

		partial void AddButtonClicked (NSButton sender)
		{
			var panel = NSOpenPanel.OpenPanel;
			panel.FloatingPanel = true;
			panel.CanChooseDirectories = true;
			panel.CanChooseFiles = true;
			//FIXME - create enum for open/save panel return code
			int i = panel.RunModal ();
			if (i == 1 && panel.Urls != null) {
				foreach (NSUrl url in panel.Urls) {
					browseData.AddImages (url);
				}
				browserView.ReloadData ();
			}
		}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:15,代码来源:MainWindowController.cs


示例17: openInDefaultBrowser

		partial void openInDefaultBrowser (NSButton sender)
		{
			CLLocation currentLocation = locationManager.Location;
			
			// it can take a few seconds before a location is returned
			if (currentLocation == null) {
				AppKitFramework.NSBeep ();
				return;
			}
			
			var urlPath = String.Format("http://maps.google.com/maps?ll={0},{1}&amp;spn={2},{3}",
						    currentLocation.Coordinate.Latitude,currentLocation.Coordinate.Longitude,
						    latitudeRangeForLocation (currentLocation), longitudeRangeForLocation (currentLocation));

			var externalBrowserURL = new NSUrl (urlPath);
			NSWorkspace.SharedWorkspace.OpenUrl (externalBrowserURL);
		}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:17,代码来源:MainWindowController.cs


示例18: Note

        public Note()
            : base()
        {
            SetFrame (new RectangleF (0, 0, 480, 240), true);
            Center ();

            Delegate    = new SparkleNoteDelegate ();
            StyleMask   = (NSWindowStyle.Closable | NSWindowStyle.Titled);
            Title       = "Add Note";
            MaxSize     = new SizeF (480, 240);
            MinSize     = new SizeF (480, 240);
            HasShadow   = true;
            IsOpaque    = false;
            BackingType = NSBackingStore.Buffered;
            Level       = NSWindowLevel.Floating;

            this.hidden_close_button = new NSButton () {
                Frame                     = new RectangleF (0, 0, 0, 0),
                KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                KeyEquivalent             = "w"
            };

            CreateNote ();

            this.hidden_close_button.Activated += delegate { Controller.WindowClosed (); };

            Controller.HideWindowEvent += delegate {
                SparkleShare.Controller.Invoke (() => PerformClose (this));
            };

            Controller.ShowWindowEvent += delegate {
                SparkleShare.Controller.Invoke (() => OrderFrontRegardless ());
                CreateNote ();
            };

            Controller.UpdateTitleEvent += delegate (string title) {
                SparkleShare.Controller.Invoke (() => { Title = title; });
            };

            ContentView.AddSubview (this.hidden_close_button);
        }
开发者ID:Rud5G,项目名称:SparkleShare,代码行数:41,代码来源:Note.cs


示例19: SparkleAbout

        public SparkleAbout () : base ()
        {
            SetFrame (new RectangleF (0, 0, 640, 281), true);
            Center ();

            Delegate    = new SparkleAboutDelegate ();
            StyleMask   = (NSWindowStyle.Closable | NSWindowStyle.Titled);
            Title       = "About SparkleShare";
            MaxSize     = new SizeF (640, 281);
            MinSize     = new SizeF (640, 281);
            HasShadow   = true;
            BackingType = NSBackingStore.Buffered;
            Level       = NSWindowLevel.Floating;

            this.hidden_close_button = new NSButton () {
                Frame                     = new RectangleF (0, 0, 0, 0),
                KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                KeyEquivalent             = "w"
            };

            CreateAbout ();


            this.hidden_close_button.Activated += delegate { Controller.WindowClosed (); };

            Controller.HideWindowEvent += delegate {
                Program.Controller.Invoke (() => PerformClose (this));
            };

            Controller.ShowWindowEvent += delegate {
                Program.Controller.Invoke (() => OrderFrontRegardless ());
            };

            Controller.UpdateLabelEvent += delegate (string text) {
                Program.Controller.Invoke (() => { this.updates_text_field.StringValue = text; });
            };


            ContentView.AddSubview (this.hidden_close_button);
        }
开发者ID:rchicoli,项目名称:sparkleshare,代码行数:40,代码来源:SparkleAbout.cs


示例20: AwakeFromNib

        public override void AwakeFromNib()
        {
            base.AwakeFromNib ();

            CloseButton = new NSButton ();
            CloseButton.BezelStyle = NSBezelStyle.Circular;
            CloseButton.Bordered = false;

            NSButton windowCloseButton = StandardWindowButton (NSWindowButton.CloseButton);
            NSButton windowMinimizeButton = StandardWindowButton (NSWindowButton.MiniaturizeButton);
            NSButton windowZoomButton = StandardWindowButton (NSWindowButton.ZoomButton);

            windowZoomButton.Hidden = true;
            windowMinimizeButton.Hidden = true;
            windowCloseButton.Hidden = true;

            if (NSScreen.MainScreen.BackingScaleFactor > 1.0f) {
                AssignCloseImage ("[email protected]",
                              "[email protected]");
                AssignBackgroundImage ("[email protected]");
            } else {
                AssignCloseImage ("lightdialog.close.png",
                              "lightdialog.close_pressed.png");
                AssignBackgroundImage ("lightwindow.paper.png");
            }

            NSView themeFrame = ContentView.Superview;
            RectangleF containerFrame = themeFrame.Frame;
            RectangleF buttonFrame = CloseButton.Frame;

            CloseButton.Frame = new RectangleF (
                1.0f, containerFrame.Size.Height - buttonFrame.Size.Height - 2,
                buttonFrame.Size.Width, buttonFrame.Size.Height);;
            themeFrame.AddSubview (CloseButton);
            CloseButton.AutoresizingMask = NSViewResizingMask.MinXMargin | NSViewResizingMask.MinYMargin;
            CloseButton.Enabled = true;
            CloseButton.Target = this;
            CloseButton.Action = new Selector("performClose:");
        }
开发者ID:burtonageo,项目名称:Bookling,代码行数:39,代码来源:LightDialog.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AppKit.NSImage类代码示例发布时间:2022-05-26
下一篇:
C# AppKit.NSApplication类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap