标题:c# 能实现 改变 窗体 上控件的 大小 等属性吗
只看楼主
鸿硕
Rank: 5Rank: 5
来 自:北京海淀
等 级:职业侠客
帖 子:211
专家分:309
注 册:2009-10-11
结帖率:85.71%
已结贴  问题点数:8 回复次数:3 
c# 能实现 改变 窗体 上控件的 大小 等属性吗
今天,遇到了这样的问题 就是  ,让用户自定义 窗体上控件的 大小 ,坐标啥的 ,这些 c# 能实现吗 ?如果 可以实现
 请大家 帮一下,感谢不尽···
搜索更多相关主题的帖子: 用户 
2011-04-25 17:15
qq1023569223
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:湖南科技大学
等 级:贵宾
威 望:26
帖 子:2753
专家分:13404
注 册:2010-12-22
得分:0 
程序代码:
namespace MusicPlayer
{
    partial class Form1
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private  components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new ();
             resources = new (typeof(Form1));
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.OpenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.AddToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.AddSingleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.AddMoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.delListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.delSingleSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.delAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.ExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.ModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.SToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.ReplayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.RandomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.myPlyer = new AxWMPLib.AxWindowsMediaPlayer();
            this.label1 = new System.Windows.Forms.Label();
            this.btnBE = new System.Windows.Forms.Button();
            this.btnStop = new System.Windows.Forms.Button();
            this.btnSlient = new System.Windows.Forms.Button();
            this.btnBack = new System.Windows.Forms.Button();
            this.btnForward = new System.Windows.Forms.Button();
            this.btnExit = new System.Windows.Forms.Button();
            this.btnPre = new System.Windows.Forms.Button();
            this.btnPlay = new System.Windows.Forms.Button();
            this.btnNext = new System.Windows.Forms.Button();
            this.btRemove = new System.Windows.Forms.Button();
            this.btnDelete = new System.Windows.Forms.Button();
            this.btnAdd = new System.Windows.Forms.Button();
            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.menuStrip1.SuspendLayout();
            (()(this.myPlyer)).BeginInit();
            this.SuspendLayout();
            //
            // menuStrip1
            //
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.FileToolStripMenuItem,
            this.ModeToolStripMenuItem});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new System.Drawing.Size(709, 24);
            this.menuStrip1.TabIndex = 1;
            this.menuStrip1.Text = "menuStrip1";
            //
            // FileToolStripMenuItem
            //
            this.FileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.OpenToolStripMenuItem,
            this.AddToolStripMenuItem,
            this.delListToolStripMenuItem,
            this.ExitToolStripMenuItem});
            this.FileToolStripMenuItem.Name = "FileToolStripMenuItem";
            this.FileToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
            this.FileToolStripMenuItem.Size = new System.Drawing.Size(77, 20);
            this.FileToolStripMenuItem.Text = "文件(&File)";
            //
            // OpenToolStripMenuItem
            //
            this.OpenToolStripMenuItem.Name = "OpenToolStripMenuItem";
            this.OpenToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
            this.OpenToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
            this.OpenToolStripMenuItem.Text = "打开文件(&Open)";
            this.OpenToolStripMenuItem.Click += new System.EventHandler(this.OpenToolStripMenuItem_Click);
            //
            // AddToolStripMenuItem
            //
            this.AddToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.AddSingleToolStripMenuItem,
            this.AddMoreToolStripMenuItem});
            this.AddToolStripMenuItem.Name = "AddToolStripMenuItem";
            this.AddToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
            this.AddToolStripMenuItem.Text = "添加文件.....";
            //
            // AddSingleToolStripMenuItem
            //
            this.AddSingleToolStripMenuItem.Name = "AddSingleToolStripMenuItem";
            this.AddSingleToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
            this.AddSingleToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
            this.AddSingleToolStripMenuItem.Text = "添加单文件(&Add)";
            this.AddSingleToolStripMenuItem.Click += new System.EventHandler(this.AddSingleToolStripMenuItem_Click);
            //
            // AddMoreToolStripMenuItem
            //
            this.AddMoreToolStripMenuItem.Name = "AddMoreToolStripMenuItem";
            this.AddMoreToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.A)));
            this.AddMoreToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
            this.AddMoreToolStripMenuItem.Text = "添加文件夹(&Add)";
            this.AddMoreToolStripMenuItem.Click += new System.EventHandler(this.AddMoreToolStripMenuItem_Click);
            //
            // delListToolStripMenuItem
            //
            this.delListToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.delSingleSToolStripMenuItem,
            this.delAllToolStripMenuItem});
            this.delListToolStripMenuItem.Name = "delListToolStripMenuItem";
            this.delListToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
            this.delListToolStripMenuItem.Text = "删除列表.....";
            //
            // delSingleSToolStripMenuItem
            //
            this.delSingleSToolStripMenuItem.Name = "delSingleSToolStripMenuItem";
            this.delSingleSToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
            this.delSingleSToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
            this.delSingleSToolStripMenuItem.Text = "移除单个(&Del)";
            this.delSingleSToolStripMenuItem.Click += new System.EventHandler(this.btRemove_Click);
            //
            // delAllToolStripMenuItem
            //
            this.delAllToolStripMenuItem.Name = "delAllToolStripMenuItem";
            this.delAllToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D)));
            this.delAllToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
            this.delAllToolStripMenuItem.Text = "移除全部(&Del)";
            this.delAllToolStripMenuItem.Click += new System.EventHandler(this.delAllToolStripMenuItem_Click);
            //
            // ExitToolStripMenuItem
            //
            this.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem";
            this.ExitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
            this.ExitToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
            this.ExitToolStripMenuItem.Text = "退出程序(E&xit)";
            //
            // ModeToolStripMenuItem
            //
            this.ModeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.SToolStripMenuItem,
            this.ReplayToolStripMenuItem,
            this.RandomToolStripMenuItem});
            this.ModeToolStripMenuItem.Name = "ModeToolStripMenuItem";
            this.ModeToolStripMenuItem.Size = new System.Drawing.Size(77, 20);
            this.ModeToolStripMenuItem.Text = "模式(&Mode)";
            //
            // SToolStripMenuItem
            //
            this.SToolStripMenuItem.Name = "SToolStripMenuItem";
            this.SToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
            this.SToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
            this.SToolStripMenuItem.Text = "顺序播放(&S)";
            this.SToolStripMenuItem.Click += new System.EventHandler(this.SToolStripMenuItem_Click);
            //
            // ReplayToolStripMenuItem
            //
            this.ReplayToolStripMenuItem.Name = "ReplayToolStripMenuItem";
            this.ReplayToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));
            this.ReplayToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
            this.ReplayToolStripMenuItem.Text = "单曲循环(&R)";
            this.ReplayToolStripMenuItem.Click += new System.EventHandler(this.ReplayToolStripMenuItem_Click);
            //
            // RandomToolStripMenuItem
            //
            this.RandomToolStripMenuItem.Name = "RandomToolStripMenuItem";
            this.RandomToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.R)));
            this.RandomToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
            this.RandomToolStripMenuItem.Text = "随机播放(&R)";
            this.RandomToolStripMenuItem.Click += new System.EventHandler(this.RandomToolStripMenuItem_Click);
            //
            // openFileDialog1
            //
            this.openFileDialog1.DefaultExt = "mp3";
            this.openFileDialog1.Filter = "mp3音乐文件|*.mp3";
            this.openFileDialog1.Title = "打开文件";
            //
            // listBox1
            //
            this.listBox1.FormattingEnabled = true;
            this.listBox1.ItemHeight = 12;
            this.listBox1.Location = new System.Drawing.Point(346, 38);
            this.listBox1.Name = "listBox1";
            this.listBox1.Size = new System.Drawing.Size(350, 208);
            this.listBox1.TabIndex = 2;
            this.listBox1.DoubleClick += new System.EventHandler(this.listBox1_DoubleClick);
            //
            // myPlyer
            //
            this.myPlyer.Enabled = true;
            this.myPlyer.Location = new System.Drawing.Point(12, 38);
            this.myPlyer.Name = "myPlyer";
            this.myPlyer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("myPlyer.OcxState")));
            this.myPlyer.Size = new System.Drawing.Size(308, 207);
            this.myPlyer.TabIndex = 0;
            this.myPlyer.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(this.axWindowsMediaPlayer1_PlayStateChange);
            //
            // label1
            //
            this.label1.Location = new System.Drawing.Point(12, 357);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(684, 18);
            this.label1.TabIndex = 3;
            //
            // btnBE
            //
            this.btnBE.Location = new System.Drawing.Point(24, 263);
            this.btnBE.Name = "btnBE";
            this.btnBE.Size = new System.Drawing.Size(75, 23);
            this.btnBE.TabIndex = 4;
            this.btnBE.Text = "开始/暂停";
            this.btnBE.UseVisualStyleBackColor = true;
            this.btnBE.Click += new System.EventHandler(this.btnBE_Click);
            //
            // btnStop
            //
            this.btnStop.Location = new System.Drawing.Point(124, 263);
            this.btnStop.Name = "btnStop";
            this.btnStop.Size = new System.Drawing.Size(75, 23);
            this.btnStop.TabIndex = 5;
            this.btnStop.Text = "停止";
            this.btnStop.UseVisualStyleBackColor = true;
            this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
            //
            // btnSlient
            //
            this.btnSlient.Location = new System.Drawing.Point(221, 263);
            this.btnSlient.Name = "btnSlient";
            this.btnSlient.Size = new System.Drawing.Size(75, 23);
            this.btnSlient.TabIndex = 6;
            this.btnSlient.Text = "静音";
            this.btnSlient.UseVisualStyleBackColor = true;
            this.btnSlient.Click += new System.EventHandler(this.btnSlient_Click);
            //
            // btnBack
            //
            this.btnBack.Location = new System.Drawing.Point(24, 316);
            this.btnBack.Name = "btnBack";
            this.btnBack.Size = new System.Drawing.Size(75, 23);
            this.btnBack.TabIndex = 7;
            this.btnBack.Text = "后退";
            this.btnBack.UseVisualStyleBackColor = true;
            this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
            //
            // btnForward
            //
            this.btnForward.Location = new System.Drawing.Point(124, 316);
            this.btnForward.Name = "btnForward";
            this.btnForward.Size = new System.Drawing.Size(75, 23);
            this.btnForward.TabIndex = 8;
            this.btnForward.Text = "前进";
            this.btnForward.UseVisualStyleBackColor = true;
            this.btnForward.Click += new System.EventHandler(this.btnForward_Click);
            //
            // btnExit
            //
            this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnExit.Location = new System.Drawing.Point(221, 316);
            this.btnExit.Name = "btnExit";
            this.btnExit.Size = new System.Drawing.Size(75, 23);
            this.btnExit.TabIndex = 9;
            this.btnExit.Text = "退出";
            this.btnExit.UseVisualStyleBackColor = true;
            this.btnExit.Click += new System.EventHandler(this.ExitToolStripMenuItem_Click);
            //
            // btnPre
            //
            this.btnPre.Location = new System.Drawing.Point(357, 263);
            this.btnPre.Name = "btnPre";
            this.btnPre.Size = new System.Drawing.Size(75, 23);
            this.btnPre.TabIndex = 10;
            this.btnPre.Text = "上一曲";
            this.btnPre.UseVisualStyleBackColor = true;
            this.btnPre.Click += new System.EventHandler(this.btnPre_Click);
            //
            // btnPlay
            //
            this.btnPlay.Location = new System.Drawing.Point(480, 263);
            this.btnPlay.Name = "btnPlay";
            this.btnPlay.Size = new System.Drawing.Size(75, 23);
            this.btnPlay.TabIndex = 11;
            this.btnPlay.Text = "播放";
            this.toolTip1.SetToolTip(this.btnPlay, "播放列表中选中的音乐文件");
            this.btnPlay.UseVisualStyleBackColor = true;
            this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click);
            //
            // btnNext
            //
            this.btnNext.Location = new System.Drawing.Point(605, 263);
            this.btnNext.Name = "btnNext";
            this.btnNext.Size = new System.Drawing.Size(75, 23);
            this.btnNext.TabIndex = 12;
            this.btnNext.Text = "下一曲";
            this.btnNext.UseVisualStyleBackColor = true;
            this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
            //
            // btRemove
            //
            this.btRemove.Location = new System.Drawing.Point(357, 316);
            this.btRemove.Name = "btRemove";
            this.btRemove.Size = new System.Drawing.Size(75, 23);
            this.btRemove.TabIndex = 13;
            this.btRemove.Text = "移除";
            this.toolTip1.SetToolTip(this.btRemove, "把选中的音乐文件从播放列表中移除");
            this.btRemove.UseVisualStyleBackColor = true;
            this.btRemove.Click += new System.EventHandler(this.btRemove_Click);
            //
            // btnDelete
            //
            this.btnDelete.Location = new System.Drawing.Point(480, 316);
            this.btnDelete.Name = "btnDelete";
            this.btnDelete.Size = new System.Drawing.Size(75, 23);
            this.btnDelete.TabIndex = 14;
            this.btnDelete.Text = "删除";
            this.toolTip1.SetToolTip(this.btnDelete, "把选中的音乐文件从播放列表中移除并删除该文件");
            this.btnDelete.UseVisualStyleBackColor = true;
            this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
            //
            // btnAdd
            //
            this.btnAdd.Location = new System.Drawing.Point(605, 316);
            this.btnAdd.Name = "btnAdd";
            this.btnAdd.Size = new System.Drawing.Size(75, 23);
            this.btnAdd.TabIndex = 15;
            this.btnAdd.Text = "添加";
            this.toolTip1.SetToolTip(this.btnAdd, "添加音乐文件到播放列表");
            this.btnAdd.UseVisualStyleBackColor = true;
            this.btnAdd.Click += new System.EventHandler(this.AddSingleToolStripMenuItem_Click);
            //
            // Form1
            //
            this.AcceptButton = this.btnPlay;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.btnExit;
            this.ClientSize = new System.Drawing.Size(709, 383);
            this.Controls.Add(this.btnAdd);
            this.Controls.Add(this.btnDelete);
            this.Controls.Add(this.btRemove);
            this.Controls.Add(this.btnNext);
            this.Controls.Add(this.btnPlay);
            this.Controls.Add(this.btnPre);
            this.Controls.Add(this.btnExit);
            this.Controls.Add(this.btnForward);
            this.Controls.Add(this.btnBack);
            this.Controls.Add(this.btnSlient);
            this.Controls.Add(this.btnStop);
            this.Controls.Add(this.btnBE);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.listBox1);
            this.Controls.Add(this.myPlyer);
            this.Controls.Add(this.menuStrip1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MainMenuStrip = this.menuStrip1;
            this.MaximizeBox = false;
            this.MaximumSize = new System.Drawing.Size(715, 415);
            this.MinimumSize = new System.Drawing.Size(715, 415);
            this.Name = "Form1";
            this.Text = "My MusicPlayer";
            this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
            this.Load += new System.EventHandler(this.Form1_Load);
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            (()(this.myPlyer)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.ToolStripMenuItem FileToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem OpenToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem AddToolStripMenuItem;
        private System.Windows.Forms.OpenFileDialog openFileDialog1;
        private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
        private System.Windows.Forms.ListBox listBox1;
        private System.Windows.Forms.ToolStripMenuItem AddSingleToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem AddMoreToolStripMenuItem;
        private AxWMPLib.AxWindowsMediaPlayer myPlyer;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btnBE;
        private System.Windows.Forms.Button btnStop;
        private System.Windows.Forms.Button btnSlient;
        private System.Windows.Forms.Button btnBack;
        private System.Windows.Forms.Button btnForward;
        private System.Windows.Forms.Button btnExit;
        private System.Windows.Forms.Button btnPre;
        private System.Windows.Forms.Button btnPlay;
        private System.Windows.Forms.Button btnNext;
        private System.Windows.Forms.Button btRemove;
        private System.Windows.Forms.Button btnDelete;
        private System.Windows.Forms.Button btnAdd;
        private System.Windows.Forms.ToolTip toolTip1;
        private System.Windows.Forms.ToolStripMenuItem delListToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem ExitToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem delSingleSToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem delAllToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem ModeToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem SToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem ReplayToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem RandomToolStripMenuItem;
    }
}

系统自动生成的窗体上的控件布局的代码,看看就知道怎么办啦!

   唯实惟新 至诚致志
2011-04-25 18:53
小小哥
Rank: 4
等 级:业余侠客
帖 子:139
专家分:224
注 册:2010-11-28
得分:0 
可以在load里直接自己写一些属性,比如lable.text="123";都是可以自己写的
2011-04-28 11:20
xydddaxia
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:33
帖 子:466
专家分:2307
注 册:2009-3-20
得分:8 
用propertyGrid,不解释..

站在春哥的肩膀上
2011-04-28 13:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-337872-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.151892 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved