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


C# Button.SetMargin方法代码示例

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


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

示例1: PageLocomotiveProperties

        public PageLocomotiveProperties(Locomotive locomotive)
        {
            this.locomotive = locomotive;

            StackPanel panel = new StackPanel(Orientation.Vertical);
            Child = panel;

            tabs = new TabControl();
            tabs.AddTab(CreateTabCommon());
            tabs.AddTab(CreateTabFunctions());
            panel.Children.Add(tabs);

            StackPanel panelBottom = new StackPanel(Orientation.Horizontal);
            panelBottom.HorizontalAlignment = HorizontalAlignment.Center;
            panel.Children.Add(panelBottom);

            Button btnSave = new Button(Program.FontRegular, "Сохранить", Resources.GetBitmap(Resources.BitmapResources.Save), Program.ButtonTextColor);
            btnSave.SetMargin(2);
            btnSave.VerticalAlignment = VerticalAlignment.Bottom;
            btnSave.HorizontalAlignment = HorizontalAlignment.Center;
            btnSave.Background = Program.ButtonBackground;
            btnSave.Clicked += new EventHandler(btnSave_Clicked);
            panelBottom.Children.Add(btnSave);

            tabs.Height = panel.Parent.Height - btnSave.Height - 8;

            ucWriteBlock writeBlock = new ucWriteBlock();
            writeBlock.VerticalAlignment = VerticalAlignment.Bottom;
            writeBlock.HorizontalAlignment = HorizontalAlignment.Center;
            writeBlock.SetMargin(5, 0, 0, 0);
            writeBlock.WriteClicked += new EventHandler(writeBlock_WriteClicked);
            panelBottom.Children.Add(writeBlock);

            LoadValues();
        }
开发者ID:KonstantinKolesnik,项目名称:Typhoon,代码行数:35,代码来源:PageLocomotiveProperties.cs

示例2: PageNewLayoutItem

        public PageNewLayoutItem()
        {
            //BackgroundStackPanel panel = new BackgroundStackPanel(Orientation.Vertical);
            //panel.Background = Program.PanelBackground;
            //panel.Opacity = Program.PanelOpacity;

            StackPanel panel = new StackPanel(Orientation.Vertical);
            Child = panel;

            itemTypes = new RadioButtonGroup(Orientation.Vertical);
            itemTypes.VerticalAlignment = VerticalAlignment.Center;
            itemTypes.HorizontalAlignment = HorizontalAlignment.Center;
            panel.Children.Add(itemTypes);

            Font font = Program.FontRegular;
            itemTypes.AddButton(new RadioButton(font, "Локомотив"));
            itemTypes.AddButton(new RadioButton(font, "Состав"));
            itemTypes.AddButton(new RadioButton(font, "Стрелка"));
            itemTypes.AddButton(new RadioButton(font, "Сигнал"));
            itemTypes.AddButton(new RadioButton(font, "Поворотный круг"));
            itemTypes.AddButton(new RadioButton(font, "Группа аксессуаров"));
            itemTypes.SelectedIndex = 0;
            //itemTypes.Children[1].SetMargin(0, 0, 0, 15);
            //itemTypes.Children[1].HorizontalAlignment = HorizontalAlignment.Left;

            Button btnOK = new Button(Program.FontRegular, "Добавить", Resources.GetBitmap(Resources.BitmapResources.OK), Program.ButtonTextColor);
            btnOK.SetMargin(2);
            btnOK.VerticalAlignment = VerticalAlignment.Bottom;
            btnOK.HorizontalAlignment = HorizontalAlignment.Center;
            btnOK.Background = Program.ButtonBackground;
            btnOK.Clicked += new EventHandler(btnOK_Clicked);
            panel.Children.Add(btnOK);

            itemTypes.Height = panel.Parent.Height - btnOK.Height - 8;
        }
开发者ID:KonstantinKolesnik,项目名称:Typhoon,代码行数:35,代码来源:PageNewLayoutItem.cs

示例3: ucWriteBlock

        public ucWriteBlock()
        {
            Orientation = Orientation.Horizontal;

            Button btnWrite = new Button(Program.FontRegular, "Записать", null, Program.ButtonTextColor);
            btnWrite.SetMargin(2);
            btnWrite.VerticalAlignment = VerticalAlignment.Center;
            btnWrite.Background = Program.ButtonBackground;
            btnWrite.Clicked += new EventHandler(btnWrite_Clicked);
            Children.Add(btnWrite);

            cbTrackType = new UpDownComboBox(Program.FontRegular, 130);
            cbTrackType.ButtonDown.Background = cbTrackType.ButtonUp.Background = Program.ButtonBackground;
            cbTrackType.VerticalAlignment = VerticalAlignment.Center;
            cbTrackType.Items.Add("На главном");
            cbTrackType.Items.Add("На программном");
            cbTrackType.SelectedIdx = 1;
            Children.Add(cbTrackType);
        }
开发者ID:KonstantinKolesnik,项目名称:Typhoon,代码行数:19,代码来源:ucWriteBlock.cs

示例4: QuaziMessageBox

        public QuaziMessageBox(Font font, int width, string message, MessageBoxButton buttons, Bitmap buttonBackground, Color buttonTextColor, Color textColor, EventHandler Closed)
        {
            Width = width;
            Visibility = Visibility.Hidden;

            this.buttons = buttons;
            onClose = Closed;

            Orientation = Orientation.Vertical;
            HorizontalAlignment = HorizontalAlignment.Center;
            VerticalAlignment = VerticalAlignment.Center;

            txtMessage = new Text(font, message);
            txtMessage.ForeColor = Color.Black;
            txtMessage.HorizontalAlignment = HorizontalAlignment.Center;
            txtMessage.TextAlignment = TextAlignment.Center;
            txtMessage.TextWrap = true;
            txtMessage.SetMargin(3);
            Children.Add(txtMessage);

            StackPanel pnlButtons = new StackPanel(Orientation.Horizontal);
            pnlButtons.HorizontalAlignment = HorizontalAlignment.Center;
            pnlButtons.VerticalAlignment = VerticalAlignment.Bottom;
            Children.Add(pnlButtons);

            btn1 = new Button(font, "", null, buttonTextColor);
            btn1.Background = buttonBackground;
            btn1.ImageSize = 16;
            btn1.HorizontalAlignment = HorizontalAlignment.Center;
            btn1.SetMargin(3);
            btn1.Clicked += new EventHandler(btn1_Clicked);
            pnlButtons.Children.Add(btn1);

            btn2 = new Button(font, "", null, buttonTextColor);
            btn2.Background = buttonBackground;
            btn2.ImageSize = 16;
            btn2.HorizontalAlignment = HorizontalAlignment.Center;
            btn2.SetMargin(3);
            btn2.Clicked += new EventHandler(btn2_Clicked);
            pnlButtons.Children.Add(btn2);

            btn3 = new Button(font, "", null, buttonTextColor);
            btn3.Background = buttonBackground;
            btn3.ImageSize = 16;
            btn3.HorizontalAlignment = HorizontalAlignment.Center;
            btn3.SetMargin(3);
            btn3.Clicked += new EventHandler(btn3_Clicked);
            pnlButtons.Children.Add(btn3);

            switch (buttons)
            {
                case MessageBoxButton.OK:
                    btn1.Text = "OK";
                    btn2.Visibility = btn3.Visibility = Visibility.Collapsed;
                    break;
                case MessageBoxButton.OKCancel:
                    btn1.Text = "OK";
                    btn2.Text = "Отмена";
                    btn3.Visibility = Visibility.Collapsed;
                    break;
                case MessageBoxButton.YesNo:
                    btn1.Text = "Да";
                    btn2.Text = "Нет";
                    btn3.Visibility = Visibility.Collapsed;
                    break;
                case MessageBoxButton.YesNoCancel:
                    btn1.Text = "Да";
                    btn2.Text = "Нет";
                    btn3.Text = "Отмена";
                    break;
            }
        }
开发者ID:KonstantinKolesnik,项目名称:MFE,代码行数:72,代码来源:MessageBox.cs

示例5: MessageBox

        public MessageBox(Font font, int width, string message, MessageBoxButton buttonsSet, Bitmap buttonBackground, Color buttonTextColor, Color textColor)
        {
            Background = new SolidColorBrush(Colors.Black);
            Width = width;
            Visibility = Visibility.Hidden;
            SizeToContent = SizeToContent.Height;

            this.buttonsSet = buttonsSet;

            main = Application.Current.MainWindow;
            modalBlock = new DispatcherFrame();

            StackPanel pnl = new StackPanel(Orientation.Vertical);
            Child = pnl;

            txtMessage = new Text(font, message);
            txtMessage.ForeColor = textColor;
            txtMessage.HorizontalAlignment = HorizontalAlignment.Center;
            txtMessage.TextAlignment = TextAlignment.Center;
            txtMessage.TextWrap = true;
            txtMessage.SetMargin(3);
            pnl.Children.Add(txtMessage);

            StackPanel pnlButtons = new StackPanel(Orientation.Horizontal);
            pnlButtons.HorizontalAlignment = HorizontalAlignment.Center;
            pnlButtons.VerticalAlignment = VerticalAlignment.Bottom;
            pnl.Children.Add(pnlButtons);

            btn1 = new Button(font, "", null, buttonTextColor);
            btn1.Background = buttonBackground;
            btn1.ImageSize = 16;
            btn1.HorizontalAlignment = HorizontalAlignment.Center;
            btn1.SetMargin(3);
            btn1.Clicked += new EventHandler(btn1_Clicked);
            pnlButtons.Children.Add(btn1);

            btn2 = new Button(font, "", null, buttonTextColor);
            btn2.Background = buttonBackground;
            btn2.ImageSize = 16;
            btn2.HorizontalAlignment = HorizontalAlignment.Center;
            btn2.SetMargin(3);
            btn2.Clicked += new EventHandler(btn2_Clicked);
            pnlButtons.Children.Add(btn2);

            btn3 = new Button(font, "", null, buttonTextColor);
            btn3.Background = buttonBackground;
            btn3.ImageSize = 16;
            btn3.HorizontalAlignment = HorizontalAlignment.Center;
            btn3.SetMargin(3);
            btn3.Clicked += new EventHandler(btn3_Clicked);
            pnlButtons.Children.Add(btn3);

            switch (buttonsSet)
            {
                case MessageBoxButton.OK:
                    btn1.Text = "OK";
                    btn2.Visibility = btn3.Visibility = Visibility.Collapsed;
                    break;
                case MessageBoxButton.OKCancel:
                    btn1.Text = "OK";
                    btn2.Text = "Отмена";
                    btn3.Visibility = Visibility.Collapsed;
                    break;
                case MessageBoxButton.YesNo:
                    btn1.Text = "Да";
                    btn2.Text = "Нет";
                    btn3.Visibility = Visibility.Collapsed;
                    break;
                case MessageBoxButton.YesNoCancel:
                    btn1.Text = "Да";
                    btn2.Text = "Нет";
                    btn3.Text = "Отмена";
                    break;
            }

            //Top = (SystemMetrics.ScreenHeight - Height) / 2;
        }
开发者ID:KonstantinKolesnik,项目名称:MFE,代码行数:77,代码来源:MessageBox.cs

示例6: OnInitialize

    protected override void OnInitialize()
    {
        Vector2 winSize = new Vector3( 312.0f, 265.0f );
        maxSize = winSize;
        minSize = winSize;        

        autoRepaintOnSceneChange = true;

        m_root = new Control();
        m_root.SetSize( 100.0f, 100.0f, Control.MetricsUnits.Percentage, Control.MetricsUnits.Percentage );
        m_root.AddDecorator( new StackContent() );

        AddChild( m_root );

        // Input object field
        m_original = new ObjectField( typeof( GameObject ), true, null, "Original" );
        m_original.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_original.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_original.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_original );

        // Rotation pivot point
        m_pivot = new Vector3Field( Vector3.zero, "Pivot:" );
        m_pivot.SetHeight( 40.0f, Control.MetricsUnits.Pixel );
        m_pivot.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_pivot.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_pivot );

        // Transform control
        m_transform = new TransformControl();
        m_transform.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_transform.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_transform );

        // Count field
        m_count = new IntField( 1, "Duplicate Count:" );
        m_count.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_count.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_count.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_count );

        // Space field
        m_space = new EnumDropdown( Space.World, "Space:" );
        m_space.SetHeight( 26.0f, Control.MetricsUnits.Pixel );
        m_space.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_space.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_root.AddChild( m_space );

        // Duplicate button
        m_duplicate = new Button( "Duplicate" );
        m_duplicate.SetWidth( 100.0f, Control.MetricsUnits.Percentage );
        m_duplicate.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f );
        m_duplicate.Enabled = false;
        m_root.AddChild( m_duplicate );

        // Events
        m_original.ValueChange += m_original_ValueChange;
        m_count.ValueChange += m_count_ValueChange;
        m_duplicate.Clicked += m_duplicate_Clicked;

        SceneView.onSceneGUIDelegate += SceneViewGUI;
    }
开发者ID:ChelseaLing,项目名称:UForms,代码行数:62,代码来源:DuplicateSpecial.cs

示例7: CreateTabCommon

        private Tab CreateTabCommon()
        {
            Tab tab = new Tab(Program.FontRegular, "tabCommon", "Общие", null);
            tab.Background = Program.ButtonBackground;
            tab.ForeColor = Program.LabelTextColor;
            tab.IsSelected = true;

            StackPanel panel = new StackPanel(Orientation.Vertical);
            panel.SetMargin(3);

            //BackgroundStackPanel panel = new BackgroundStackPanel(Orientation.Vertical);
            //panel.Background = Program.PanelBackground;
            //panel.Opacity = Program.PanelOpacity;
            //panel.Height = 150;
            //panel.SetMargin(3);

            tab.Content = panel;

            Text txt;
            StackPanel p;

            txt = new Text(Program.FontRegular, "Имя:");
            txt.ForeColor = Program.LabelTextColor;

            p = new StackPanel(Orientation.Horizontal);

            txtName = new Text(Program.FontRegular, "");
            txtName.ForeColor = Program.LabelTextColor;
            txtName.VerticalAlignment = VerticalAlignment.Center;
            p.Children.Add(txtName);

            Button btnKeyboard = new Button(Program.FontRegular, " ... ", null, Program.ButtonTextColor);
            btnKeyboard.SetMargin(2, 0, 0, 0);
            btnKeyboard.VerticalAlignment = VerticalAlignment.Center;
            btnKeyboard.Background = Program.ButtonBackground;
            //btnKeyboard.Clicked += new EventHandler(btnSave_Clicked);
            p.Children.Add(btnKeyboard);

            panel.Children.Add(new ParameterValue(txt, p));

            txt = new Text(Program.FontRegular, "Протокол:");
            txt.ForeColor = Program.LabelTextColor;
            cbProtocol = new UpDownComboBox(Program.FontRegular, 120);
            cbProtocol.ButtonDown.Background = cbProtocol.ButtonUp.Background = Program.ButtonBackground;
            cbProtocol.Items.Add("DCC 14");
            cbProtocol.Items.Add("DCC 28");
            cbProtocol.Items.Add("DCC 128");
            cbProtocol.Items.Add("Selectrix");
            cbProtocol.Items.Add("Motorola 14");
            cbProtocol.Items.Add("Motorola 27");
            cbProtocol.Items.Add("Motorola 28");
            cbProtocol.Items.Add("Motorola Fx 14");
            panel.Children.Add(new ParameterValue(txt, cbProtocol));

            txt = new Text(Program.FontRegular, "Адрес:");
            txt.ForeColor = Program.LabelTextColor;
            UpDownComboBox cbProgCurrentThreshold = new UpDownComboBox(Program.FontRegular, 90);
            cbProgCurrentThreshold.ButtonDown.Background = cbProgCurrentThreshold.ButtonUp.Background = Program.ButtonBackground;
            cbProgCurrentThreshold.Items.Add(3);
            panel.Children.Add(new ParameterValue(txt, cbProgCurrentThreshold));

            //txt = new Text(Program.FontRegular, "Выкл. при коротком замыкании во внешн. бустерах:");
            //txt.ForeColor = Program.TextColor;
            //txt.TextWrap = true;
            //chbShutdownOnExternalShortCircuit = new Checkbox(Program.FontRegular);
            //panel.Children.Add(new ParameterValue(txt, chbShutdownOnExternalShortCircuit));

            //txt = new Text(Program.FontRegular, "Калибровка экрана:");
            //txt.ForeColor = Program.TextColor;
            //Button btnCalibrate = new Button(Program.FontRegular, "Калибровать", Resources.GetBitmap(Resources.BitmapResources.Calibrate), Colors.White);
            //btnCalibrate.ImageSize = 16;
            //btnCalibrate.Width = 90;
            //btnCalibrate.BackgroundImage = Program.ButtonBackground;
            //btnCalibrate.Clicked += new EventHandler(btnCalibrate_Clicked);
            //panel.Children.Add(new ParameterValue(txt, btnCalibrate));

            return tab;
        }
开发者ID:KonstantinKolesnik,项目名称:Typhoon,代码行数:78,代码来源:PageLocomotiveProperties.cs


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