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


C# Dialog.SetSizeRequest方法代码示例

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


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

示例1: OnSignupEvent

    private void OnSignupEvent( Hashtable form )
    {
        if( ((string)form[ "action" ]).Equals( "msg" ) )
        {
            new AlertDialog( this.MainWindow, AlertType.Info,
                             (string)form[ "title" ],
                             (string)form[ "msg" ] );
        }
        else
        {
            this.signupdata = form;

            Dialog dlg = new Dialog();
            dlg.Modal = true;
            dlg.Title = (string)form[ "title" ];
            dlg.SetSizeRequest( 500, -1 );

            HBox split = new HBox();
            dlg.VBox.Add( split );
            VBox left = new VBox( true, 0 );
            VBox right = new VBox( true, 0 );
            split.PackStart( left, false, false, 5 );
            split.PackEnd( right, true, true, 10 );

            NameValueCollection fields =
                (NameValueCollection)form[ "fields" ];
            Hashtable data = (Hashtable)form[ "data" ];

            foreach( string Key in fields.AllKeys )
            {
                Hashtable fd = (Hashtable)data[ Key ];

                string Name = Key.Substring( 0, 1 ).ToUpper() +
                              Key.Substring( 1 ) + ":";

                Label lbl = new Label( Name );
                lbl.SetAlignment( 0, (float)0.5 );
                left.PackStart( lbl, false, false, 5 );

                if( fields[ Key ].Equals( "TextEditView" ) )
                {
                    Entry ent = new Entry();
                    ent.Name = Key;
                    ent.ActivatesDefault = true;
                    if( fd[ "isPassword" ] != null )
                        ent.Visibility = false;
                    if( fd[ "value" ] != null )
                        ent.Text = (string)fd[ "value" ];
                    right.PackStart( ent, false, false, 5 );
                }
                else if( fields[ Key ].Equals( "PopupButtonView" ) )
                {
                    ComboBox cbox = ComboBox.NewText();
                    cbox.WrapWidth = 5;
                    cbox.Name = Key;
                    if( fd[ "menuItems" ] != null )
                    {
                        string menuItems = (string)fd[ "menuItems" ];
                        foreach( string Value in menuItems.Split( ',' ) )
                            cbox.AppendText( Value );
                        if( fd[ "value" ] != null &&
                            (string)fd[ "value" ] != String.Empty )
                        {
                            cbox.Active = Convert.ToInt32( fd[ "value" ] ) - 1;
                        }
                        else
                        {
                            cbox.Active = 0;
                        }
                    }
                    right.PackStart( cbox, false, false, 5 );
                }
                else if( fields[ Key ].Equals( "ComboControlView" ) )
                {
                    ComboBoxEntry cboxe = ComboBoxEntry.NewText();
                    cboxe.WrapWidth = 5;
                    cboxe.Name = Key;
                    if( fd[ "menuItems" ] != null )
                    {
                        string menuItems = (string)fd[ "menuItems" ];
                        foreach( string Value in menuItems.Split( ',' ) )
                            cboxe.AppendText( Value );
                    }
                    if( fd[ "value" ] != null )
                        ((Entry)cboxe.Child).Text = (string)fd[ "value" ];
                    right.PackStart( cboxe, false, false, 5 );
                }
                else if( fields[ Key ].Equals( "CheckboxView" ) )
                {
                    CheckButton cbtn = new CheckButton();
                    cbtn.Name = Key;
                    if( fd[ "value" ] != null &&
                        (string)fd[ "value" ] != String.Empty )
                    {
                        int v = Convert.ToInt32( (string)fd[ "value" ] );
                        cbtn.Active = v == 1;
                    }
                    right.PackStart( cbtn, false, false, 5 );
                }
            }
//.........这里部分代码省略.........
开发者ID:kidaa,项目名称:aur,代码行数:101,代码来源:SharpMusique.cs

示例2: OnPreferences

    private void OnPreferences( object o, EventArgs args )
    {
        if( prefsdlg == null )
        {
            Button btn;
            HBox split;
            VBox left, right;
            Button songdirbtn;

            prefsdlg = new Dialog();
            prefsdlg.Modal = true;
            prefsdlg.Title = "SharpMusique Preferences";
            prefsdlg.SetSizeRequest( 500, -1 );

            split = new HBox();
            prefsdlg.VBox.Add( split );
            left = new VBox( true, 0 );
            right = new VBox( true, 0 );
            split.PackStart( left, false, false, 5 );
            split.PackEnd( right, true, true, 10 );

            songdirbtn = new Button( "Song Folder: " );
            songdirbtn.Clicked += new EventHandler( OnSongDirSelected );

            songdirentry = new Entry();

            left.PackStart( songdirbtn, false, false, 10 );
            right.PackStart( songdirentry, false, false, 10 );

            btn = new Button( "Cancel" );
            prefsdlg.AddActionWidget( btn, ResponseType.Cancel );

            btn = new Button( "Save" );
            prefsdlg.AddActionWidget( btn, ResponseType.Ok );

            prefsdlg.Response += new ResponseHandler( OnPreferencesResponse );
        }

        songdirentry.Text = strSongDir;

        prefsdlg.TransientFor = this.MainWindow;
        prefsdlg.SetPosition( WindowPosition.CenterOnParent );

        prefsdlg.ShowAll();
        prefsdlg.Run();
    }
开发者ID:kidaa,项目名称:aur,代码行数:46,代码来源:SharpMusique.cs


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