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


C# Button.SetSizeRequest方法代码示例

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


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

示例1: MainWindow_2

        public MainWindow_2()
            : base("Allignment")
        {
            SetDefaultSize(260, 150);
            SetPosition(WindowPosition.Center);
            DeleteEvent += delegate { Application.Quit(); };

            VBox vbox = new VBox(false, 5);
            HBox hbox = new HBox(true, 3);

            Alignment valign = new Alignment(0, 0.5f, 0, 0);
            vbox.PackStart(valign);

            Button ok = new Button("OK");
            ok.SetSizeRequest(70, 30);
            Button close = new Button("Close");

            hbox.Add(ok);
            hbox.Add(close);

            Alignment halign = new Alignment(0.5f, 0, 0, 0);
            halign.Add(hbox);

            vbox.PackStart(halign, false, false, 3);

            Add(vbox);

            ShowAll();
        }
开发者ID:oraora81,项目名称:NOCmono,代码行数:29,代码来源:MainWindow_2.cs

示例2: MainWindow_Event

        public MainWindow_Event()
            : base("")
        {
            SetDefaultSize(250, 200);
            SetPosition(WindowPosition.Center);

            DeleteEvent += delegate { Application.Quit(); };

            Fixed fix = new Fixed();

            Button btn = new Button("Enter");
            btn.EnterNotifyEvent += OnEnter;

            _quit = new Button("Quit");
            //_quit.Clicked += OnClick;
            _quit.SetSizeRequest(80, 35);

            CheckButton cb = new CheckButton("connect");
            cb.Toggled += OnToggled;

            fix.Put(btn, 50, 20);
            fix.Put(_quit, 50, 50);
            fix.Put(cb, 120, 20);
            Add(fix);
            ShowAll();
        }
开发者ID:oraora81,项目名称:NOCmono,代码行数:26,代码来源:MainWindow_Event.cs

示例3: DebugView

        public DebugView(Settings set, DebugManager mgr)
        {
            debugManager = mgr;
            layout = new Table(2, 2, false);
            runStop = new Button("Interrupt");
            command = new Entry();
            log = new ConsoleLog(set);

            command.Activated += OnCommand;
            runStop.Clicked += OnRunStop;

            layout.Attach(log.View, 0, 2, 0, 1,
              AttachOptions.Fill,
              AttachOptions.Expand | AttachOptions.Fill,
              4, 4);
            layout.Attach(command, 0, 1, 1, 2,
              AttachOptions.Fill | AttachOptions.Expand,
              AttachOptions.Fill,
              4, 4);
            layout.Attach(runStop, 1, 2, 1, 2,
              AttachOptions.Fill, AttachOptions.Fill, 4, 4);

            runStop.SetSizeRequest(80, -1);

            command.Sensitive = false;
            runStop.Sensitive = false;

            mgr.MessageReceived += OnDebugOutput;
            mgr.DebuggerBusy += OnBusy;
            mgr.DebuggerReady += OnReady;
            mgr.DebuggerStarted += OnStarted;
            mgr.DebuggerExited += OnExited;
            layout.Destroyed += OnDestroy;
        }
开发者ID:dlbeer,项目名称:olishell,代码行数:34,代码来源:DebugView.cs

示例4: ButtonView

 /// <summary>Constructor</summary>
 public ButtonView(ViewBase owner)
     : base(owner)
 {
     button = new Button();
     _mainWidget = button;
     button.Clicked += OnButtonClick;
     button.SetSizeRequest(80, 36);
     _mainWidget.Destroyed += _mainWidget_Destroyed;
 }
开发者ID:hol353,项目名称:ApsimX,代码行数:10,代码来源:ButtonView.cs

示例5: Render

    public Gtk.Widget Render(INode node)
    {
        Gtk.Button button = new Gtk.Button();

        Event ev = (node as EventNode).Event;

        XmlDocument doc = new XmlDocument();
        doc.LoadXml(ev.RawData);

        string fullFunctionName = doc.DocumentElement.SelectSingleNode("/event/name").InnerText.Trim();
        string functionName = fullFunctionName.Split(new string[] { "::" }, StringSplitOptions.None)[1];

        button.Label = functionName + "()";

        if (ev is IDataTransfer)
        {
            IDataTransfer transfer = ev as IDataTransfer;

            byte[] data = null;

            switch (transfer.Direction)
            {
                case DataTransferDirection.Incoming:
                    data = transfer.IncomingData;
                    break;

                case DataTransferDirection.Outgoing:
                    data = transfer.OutgoingData;
                    break;

                case DataTransferDirection.Both:
                    data = transfer.IncomingData;
                    break;
            }

            try
            {
                string preview = Encoding.UTF8.GetString(data);
                if (preview.Length > 32)
                    button.Label += ": " + preview.Substring(0, 32);
                else
                    button.Label += ": " + preview;
            }
            catch (Exception)
            {
            }
        }

        button.SetSizeRequest((int) node.Allocation.Width, (int) node.Allocation.Height);
        return button;
    }
开发者ID:SayHalou,项目名称:ospy,代码行数:51,代码来源:EventNodeRenderer.cs

示例6: buildWindow

        private void buildWindow()
        {
            //prevent resize on home screen
            this.Resizable = false;

            EventBox labelContainer = new EventBox ();
            Label confirmLoadLabel = new Label (Constants.Constants.confirmFileReloadText);
            //set the style of the label
            Style labelStyle = confirmLoadLabel.Style.Copy();
            labelStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            labelStyle.FontDescription.Size = Constants.Constants.CONFIRM_RELOAD_MESSAGE_SIZE;
            confirmLoadLabel.Style = labelStyle.Copy();

            labelContainer.Add (confirmLoadLabel);
            labelContainer.WidthRequest = 100;

            Button yesButton = new Button (Constants.Constants.YES);
            yesButton.Clicked += new EventHandler (LoadFile);

            Button noButton = new Button (Constants.Constants.NO);
            noButton.Clicked += new EventHandler (CancelRequest);

            //set the style of buttons
            Style buttonStyle = yesButton.Style.Copy ();
            buttonStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            buttonStyle.FontDescription.Size = Constants.Constants.WELCOME_BUTTON_FONT_SIZE;

            yesButton.Style = buttonStyle.Copy();
            noButton.Style = buttonStyle.Copy();

            labelContainer.SetSizeRequest (100, 100);
            yesButton.SetSizeRequest (50, 50);
            noButton.SetSizeRequest (50, 50);

            HBox masterContainer = new HBox ();
            VBox mainContainer = new VBox ();

            HBox buttonContainer = new HBox ();

            buttonContainer.PackStart (yesButton, false, false, 50);
            buttonContainer.PackStart (noButton, false, false, 50);

            mainContainer.PackStart (labelContainer, false, false, 50);
            mainContainer.PackStart (buttonContainer, false, false, 50);

            masterContainer.PackStart (mainContainer, true, true, 100);

            this.Add (masterContainer);
        }
开发者ID:gnikonorov,项目名称:MemoryVisualizer,代码行数:49,代码来源:ConfirmLoadWindow.cs

示例7: buildWindow

        /**
         *  Add in all needed components to our welcome window
         * */
        private void buildWindow()
        {
            //prevent resize on home screen
            this.Resizable = false;

            //create label and import button - put label in event box to allow setting of background
            EventBox labelContainer = new EventBox ();

            Label welcomeLabel = new Label (Constants.Constants.homeWindowWelcomeText);

            //set the style of the label
            Style labelStyle = welcomeLabel.Style.Copy();
            labelStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            labelStyle.FontDescription.Size = Constants.Constants.WELCOME_MESSAGE_FONT_SIZE;
            welcomeLabel.Style = labelStyle.Copy();

            labelContainer.Add (welcomeLabel);
            labelContainer.WidthRequest = 100;

            importDataButton = new Button (Constants.Constants.homeWindowImportButtonText);
            importDataButton.Clicked += new EventHandler(OpenFileTree);

            //set the style of the button
            Style buttonStyle = importDataButton.Style.Copy ();
            buttonStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            buttonStyle.FontDescription.Size = Constants.Constants.WELCOME_BUTTON_FONT_SIZE;
            importDataButton.Style = buttonStyle.Copy();

            welcomeLabel.SetSizeRequest (100, 100);
            importDataButton.SetSizeRequest (100, 100);

            //create container for import button
            HBox masterContainer = new HBox ();
            VBox homeWindowContainer = new VBox (false, 100);

            homeWindowContainer.PackStart (labelContainer, false, false, 50);
            homeWindowContainer.PackStart (importDataButton, false, false, 50);

            masterContainer.PackStart (homeWindowContainer, true, true, 100);

            //set size of containers
            masterContainer.SetSizeRequest (1000, 1000);
            this.SetSizeRequest (1000, 500);
            this.Add (masterContainer);
        }
开发者ID:gnikonorov,项目名称:MemoryVisualizer,代码行数:48,代码来源:HomeWindow.cs

示例8: TabLabel

        public TabLabel(Label label, Gtk.Image icon)
            : base(false, 2)
        {
            this.icon = icon;
            this.PackStart (icon, false, true, 2);

            title = label;
            this.PackStart (title, true, true, 0);

            btn = new Button ();
            btn.Add (new Gtk.Image (GetType().Assembly, "MonoDevelop.Close.png"));
            btn.Relief = ReliefStyle.None;
            btn.SetSizeRequest (18, 18);
            this.PackStart (btn, false, false, 2);
            this.ClearFlag (WidgetFlags.CanFocus);

            this.ShowAll ();
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:18,代码来源:TabLabel.cs

示例9: Screen

		public Screen()
			: base(Gtk.WindowType.Toplevel)
		{
			Build();

			this.SetSizeRequest(500, 100);
			this.DefaultSize = new Gdk.Size(500, 100);

			/* Create a new button */
			buttonLoad = new Button();
			buttonSend = new Button();

			/* Connect the "clicked" signal of the button to our callback */
			buttonLoad.Clicked += new EventHandler(buttonLoad_Clicked);
			buttonLoad.Label = "Load";
			buttonLoad.SetSizeRequest(80, 20);

			buttonSend.Clicked += new EventHandler(buttonSend_Clicked);
			buttonSend.Label = "Send";
			buttonSend.SetSizeRequest(80, 20);

			textBoxLoad = new Entry("image file");
			textBoxLoad.SetSizeRequest(320, 20);
			textBoxSend = new Entry(HolisticWare.SlideShow.BusinessLogic.WebServiceClientProxy.Url);
			textBoxSend.SetSizeRequest(320, 20);

			fix = new Fixed();

			fix.Put(textBoxLoad, 20, 20);
			fix.Put(textBoxSend, 20, 50);
			fix.Put(buttonLoad, 360, 20);
			fix.Put(buttonSend, 360, 50);

			Add(fix);

			this.ShowAll();

			return;
		}
开发者ID:holisticware-admin,项目名称:HolisticWare.PR.DevUG.CKVZ.SlideShow,代码行数:39,代码来源:Screen.cs

示例10: MainClass

        public MainClass()
            : base("Buttons")
        {
            sPort.PortName = "/dev/ttyACM0";
            sPort.BaudRate = 9600;
            sPort.Open ();

            SetDefaultSize (250, 300);
            SetPosition (WindowPosition.Center);
            DeleteEvent += delegate{
                Application.Quit ();
            };

            Fixed fix = new Fixed ();
            Button green = new Button ("Green");
            green.Name = ("Green");
            green.SetSizeRequest(50,30);

            Button red = new Button ("Red");
            red.Name = ("Red");
            red.SetSizeRequest(50,30);

            Button yellow = new Button ("Yellow");
            yellow.Name = ("Yellow");
            yellow.SetSizeRequest(50,30);

            green.Clicked += new EventHandler (OnClick);
            red.Clicked += new EventHandler (OnClick);
            yellow.Clicked += new EventHandler (OnClick);

            fix.Put(green,20,30);
            fix.Put (red, 80, 30);
            fix.Put (yellow, 140, 30);
            Add (fix);
            ShowAll ();
        }
开发者ID:rajenmistry,项目名称:arduino,代码行数:36,代码来源:Main.cs

示例11: DocumentTab

	public DocumentTab (Notebook docTabs) : base ()
	{
		doc_tabs = docTabs;
		InitializeProperties ();
		
		editor = new DocumentEditor ();
		this.Add (editor);
		
		tab_label = new HBox (false, 2);
		title_label = new Label ("Untitled");
		
		// Close tab button
		Button tabClose = new Button ();
		Image img = new Image (Stock.Close, IconSize.SmallToolbar);
		tabClose.Add (img);
		tabClose.Relief = ReliefStyle.None;
		tabClose.SetSizeRequest (23, 23);
		tabClose.Clicked += new EventHandler (OnTabClose);
		
		tab_label.PackStart (title_label, true, true, 0);
		tab_label.PackStart (tabClose, false, false, 2);
		
		tab_label.ShowAll ();
	}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:24,代码来源:DocumentTab.cs

示例12: Photo

        //step 4
        private void Photo()
        {
            //ok, let's check if the user can reach this step, or
            //return to the previous

            Validation.Validator v = new Validation.Validator();
            Contact ct = this.TargetMember.InnerContact;
            v.SetRule(ct.Name, "nombre de contacto", 2, 50);
            v.SetRule(ct.PhoneNumber, "teléfono de contacto", 7, 13, Validation.ValidationRule.Number);
            Validation.ValidationResponse r = v.Run();
            if(!r.Status)
            {
                string s = "";
                for(int i = 0; i < r.Messages.Length; s += r.Messages[i++] + "\n");
                GuiHelper.ShowError(s);
                this.Step -= 1;
                return;
            }

            else if(!(string.IsNullOrEmpty(ct.Name) == string.IsNullOrEmpty(ct.PhoneNumber)))
            {
                GuiHelper.ShowError(this, "Si va a proporcionar los datos de contacto, debe proporcionar ambos");
                this.Step -= 1;
                return;
            }

            //ok, if everything is ok, lets ask for the photo :)
            this.Header = "";
            this.ClearContentBox();
            this.Description = "Introduzca opcionalmente una fotografía para identificar al cliente";

            Button img_button = new Button();
            this.ImageButton = img_button;
            img_button.SetSizeRequest(300, 250);
            img_button.Clicked += this.ChoosePicture;

            if(this.TargetMember.BinImage == null)
                this.CleanImage(null, null);
            else
                this.LoadImage();

            Button clean_button = new Button("Quitar");
            clean_button.Relief = ReliefStyle.None;
            clean_button.Clicked += this.CleanImage;

            LinkButton link = new LinkButton("", "O bien, toma una fotografía");
            link.HasTooltip = false;
            link.FocusOnClick = false;
            link.Clicked += this.TakePicture;

            this.PackWidgetSingle(img_button);
            this.PackWidgetPair(clean_button, link);
            this.ContentVBox.ShowAll();
        }
开发者ID:omarkhd,项目名称:gymk,代码行数:55,代码来源:MemberWizard.cs

示例13: Start

        public void Start()
        {
            window = new Window(WindowType.Toplevel);
            window.SetPosition(WindowPosition.Mouse);
            window.KeepAbove = true;
            window.Resize(200, 150);
            window.Title = "Dimensions";
            window.Deletable = false;

            Fixed fix = new Fixed();

            // width
            widthLabel = new Label();
            widthLabel.Text = "Width";
            fix.Put(widthLabel, 15, 25);

            widthInputEntry = new Entry();
            widthInputEntry.SetSizeRequest(100, 25);
            widthInputEntry.TextInserted += OnlyNumber;
            widthInputEntry.TextInserted += ChangeWidth;
            widthInputEntry.TextDeleted += ChangeWidth;
            fix.Put(widthInputEntry, 80, 20);

            // height
            heightLabel = new Label();
            heightLabel.Text = "Height";
            fix.Put(heightLabel, 15, 75);

            heightInputEntry = new Entry();
            heightInputEntry.SetSizeRequest(100, 25);
            heightInputEntry.TextInserted += OnlyNumber;
            heightInputEntry.TextInserted += ChangeHeight;
            heightInputEntry.TextDeleted += ChangeHeight;
            fix.Put(heightInputEntry, 80, 70);

            // Buttons
            okButton = new Button();
            okButton.Label = "OK";
            okButton.SetSizeRequest(80, 30);
            okButton.Clicked += okButton_Clicked;
            fix.Put(okButton, 10, 110);

            cancelButton = new Button();
            cancelButton.Label = "Cancel";
            cancelButton.SetSizeRequest(80, 30);
            cancelButton.Clicked += cancelButton_Clicked;
            fix.Put(cancelButton, 110, 110);

            window.Add(fix);
            window.ShowAll();

            widthInputEntry.Text = "" + width;
            heightInputEntry.Text = "" + height;
        }
开发者ID:JacquesLucke,项目名称:Collage,代码行数:54,代码来源:DimensionsDialog.cs

示例14: ShowTypeTree

        void ShowTypeTree(string typeName, bool inverse)
        {
            foreach (object child in notebook.Children) {
                ReferenceTreeViewer tree = child as ReferenceTreeViewer;
                if (tree != null && tree.RootTypeName == typeName) {
                    tree.InverseReferences = inverse;
                    notebook.Page = notebook.PageNum (tree);
                    return;
                }
            }

            ReferenceTreeViewer viewer = new ReferenceTreeViewer ();
            viewer.FillType (GetCurrentObjectMap (), typeName);
            viewer.Show ();
            viewer.TypeActivated += delegate {
                ShowTypeTree (viewer.SelectedType, viewer.InverseReferences);
            };
            HBox label = new HBox ();
            label.Spacing = 3;
            label.PackStart (new Gtk.Image ("class", Gtk.IconSize.Menu), false, false, 0);
            label.PackStart (new Gtk.Label (typeName), true, true, 0);
            Button but = new Button (new Gtk.Image (Gtk.Stock.Close, Gtk.IconSize.Menu));
            but.Relief = ReliefStyle.None;
            but.SetSizeRequest (18, 18);
            label.PackStart (but, false, false, 0);
            but.Clicked += delegate {
                notebook.Remove (viewer);
                viewer.Destroy ();
            };
            label.ShowAll ();
            int i = notebook.AppendPage (viewer, label);
            notebook.Page = i;
        }
开发者ID:facemao3,项目名称:heap-shot,代码行数:33,代码来源:ObjectMapViewer.cs

示例15: CreateTabLabel

        private Widget CreateTabLabel(string text)
        {
            Button closeButton = new Button(new Image(closePixbuf));
            closeButton.SetSizeRequest(17,17);
            closeButton.FocusOnClick = false;
            closeButton.CanFocus = false;
            closeButton.Relief = ReliefStyle.None;
            closeButton.Clicked += closeButton_Clicked;

            HBox labelWidget = new HBox();
            labelWidget.PackStart(new Label(text), true, true, 0);
            labelWidget.PackStart(closeButton, true, true, 0);
            labelWidget.CanFocus = false;

            EventBox box = new EventBox();
            box.Add(labelWidget);
            box.ButtonPressEvent += HandleTabButtonPressEvent;

            box.ShowAll();

            return box;
        }
开发者ID:codebutler,项目名称:meshwork,代码行数:22,代码来源:ChatsPage.cs


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