Различия в визуализации на разных мониторах/дисплеях в моем приложении .NET Windows FormsC#

Место общения программистов C#
Ответить Пред. темаСлед. тема
Anonymous
 Различия в визуализации на разных мониторах/дисплеях в моем приложении .NET Windows Forms

Сообщение Anonymous »

Я разрабатываю приложение .NET Windows Forms с .NET версии 4.7.1. Но есть проблема с визуализацией одного вида при смене экрана, на котором будет отображаться. Я почти уверен, что могут быть некоторые свойства, связанные с этой проблемой, и их следует настроить правильно, чтобы не было этих различий в визуализации между разными дисплеями, большими/меньшими мониторами/дисплеями. Я также добавляю реализованный код для основного представления и представления подформы, используемой в основном представлении.
Примеры:

1)
Дизайн вида

2) Визуализация вида на большом мониторе/дисплее

3) Визуализация вида на мониторе/дисплее меньшего размера
Вот инициализация основного просмотр:

Код: Выделить всё

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.label1 = new KBC.Shared.Theme.Controls.Label();
this.linearIncreasBackBtn = new KBC.Shared.Theme.Controls.Button();
this.LinearIncreaseTabControl = new KBC.Shared.Theme.Controls.TabControl();
this.GuaranteesDataSubForm = new KBC.Shared.Theme.Controls.SubForm();
this.lin = new KBC.Shared.Theme.Controls.Line();
this.lblDetail = new KBC.Shared.Theme.Controls.Label();
this.label2 = new KBC.Shared.Theme.Controls.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(0, 100, 0, 0);
this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(244)))), ((int)(((byte)(255)))));
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F);
this.label1.ForeColor = System.Drawing.SystemColors.InfoText;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(1262, 39);
//
// linearIncreasBackBtn
//
this.linearIncreasBackBtn.BackColor = System.Drawing.Color.Transparent;
this.linearIncreasBackBtn.ImageLocation = "%Images%buttons\\128x128_6_Back_Black.png";
this.linearIncreasBackBtn.Location = new System.Drawing.Point(5, 7);
this.linearIncreasBackBtn.Name = "linearIncreasBackBtn";
this.linearIncreasBackBtn.RaiseClickBeforeFocusChange = true;
this.linearIncreasBackBtn.Size = new System.Drawing.Size(25, 26);
this.linearIncreasBackBtn.Style = Firefly.Box.UI.ButtonStyle.ImageAndText;
this.linearIncreasBackBtn.Tag = "";
this.linearIncreasBackBtn.Click += new Firefly.Box.UI.Advanced.ButtonClickEventHandler(this.LinearIncreasBackBtn_Click);
//
// LinearIncreaseTabControl
//
this.LinearIncreaseTabControl.AllowChangeInBrowse = true;
this.LinearIncreaseTabControl.AllowFocus = false;
this.LinearIncreaseTabControl.ClearListIfListSourceHasNoRowsAndDisplayValueWasSet = true;
this.LinearIncreaseTabControl.DisableValuesValidation = false;
this.LinearIncreaseTabControl.Location = new System.Drawing.Point(0, 41);
this.LinearIncreaseTabControl.Name = "LinearIncreaseTabControl";
this.LinearIncreaseTabControl.SelectedIndex = 0;
this.LinearIncreaseTabControl.Size = new System.Drawing.Size(1478, 20);
this.LinearIncreaseTabControl.TitlePadding = 20;
this.LinearIncreaseTabControl.BindListSource += new Firefly.Box.UI.Advanced.BindingEventHandler(this.LinearIncreaseTabControl_BindListSource);
this.LinearIncreaseTabControl.Click += new System.EventHandler(this.LinearIncreaseTabControl_Click);
this.LinearIncreaseTabControl.MouseMove += new System.Windows.Forms.MouseEventHandler(this.LinearIncreaseTabControl_MouseMove);
this.LinearIncreaseTabControl.Data = this._parentController.VehicleTypeId;
//
// GuaranteesDataSubForm
//
this.GuaranteesDataSubForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.GuaranteesDataSubForm.FormLayout = Firefly.Box.UI.SubFormLayout.AsForm;
this.GuaranteesDataSubForm.Location = new System.Drawing.Point(-9, 68);
this.GuaranteesDataSubForm.Name = "GuaranteesDataSubForm";
this.GuaranteesDataSubForm.Size = new System.Drawing.Size(1103, 582);
this.GuaranteesDataSubForm.Text = "GuaranteesDataSubForm";
//
// lin
//
this.lin.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(75, 0, 0, 100);
this.lin.End = new System.Drawing.Point(1093, 648);
this.lin.Name = "lin";
this.lin.Start = new System.Drawing.Point(1093, 0);
this.lin.Style = Firefly.Box.UI.ControlStyle.Flat;
//
// lblDetail
//
this.lblDetail.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(75, 25, 0, 0);
this.lblDetail.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(244)))), ((int)(((byte)(255)))));
this.lblDetail.Font = new System.Drawing.Font("Calibri Light", 14F,  System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDetail.Location = new System.Drawing.Point(1100, 0);
this.lblDetail.Name = "lblDetail";
this.lblDetail.Rtf = "Detail";
this.lblDetail.Size = new System.Drawing.Size(378, 39);
this.lblDetail.Text = "Detail";
//
// label2
//
this.label2.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(75, 25, 0, 0);
this.label2.Alignment = System.Drawing.ContentAlignment.TopLeft;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Font = new System.Drawing.Font("Calibri Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(170, 3);
this.label2.Name = "label2";
this.label2.Rtf = "Detail";
this.label2.Size = new System.Drawing.Size(702, 39);
this.label2.Text = "Lineare toeslag";
//
// LinearIncreaseView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.BackColor = System.Drawing.SystemColors.Window;
this.Border = Firefly.Box.UI.ControlBorderStyle.None;
this.ClientSize = new System.Drawing.Size(1481, 651);
this.Controls.Add(this.GuaranteesDataSubForm);
this.Controls.Add(this.LinearIncreaseTabControl);
this.Controls.Add(this.linearIncreasBackBtn);
this.Controls.Add(this.label2);
this.Controls.Add(this.lblDetail);
this.Controls.Add(this.lin);
this.Controls.Add(this.label1);
this.FitToMDI = true;
this.HorizontalExpressionFactor = 4D;
this.HorizontalScale = 5D;
this.Name = "LinearIncreaseView";
this.SystemMenu = false;
this.Text = "Lineaire toeslag";
this.TitleBar = false;
this.VerticalExpressionFactor = 8D;
this.VerticalScale = 13D;
this.ResumeLayout(false);

}
и код, связанный с инициализацией дизайна подчиненной формы, которая используется в главном представлении:

Код: Выделить всё

private void InitializeComponent()
{
this.grid1 = new KBC.Shared.Theme.Controls.Grid();
this.gcName = new KBC.Shared.Theme.Controls.GridColumn();
this.txtName = new KBC.Shared.Theme.Controls.TextBox();
this.gcDescription = new KBC.Shared.Theme.Controls.GridColumn();
this.txtDescription = new KBC.Shared.Theme.Controls.TextBox();
this.gcStartDate = new KBC.Shared.Theme.Controls.GridColumn();
this.txtStartDate = new KBC.Shared.Theme.Controls.TextBox();
this.gcEndDate = new KBC.Shared.Theme.Controls.GridColumn();
this.txtEndDate = new KBC.Shared.Theme.Controls.TextBox();
this.gcIncreasePercentage = new KBC.Shared.Theme.Controls.GridColumn();
this.txtIncreasePercentage = new KBC.Shared.Theme.Controls.TextBox();
this.grid1.SuspendLayout();
this.gcName.SuspendLayout();
this.gcDescription.SuspendLayout();
this.gcStartDate.SuspendLayout();
this.gcEndDate.SuspendLayout();
this.gcIncreasePercentage.SuspendLayout();
this.SuspendLayout();
//
// grid1
//
this.grid1.AutoResizeControlsToFitInsideColumns = true;
this.grid1.BringControlsBoundToColumnsToFront = true;
this.grid1.ColumnSeparators = false;
this.grid1.Controls.Add(this.gcName);
this.grid1.Controls.Add(this.gcDescription);
this.grid1.Controls.Add(this.gcStartDate);
this.grid1.Controls.Add(this.gcEndDate);
this.grid1.Controls.Add(this.gcIncreasePercentage);
this.grid1.DimActiveRowIfNotFocused = false;
this.grid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.grid1.HeaderHeight = 26;
this.grid1.IgnoreClickOnEmptyRows = true;
this.grid1.Location = new System.Drawing.Point(0, 0);
this.grid1.Name = "grid1";
this.grid1.RowHeight = 28;
this.grid1.Scrollbar = false;
this.grid1.SelectRowOnCtrlClick = true;
this.grid1.Size = new System.Drawing.Size(1416, 881);
this.grid1.Text = "grid1";
//
// gcName
//
this.gcName.Controls.Add(this.txtName);
this.gcName.Name = "gcName";
this.gcName.Text = "Guarantee Name";
this.gcName.Width = 160;
//
// txtName
//
this.txtName.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(0, 100, 0, 100);
this.txtName.Location = new System.Drawing.Point(2,  1);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(152, 18);
this.txtName.Style = Firefly.Box.UI.ControlStyle.Flat;
this.txtName.Data = this._controller.LinearIncreases.Guarantee.Name;
//
// gcDescription
//
this.gcDescription.AllowTransparentBackColor = false;
this.gcDescription.Controls.Add(this.txtDescription);
this.gcDescription.Name = "gcDescription";
this.gcDescription.Text = "Guarantee Description";
this.gcDescription.Width = 386;
//
// txtDescription
//
this.txtDescription.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(0, 100, 0, 100);
this.txtDescription.Location = new System.Drawing.Point(2, 1);
this.txtDescription.Name = "txtDescription";
this.txtDescription.Size = new System.Drawing.Size(380, 18);
this.txtDescription.Style = Firefly.Box.UI.ControlStyle.Flat;
this.txtDescription.Data = this._controller.LinearIncreases.Guarantee.Description;
//
// gcStartDate
//
this.gcStartDate.Controls.Add(this.txtStartDate);
this.gcStartDate.Name = "gcStartDate";
this.gcStartDate.Text = "Start Date";
this.gcStartDate.Width = 138;
//
// txtStartDate
//
this.txtStartDate.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(0, 100, 0, 100);
this.txtStartDate.Location = new System.Drawing.Point(2, 1);
this.txtStartDate.Name = "txtStartDate";
this.txtStartDate.Size = new System.Drawing.Size(104, 18);
this.txtStartDate.Style = Firefly.Box.UI.ControlStyle.Flat;
this.txtStartDate.Data = this._controller.LinearIncreases.StartDate;
//
// gcEndDate
//
this.gcEndDate.Controls.Add(this.txtEndDate);
this.gcEndDate.Name = "gcEndDate";
this.gcEndDate.Text = "End Date";
this.gcEndDate.Width = 124;
//
// txtEndDate
//
this.txtEndDate.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(0, 100, 0, 100);
this.txtEndDate.Location = new System.Drawing.Point(2, 1);
this.txtEndDate.Name = "txtEndDate";
this.txtEndDate.Size = new System.Drawing.Size(98, 18);
this.txtEndDate.Style = Firefly.Box.UI.ControlStyle.Flat;
this.txtEndDate.Data = this._controller.LinearIncreases.EndDate;
//
// gcIncreasePercentage
//
this.gcIncreasePercentage.Alignment = System.Drawing.ContentAlignment.MiddleRight;
this.gcIncreasePercentage.Controls.Add(this.txtIncreasePercentage);
this.gcIncreasePercentage.Name = "gcIncreasePercentage";
this.gcIncreasePercentage.Text = "Increase Percentage";
this.gcIncreasePercentage.Width = 117;
//
// txtIncreasePercentage
//
this.txtIncreasePercentage.AdvancedAnchor = new Firefly.Box.UI.AdvancedAnchor(0, 100, 0, 100);
this.txtIncreasePercentage.Alignment = System.Drawing.ContentAlignment.MiddleRight;
this.txtIncreasePercentage.Location = new System.Drawing.Point(3, 3);
this.txtIncreasePercentage.Name = "txtIncreasePercentage";
this.txtIncreasePercentage.Size = new System.Drawing.Size(108, 18);
this.txtIncreasePercentage.Style = Firefly.Box.UI.ControlStyle.Flat;
this.txtIncreasePercentage.Data = this._controller.LinearIncreases.IncreasePercentage;
//
// GuaranteesDataView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1416, 881);
this.Controls.Add(this.grid1);
this.FitToMDI = true;
this.HorizontalExpressionFactor = 1D;
this.Name = "GuaranteesDataView";
this.Text = "GuaranteesDataController";
this.VerticalExpressionFactor = 1D;
this.grid1.ResumeLayout(false);
this.gcName.ResumeLayout(false);
this.gcDescription.ResumeLayout(false);
this.gcStartDate.ResumeLayout(false);
this.gcEndDate.ResumeLayout(false);
this.gcIncreasePercentage.ResumeLayout(false);
this.ResumeLayout(false);

}
Я пытался изменить AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi, но визуализация стала только хуже. Таким образом, вид должен иметь фиксированный размер и не должен изменять размер при изменении точки обзора и при его открытии на разных мониторах/дисплеях.

Подробнее здесь: https://stackoverflow.com/questions/792 ... -windows-f
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C#»