更改语言

时间:2016-12-07 17:03:51

标签: c# windows forms

早上好。

我有一个用户控件,里面有一个tablelayout面板,左,右对接。

当我将localizable属性设置为true并且我更改了语言时(使用vs2013设计器),tablelayout面板变得不受控制(具有非常大的尺寸)。

我做了很多测试,我注意到只要控件停靠在左侧,右侧,无论是否是tablelayoutpanel或其他控件,大小都会发生变化。

任何人都可以帮我解决这个问题吗? 或者也许建议我更稳定地定位我的sw?

在将localizable设置为true

之前,这是控件的设计者
partial class LineAndTitlePanel
{
    /// <summary> 
    /// Variabile di progettazione necessaria.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary> 
    /// Pulire le risorse in uso.
    /// </summary>
    /// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Codice generato da Progettazione componenti

    /// <summary> 
    /// Metodo necessario per il supporto della finestra di progettazione. Non modificare 
    /// il contenuto del metodo con l'editor di codice.
    /// </summary>
    private void InitializeComponent()
    {
        this.tableLayoutPanelFinalContainerHeader = new System.Windows.Forms.TableLayoutPanel();
        this.lineSeparator = new System.Windows.Forms.Panel();
        this.labelTitle = new System.Windows.Forms.Label();
        this.tableLayoutPanelFinalContainerHeader.SuspendLayout();
        this.SuspendLayout();
        // 
        // tableLayoutPanelFinalContainerHeader
        // 
        this.tableLayoutPanelFinalContainerHeader.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
        this.tableLayoutPanelFinalContainerHeader.BackColor = System.Drawing.Color.Transparent;
        this.tableLayoutPanelFinalContainerHeader.ColumnCount = 2;
        this.tableLayoutPanelFinalContainerHeader.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
        this.tableLayoutPanelFinalContainerHeader.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
        this.tableLayoutPanelFinalContainerHeader.Controls.Add(this.lineSeparator, 1, 0);
        this.tableLayoutPanelFinalContainerHeader.Controls.Add(this.labelTitle, 0, 0);
        this.tableLayoutPanelFinalContainerHeader.Location = new System.Drawing.Point(0, 17);
        this.tableLayoutPanelFinalContainerHeader.Margin = new System.Windows.Forms.Padding(0);
        this.tableLayoutPanelFinalContainerHeader.Name = "tableLayoutPanelFinalContainerHeader";
        this.tableLayoutPanelFinalContainerHeader.RowCount = 1;
        this.tableLayoutPanelFinalContainerHeader.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
        this.tableLayoutPanelFinalContainerHeader.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 14F));
        this.tableLayoutPanelFinalContainerHeader.Size = new System.Drawing.Size(430, 14);
        this.tableLayoutPanelFinalContainerHeader.TabIndex = 126;
        // 
        // lineSeparator
        // 
        this.lineSeparator.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
        this.lineSeparator.BackColor = System.Drawing.Color.Transparent;
        this.lineSeparator.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(12)))), ((int)(((byte)(163)))), ((int)(((byte)(176)))));
        this.lineSeparator.Location = new System.Drawing.Point(33, 12);
        this.lineSeparator.Margin = new System.Windows.Forms.Padding(0);
        this.lineSeparator.Name = "lineSeparator";
        this.lineSeparator.Size = new System.Drawing.Size(397, 2);
        this.lineSeparator.TabIndex = 0;
        // 
        // labelTitle
        // 
        this.labelTitle.AutoSize = true;
        this.labelTitle.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.labelTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(12)))), ((int)(((byte)(163)))), ((int)(((byte)(176)))));
        this.labelTitle.Location = new System.Drawing.Point(0, 0);
        this.labelTitle.Margin = new System.Windows.Forms.Padding(0);
        this.labelTitle.Name = "labelTitle";
        this.labelTitle.Size = new System.Drawing.Size(33, 14);
        this.labelTitle.TabIndex = 0;
        this.labelTitle.Text = "Title";
        this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
        // 
        // LineAndTitlePanel
        // 
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
        this.AutoSize = true;
        this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
        this.BackColor = System.Drawing.Color.Transparent;
        this.Controls.Add(this.tableLayoutPanelFinalContainerHeader);
        this.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.Margin = new System.Windows.Forms.Padding(0);
        this.Name = "LineAndTitlePanel";
        this.Padding = new System.Windows.Forms.Padding(0, 0, 0, 5);
        this.Size = new System.Drawing.Size(430, 36);
        this.tableLayoutPanelFinalContainerHeader.ResumeLayout(false);
        this.tableLayoutPanelFinalContainerHeader.PerformLayout();
        this.ResumeLayout(false);

    }

    #endregion

    protected System.Windows.Forms.TableLayoutPanel tableLayoutPanelFinalContainerHeader;
    private Panel lineSeparator;
    protected System.Windows.Forms.Label labelTitle;
}

0 个答案:

没有答案