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


C# EventBox.SetSizeRequest方法代码示例

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


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

示例1: 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

示例2: CreateStatusbar

        private void CreateStatusbar()
        {
            statusBar = new Toolbar();
            statusBar.ShowArrow = false;
            statusBar.ToolbarStyle = ToolbarStyle.BothHoriz;
            statusBar.ExposeEvent +=  StatusBarExposeEvent;

            statusLabel = new Label();
            statusLabel.Xalign = 0;
            statusLabel.Xpad = 6;

            ToolItem statusLabelItem = new ToolItem();
            Alignment statusAlign = new Alignment(0.5f, 0.5f, 1.0f, 1.0f);
            statusLabelItem.Add(statusLabel);
            statusLabelItem.Expand = true;
            statusBar.Insert(statusLabelItem, -1);
            statusLabelItem.ShowAll();

            taskStatusIcon = new Hyena.Widgets.AnimatedImage();
            taskStatusIcon.Pixbuf = Gui.LoadIcon(22, "process-working");
            taskStatusIcon.FrameHeight = 22;
            taskStatusIcon.FrameWidth = 22;
            taskStatusIcon.Load();

            EventBox taskStatusIconBox = new EventBox();
            taskStatusIconBox.MotionNotifyEvent += delegate {
                UpdateTaskStatusIcon();
            };
            taskStatusIconBox.ButtonReleaseEvent += delegate {
                IndexingStatusWindow.Instance.Show();
            };
            taskStatusIconBox.SizeAllocated += delegate (object o, SizeAllocatedArgs args) {
                statusAlign.LeftPadding = (uint)args.Allocation.Width;
            };
            taskStatusIconBox.SetSizeRequest(22, 22);
            taskStatusIconBox.Add(taskStatusIcon);
            taskStatusIconBox.Show();

            ToolItem taskStatusIconItem = new ToolItem();
            taskStatusIconItem.Add(taskStatusIconBox);
            statusBar.Insert(taskStatusIconItem, -1);
            taskStatusIconItem.Show();

            mainVBox.PackStart(statusBar, false, false, 0);

            UpdateTaskStatusIcon();
            UpdateStatusText();
        }
开发者ID:codebutler,项目名称:meshwork,代码行数:48,代码来源:MainWindow.cs

示例3: MakeOccupiedColorContainer

    private EventBox MakeOccupiedColorContainer()
    {
        EventBox occupiedColorContainer = new EventBox ();
        occupiedColorContainer.ModifyBg (StateType.Normal, BLACK_COLOR);
        occupiedColorContainer.SetSizeRequest (Constants.Constants.SQUARE_DIMENSIONS, Constants.Constants.SQUARE_DIMENSIONS);

        return occupiedColorContainer;
    }
开发者ID:gnikonorov,项目名称:MemoryVisualizer,代码行数:8,代码来源:MainWindow.cs

示例4: MakeFreeColorContainer

    private EventBox MakeFreeColorContainer()
    {
        EventBox freeColorContainer = new EventBox ();
        freeColorContainer.ModifyBg (StateType.Normal, GRAY_COLOR);
        freeColorContainer.SetSizeRequest (Constants.Constants.SQUARE_DIMENSIONS, Constants.Constants.SQUARE_DIMENSIONS);

        return freeColorContainer;
    }
开发者ID:gnikonorov,项目名称:MemoryVisualizer,代码行数:8,代码来源:MainWindow.cs

示例5: addHeader

    /**
     *  Adds in header to window
     *  Header contains title = "Explicit Free List Visualizer Tool"
     *  Second line then is "mm/dd/yy - hh:mm:ss(am/pm)
     *
     * */
    private void addHeader()
    {
        //init the top menu pain
        topHeader = new VBox ();

        //make button container and buttons
        HBox buttonPane = new HBox ();
        quitButton = new Button ("Quit");
        quitButton.Style = buttonStyle;
        quitButton.Clicked += new EventHandler(ExitApplication);

        loadFileButton = new Button("Load File");
        loadFileButton.Style = buttonStyle;
        loadFileButton.Clicked += new EventHandler(LoadNewFile);

        buttonPane.PackStart (quitButton, false, false, 10);
        buttonPane.PackStart (loadFileButton, false, false, 10);

        //make the labels for the title and date time
        //construct date time
        string dateTimeString;
        buildTimeString (out dateTimeString);

        //create labels for date and title
        //create containers for them
        EventBox titleContainer = new EventBox ();
        Label titleLabel = new Label (Constants.Constants.MainScreenHeaderText);
        titleLabel.Style = labelStyle.Copy ();
        titleContainer.Add (titleLabel);

        EventBox dateContainer = new EventBox ();
        Label dateLabel = new Label (dateTimeString);
        dateLabel.Style = labelStyle.Copy ();
        dateContainer.Add (dateLabel);

        //set their sizes
        titleContainer.SetSizeRequest (Constants.Constants.APPLICATION_WIDTH, Constants.Constants.TITLE_HEIGHT);
        titleContainer.SetSizeRequest (Constants.Constants.APPLICATION_WIDTH, Constants.Constants.TITLE_HEIGHT);

        //add them into top header and then the main contianers
        topHeader.PackStart (titleContainer, false, true, 0);
        topHeader.PackStart (dateContainer, false, true, 0);
        topHeader.PackStart (buttonPane, false, true, 10);

        masterContainer.PackStart (topHeader, false, true, 0);
    }
开发者ID:gnikonorov,项目名称:MemoryVisualizer,代码行数:52,代码来源:MainWindow.cs

示例6: SwitchTitleView

 /// <summary>
 /// See SwitchContentView.
 /// This is an awkward solution and should be refactored.
 /// The only other way I can think if is creating two different
 /// EventHandlers, and they call with different parameters which
 /// Label and TextView to switch (Content or Title).
 /// </summary>
 /// <param name='edit'>
 /// If true, paint a TextView that can be edited.
 /// If false, paint a Label that displays memo.
 /// </param>
 public void SwitchTitleView(bool edit)
 {
     if (edit) {
         // Removing the label
         _titleLabelListener.Destroy();
         // Setting up the textview
         _titleTextView = new TextView ();
         _titleTextView.FocusInEvent += new FocusInEventHandler(MemoTextViewGotFocus);
         _titleTextView.FocusOutEvent += new FocusOutEventHandler(MemoTitleTextViewLostFocus);
         TextBuffer contentBuffer = _titleTextView.Buffer;
         contentBuffer.Text = this._item.GetTitle();
         _titleTextView.SetSizeRequest (200, 140);
         _titleTextView.Justification = Justification.Fill;
         _titleTextView.WrapMode = WrapMode.Word;
         _titleAlignment.Add (_titleTextView);
         _titleTextView.GrabFocus();
     } else {
         // Saving information from textview and removing it
         this._item.SetTitle(_titleTextView.Buffer.Text);
         Console.WriteLine ("Setting memo title to " + _titleTextView.Buffer.Text);
         _titleTextView.Destroy();
         // Creating label
         _titleLabel = new Label();
         _titleLabel.Text = this._item.GetTitle ();
         _titleLabel.SetSizeRequest (200, 80);
         _titleLabel.SetAlignment (0, 0);
         _titleLabel.LineWrap = true;
         _titleLabel.Justify = Justification.Fill;
         // Label listener
         _titleLabelListener = new EventBox ();
         _titleLabelListener.ButtonPressEvent += new ButtonPressEventHandler (MemoTitlePressHandler);
         _titleLabelListener.Add (_titleLabel);
         _titleLabelListener.SetSizeRequest(200, 80);
         _titleAlignment.Add (_titleLabelListener);
     }
     this._container.ShowAll();
 }
开发者ID:tomgud,项目名称:Memorize,代码行数:48,代码来源:MemoItemDisplay.cs


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