1

Visual C# でラジオ ボタンを追加すると、ラジオ ボタンのテキスト名が完全に右側に配置されます。ラジオボタンを動的に作成し、いくつかのプロパティなどを指定すると、デバッグして表示すると、ラジオボタンのテキストまたは名前がラジオボタンの右側にわずかにシフトされますか? パディングなどを含むいくつかのプロパティを見ていますが、これを動的に修正する方法がわかりません。どうすればこれを修正できますか?

ここに私が現在使用しているプロパティの例があります

radio_ip_addresses[i] = new RadioButton();
radio_ip_addresses[i].Name = "radio_" + i;
radio_ip_addresses[i].Text = ip_addresses.Dequeue();
radio_ip_addresses[i].Location = new Point(x, y);
radio_ip_addresses[i].Font = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);
radio_ip_addresses[i].ForeColor = Color.White;
radio_ip_addresses[i].TextAlign = ContentAlignment.MiddleLeft;
radio_ip_addresses[i].Visible = true;
radio_ip_addresses[i].Parent = this;

winformのイメージ

4

1 に答える 1

2

Rotemに感謝します、私はdesigner.csをチェックするためにあなたの提案を取りました。重要なのはオートサイズでした:)、designer.csで見つけたものから以下を参照してください。

       this.radioButton1.AutoSize = true;
        this.radioButton1.Location = new System.Drawing.Point(192, 50);
        this.radioButton1.Name = "radioButton1";
        this.radioButton1.Size = new System.Drawing.Size(85, 17);
        this.radioButton1.TabIndex = 71;
        this.radioButton1.TabStop = true;
        this.radioButton1.Text = "radioButton1";
        this.radioButton1.UseVisualStyleBackColor = true;
于 2012-11-29T14:22:54.193 に答える