- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有这个 VB +WinForms
应用程序。 UI 如下图所示
添加/编辑 Material 窗口
有自己独特的Aqua blue
颜色边框。
后面的VB
代码是
Option Strict Off
Option Explicit On
Friend Class FrmAddMaterial
Inherits System.Windows.Forms.Form
Friend ErrorFlag As ErrorFlagType
Friend SavePath As String
Public Event UpdateMaterialFile()
Private Sub CmdAdd_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdAdd.Click
Dim AddEditMat As New AddEditMaterialDialog
With AddEditMat
.TxtMaterialName.Text = ""
.TxtWetRefractiveIndex.Text = ""
.TxtDryRefractiveIndex.Text = ""
.TxtLinearExpansion.Text = ""
.TxtRadialExpansion.Text = ""
.txtMDPrefix.Text = ""
.TxtMaterialNumber.Text = Me.LstMaterials.Items.Count.ToString
.Text = "Add Material"
.SavePath = SavePath
.Show()
End With
If LstMaterials.SelectedIndex > -1 Then
UpdateMaterialScreen(Me, LstMaterials.SelectedIndex, ErrorFlag)
Else
UpdateMaterialScreen(Me, 0, ErrorFlag)
End If
End Sub
Private Sub CmdEdit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdEdit.Click
Dim MaterialData As MaterialType
MaterialData = GetMaterialData(Me.LstMaterials.SelectedIndex, _
SavePath, _
ErrorFlag)
Dim MatRef As New AddEditMaterialDialog
With MatRef
.TxtMaterialName.Text = MaterialData.MaterialName
.TxtWetRefractiveIndex.Text = MaterialData.WetRefractiveIndex.ToString
.TxtDryRefractiveIndex.Text = MaterialData.DryRefractiveIndex.ToString
.TxtLinearExpansion.Text = MaterialData.LinearExpansion.ToString
.TxtRadialExpansion.Text = MaterialData.RadiusExpansion.ToString
.txtMDPrefix.Text = MaterialData.MDPrefix
.TxtMaterialNumber.Text = MaterialData.Index.ToString
.Text = "Edit Material"
.SavePath = SavePath
.Show()
End With
End Sub
Private Sub CmdRemoveMaterial_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdRemoveMaterial.Click
Dim Msg As String
Dim MsgVal As Short
Msg = "Are you sure that you want to remove this material?"
MsgVal = MsgBox(Msg, MsgBoxStyle.YesNo, InfoMsg)
If MsgVal = MsgBoxResult.Yes Then
If LstMaterials.SelectedIndex <> -1 Then
RemoveMaterialData(LstMaterials.SelectedIndex, _
SavePath, _
ErrorFlag)
Me.LstMaterials.Items.RemoveAt((LstMaterials.SelectedIndex))
If LstMaterials.Items.Count > 0 Then
LstMaterials.SelectedIndex = 0
End If
Call UpdateMaterialScreen(Me, LstMaterials.SelectedIndex, ErrorFlag)
End If
End If
End Sub
Private Sub FrmAddMaterial_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Enter
If LstMaterials.SelectedIndex > -1 Then
UpdateMaterialScreen(Me, LstMaterials.SelectedIndex, ErrorFlag)
Else
UpdateMaterialScreen(Me, 0, ErrorFlag)
End If
End Sub
Private Sub FrmAddMaterial_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Me.Width = 278
Me.Height = 289
SavePath = System.IO.Path.Combine(ConfigSoftData.DirectoryData.AppPath, "Mold\lib")
End Sub
Private Sub LstMaterials_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles LstMaterials.SelectedIndexChanged
Dim MaterialData As MaterialType
MaterialData = GetMaterialData(LstMaterials.SelectedIndex, _
SavePath, _
ErrorFlag)
With Me
.TxtWetRefractiveIndex.Text = MaterialData.WetRefractiveIndex.ToString
.TxtMDPrefix.Text = MaterialData.MDPrefix
End With
End Sub
Private Sub FrmAddMaterial_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
RaiseEvent UpdateMaterialFile()
End Sub
End Class
我尝试将应用程序 UI 转换为 C#
并匹配 VB 表单中设置的所有属性,但我得到的是这样的结果
后面的C#
代码是
using Microsoft.VisualBasic;
using Mold_Power_Suite.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mold_Power_Suite.View
{
public partial class FrmAddMaterial : Form
{
public FrmAddMaterial()
{
InitializeComponent();
//FormClosed += FrmAddMaterial_FormClosed;
//Load += FrmAddMaterial_Load;
//Enter += FrmAddMaterial_Enter;
}
internal Mold_Power_Suite.Model.FrontEndStructures.ErrorFlagType ErrorFlag;
internal string SavePath;
public event UpdateMaterialFileEventHandler UpdateMaterialFile;
public delegate void UpdateMaterialFileEventHandler();
private void CmdAdd_Click(System.Object eventSender, System.EventArgs eventArgs)
{
AddEditMaterialDialog AddEditMat = new AddEditMaterialDialog();
//var _with1 = AddEditMat;
AddEditMat.TxtMaterialName.Text = "";
AddEditMat.TxtWetRefractiveIndex.Text = "";
AddEditMat.TxtDryRefractiveIndex.Text = "";
AddEditMat.TxtLinearExpansion.Text = "";
AddEditMat.TxtRadialExpansion.Text = "";
AddEditMat.txtMDPrefix.Text = "";
AddEditMat.TxtMaterialNumber.Text = this.LstMaterials.Items.Count.ToString();
AddEditMat.Text = "Add Material";
AddEditMat.SavePath = SavePath;
AddEditMat.Show();
if (LstMaterials.SelectedIndex > -1) {
ModSoftOutput.UpdateMaterialScreen(this, LstMaterials.SelectedIndex,ref ErrorFlag);
} else {
ModSoftOutput.UpdateMaterialScreen(this, 0, ref ErrorFlag);
}
}
private void CmdEdit_Click(System.Object eventSender, System.EventArgs eventArgs)
{
Mold_Power_Suite.Model.FrontEndStructures.MaterialType MaterialData = default(Mold_Power_Suite.Model.FrontEndStructures.MaterialType);
short RIN=Convert.ToInt16( this.LstMaterials.SelectedIndex);
MaterialData = ModSoftInputMod.GetMaterialData(ref RIN, ref SavePath, ref ErrorFlag);
AddEditMaterialDialog MatRef = new AddEditMaterialDialog();
//var _with2 = MatRef;
MatRef.TxtMaterialName.Text = MaterialData.MaterialName;
MatRef.TxtWetRefractiveIndex.Text = MaterialData.WetRefractiveIndex.ToString();
MatRef.TxtDryRefractiveIndex.Text = MaterialData.DryRefractiveIndex.ToString();
MatRef.TxtLinearExpansion.Text = MaterialData.LinearExpansion.ToString();
MatRef.TxtRadialExpansion.Text = MaterialData.RadiusExpansion.ToString();
MatRef.txtMDPrefix.Text = MaterialData.MDPrefix;
MatRef.TxtMaterialNumber.Text = MaterialData.Index.ToString();
MatRef.Text = "Edit Material";
MatRef.SavePath = SavePath;
MatRef.Show();
}
private void CmdRemoveMaterial_Click(System.Object eventSender, System.EventArgs eventArgs)
{
string Msg = null;
//short MsgVal = 0; // Commented this line and made MsgVal as var
Msg = "Are you sure that you want to remove this material?";
var MsgVal = Interaction.MsgBox(Msg, MsgBoxStyle.YesNo,ModSoftFrontEndGlobalVariables. InfoMsg);
if (MsgVal == MsgBoxResult.Yes)
{
if (LstMaterials.SelectedIndex != -1)
{
short value = Convert.ToInt16((LstMaterials.SelectedIndex));
ModSoftOutput. RemoveMaterialData(ref value, SavePath,ref ErrorFlag);
this.LstMaterials.Items.RemoveAt((LstMaterials.SelectedIndex));
if (LstMaterials.Items.Count > 0) {
LstMaterials.SelectedIndex = 0;
}
ModSoftOutput.UpdateMaterialScreen(this, LstMaterials.SelectedIndex,ref ErrorFlag);
}
}
}
//This event is not being fired up . The code below has been pasted into FrmAddMaterial_Load()
private void FrmAddMaterial_Enter(object sender, System.EventArgs e)
{
if (LstMaterials.SelectedIndex > -1) {
ModSoftOutput.UpdateMaterialScreen(this, LstMaterials.SelectedIndex,ref ErrorFlag);
} else {
ModSoftOutput.UpdateMaterialScreen(this, 0,ref ErrorFlag);
}
}
private void FrmAddMaterial_Load(System.Object eventSender, System.EventArgs eventArgs)
{
this.Width = 278;
this.Height = 289;
SavePath = System.IO.Path.Combine(ModSoftFrontEndGlobalVariables.ConfigSoftData.DirectoryData.AppPath, "Mold\\lib");
/*if (LstMaterials.SelectedIndex > -1)
{
ModSoftOutput.UpdateMaterialScreen(this, LstMaterials.SelectedIndex, ref ErrorFlag);
}
else
{
ModSoftOutput.UpdateMaterialScreen(this, 0, ref ErrorFlag);
}*/
}
private void LstMaterials_SelectedIndexChanged(System.Object eventSender, System.EventArgs eventArgs)
{
Mold_Power_Suite.Model.FrontEndStructures.MaterialType MaterialData = default(Mold_Power_Suite.Model.FrontEndStructures.MaterialType);
short RINumber= Convert.ToInt16(LstMaterials.SelectedIndex);
MaterialData = ModSoftInputMod.GetMaterialData(ref RINumber,ref SavePath,ref ErrorFlag);
// var _with3 = this;
this.TxtWetRefractiveIndex.Text = MaterialData.WetRefractiveIndex.ToString();
this.TxtMDPrefix.Text = MaterialData.MDPrefix;
}
private void FrmAddMaterial_FormClosed(object sender, FormClosedEventArgs e)
{
if (UpdateMaterialFile != null) {
UpdateMaterialFile();
}
}
}
}
我已确保将这些行添加到我的 C# 代码的 Program.cs
文件中
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Mold_Power_Suite.View.frmMain mainForm = new frmMain();
// WindowsFormsApplication3.view.Form1 abc = new view.Form1();
Application.Run(mainForm);
}
}
这是Designer.cs
namespace Mold_Power_Suite.View
{
partial class FrmAddMaterial
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.ToolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.TxtMDPrefix = new System.Windows.Forms.TextBox();
this.CmdRemoveMaterial = new System.Windows.Forms.Button();
this.CmdReturn = new System.Windows.Forms.Button();
this.CmdEdit = new System.Windows.Forms.Button();
this.CmdAdd = new System.Windows.Forms.Button();
this.TxtWetRefractiveIndex = new System.Windows.Forms.TextBox();
this.LstMaterials = new System.Windows.Forms.ListBox();
this.Label2 = new System.Windows.Forms.Label();
this.Label1 = new System.Windows.Forms.Label();
this.toolTip2 = new System.Windows.Forms.ToolTip(this.components);
this.SuspendLayout();
//
// TxtMDPrefix
//
this.TxtMDPrefix.AcceptsReturn = true;
this.TxtMDPrefix.BackColor = System.Drawing.SystemColors.Window;
this.TxtMDPrefix.Cursor = System.Windows.Forms.Cursors.IBeam;
this.TxtMDPrefix.Enabled = false;
this.TxtMDPrefix.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TxtMDPrefix.ForeColor = System.Drawing.SystemColors.WindowText;
this.TxtMDPrefix.Location = new System.Drawing.Point(152, 80);
this.TxtMDPrefix.MaxLength = 0;
this.TxtMDPrefix.Name = "TxtMDPrefix";
this.TxtMDPrefix.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TxtMDPrefix.Size = new System.Drawing.Size(105, 20);
this.TxtMDPrefix.TabIndex = 2;
//
// CmdRemoveMaterial
//
this.CmdRemoveMaterial.BackColor = System.Drawing.SystemColors.Control;
this.CmdRemoveMaterial.Cursor = System.Windows.Forms.Cursors.Default;
this.CmdRemoveMaterial.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CmdRemoveMaterial.ForeColor = System.Drawing.SystemColors.ControlText;
this.CmdRemoveMaterial.Location = new System.Drawing.Point(152, 219);
this.CmdRemoveMaterial.Name = "CmdRemoveMaterial";
this.CmdRemoveMaterial.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CmdRemoveMaterial.Size = new System.Drawing.Size(105, 25);
this.CmdRemoveMaterial.TabIndex = 5;
this.CmdRemoveMaterial.Text = "&Remove Material";
this.CmdRemoveMaterial.UseVisualStyleBackColor = false;
this.CmdRemoveMaterial.Click += new System.EventHandler(this.CmdRemoveMaterial_Click);
//
// CmdReturn
//
this.CmdReturn.BackColor = System.Drawing.SystemColors.Control;
this.CmdReturn.Cursor = System.Windows.Forms.Cursors.Default;
this.CmdReturn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CmdReturn.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CmdReturn.ForeColor = System.Drawing.SystemColors.ControlText;
this.CmdReturn.Location = new System.Drawing.Point(89, 291);
this.CmdReturn.Name = "CmdReturn";
this.CmdReturn.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CmdReturn.Size = new System.Drawing.Size(105, 25);
this.CmdReturn.TabIndex = 15;
this.CmdReturn.Text = "&Close";
this.CmdReturn.UseVisualStyleBackColor = false;
//
// CmdEdit
//
this.CmdEdit.BackColor = System.Drawing.SystemColors.Control;
this.CmdEdit.Cursor = System.Windows.Forms.Cursors.Default;
this.CmdEdit.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CmdEdit.ForeColor = System.Drawing.SystemColors.ControlText;
this.CmdEdit.Location = new System.Drawing.Point(152, 187);
this.CmdEdit.Name = "CmdEdit";
this.CmdEdit.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CmdEdit.Size = new System.Drawing.Size(105, 25);
this.CmdEdit.TabIndex = 4;
this.CmdEdit.Text = "&Edit Material";
this.CmdEdit.UseVisualStyleBackColor = false;
this.CmdEdit.Click += new System.EventHandler(this.CmdEdit_Click);
//
// CmdAdd
//
this.CmdAdd.BackColor = System.Drawing.SystemColors.Control;
this.CmdAdd.Cursor = System.Windows.Forms.Cursors.Default;
this.CmdAdd.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CmdAdd.ForeColor = System.Drawing.SystemColors.ControlText;
this.CmdAdd.Location = new System.Drawing.Point(152, 155);
this.CmdAdd.Name = "CmdAdd";
this.CmdAdd.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CmdAdd.Size = new System.Drawing.Size(105, 25);
this.CmdAdd.TabIndex = 3;
this.CmdAdd.Text = "&Add Material";
this.CmdAdd.UseVisualStyleBackColor = false;
this.CmdAdd.Click += new System.EventHandler(this.CmdAdd_Click);
//
// TxtWetRefractiveIndex
//
this.TxtWetRefractiveIndex.AcceptsReturn = true;
this.TxtWetRefractiveIndex.BackColor = System.Drawing.SystemColors.Window;
this.TxtWetRefractiveIndex.Cursor = System.Windows.Forms.Cursors.IBeam;
this.TxtWetRefractiveIndex.Enabled = false;
this.TxtWetRefractiveIndex.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TxtWetRefractiveIndex.ForeColor = System.Drawing.SystemColors.WindowText;
this.TxtWetRefractiveIndex.Location = new System.Drawing.Point(152, 32);
this.TxtWetRefractiveIndex.MaxLength = 0;
this.TxtWetRefractiveIndex.Name = "TxtWetRefractiveIndex";
this.TxtWetRefractiveIndex.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TxtWetRefractiveIndex.Size = new System.Drawing.Size(105, 20);
this.TxtWetRefractiveIndex.TabIndex = 1;
//
// LstMaterials
//
this.LstMaterials.BackColor = System.Drawing.SystemColors.Window;
this.LstMaterials.Cursor = System.Windows.Forms.Cursors.Default;
this.LstMaterials.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.LstMaterials.ForeColor = System.Drawing.SystemColors.WindowText;
this.LstMaterials.ItemHeight = 14;
this.LstMaterials.Location = new System.Drawing.Point(16, 16);
this.LstMaterials.Name = "LstMaterials";
this.LstMaterials.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.LstMaterials.Size = new System.Drawing.Size(121, 228);
this.LstMaterials.TabIndex = 0;
this.LstMaterials.SelectedIndexChanged += new System.EventHandler(this.LstMaterials_SelectedIndexChanged);
//
// Label2
//
this.Label2.BackColor = System.Drawing.SystemColors.Control;
this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
this.Label2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label2.Location = new System.Drawing.Point(152, 64);
this.Label2.Name = "Label2";
this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label2.Size = new System.Drawing.Size(81, 17);
this.Label2.TabIndex = 8;
this.Label2.Text = "Data File Prefix";
//
// Label1
//
this.Label1.BackColor = System.Drawing.SystemColors.Control;
this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
this.Label1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label1.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label1.Location = new System.Drawing.Point(152, 16);
this.Label1.Name = "Label1";
this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label1.Size = new System.Drawing.Size(105, 17);
this.Label1.TabIndex = 7;
this.Label1.Text = "Wet Refractive Index";
//
// FrmAddMaterial
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 19F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CmdReturn;
this.ClientSize = new System.Drawing.Size(272, 255);
this.Controls.Add(this.TxtMDPrefix);
this.Controls.Add(this.CmdRemoveMaterial);
this.Controls.Add(this.CmdReturn);
this.Controls.Add(this.CmdEdit);
this.Controls.Add(this.CmdAdd);
this.Controls.Add(this.TxtWetRefractiveIndex);
this.Controls.Add(this.LstMaterials);
this.Controls.Add(this.Label2);
this.Controls.Add(this.Label1);
this.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Location = new System.Drawing.Point(3, 14);
this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmAddMaterial";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds;
this.Text = " Add/Edit Material";
this.Activated += new System.EventHandler(this.FrmAddMaterial_Enter);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmAddMaterial_FormClosed);
this.Load += new System.EventHandler(this.FrmAddMaterial_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public System.Windows.Forms.ToolTip ToolTip1;
public System.Windows.Forms.TextBox TxtMDPrefix;
public System.Windows.Forms.Button CmdRemoveMaterial;
public System.Windows.Forms.Button CmdReturn;
public System.Windows.Forms.Button CmdEdit;
public System.Windows.Forms.Button CmdAdd;
public System.Windows.Forms.TextBox TxtWetRefractiveIndex;
public System.Windows.Forms.ListBox LstMaterials;
public System.Windows.Forms.Label Label2;
public System.Windows.Forms.Label Label1;
public System.Windows.Forms.ToolTip toolTip2;
}
}
Parent Window。
我该如何解决这些问题?
最佳答案
代替
MatRef.Show();
写
MatRef.ShowDialog();
如果那行不通,那么在此之前再添加一行
MatRef.TopLevel = false;
示例代码:
ParentForm.Designer.cs
namespace MyPro
{
partial class ParentForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(231, 193);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(103, 44);
this.button1.TabIndex = 0;
this.button1.Text = "Show Dialog";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// ParentForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1059, 719);
this.Controls.Add(this.button1);
this.Name = "ParentForm";
this.Text = "Parent Form";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
}
}
ParentForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MyPro
{
public partial class ParentForm : Form
{
public ParentForm()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form f = new DialogWindow();
f.StartPosition = FormStartPosition.CenterScreen;
f.ShowDialog();
}
}
}
DialogWindow.Designer.cs
namespace MyPro
{
partial class DialogWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// DialogWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(282, 255);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "DialogWindow";
this.Text = "DialogWindow";
this.ResumeLayout(false);
}
#endregion
}
}
关于c# - 如何获得完美的边框并使窗口始终保持在顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39079126/
为了加速测试字谜字符串的快速输出行为,我 came up with基于质数的哈希方案——尽管它看起来像 I wasn't the first . 基本思想是将字母映射到素数,并计算这些素数的乘积。字母
我使用 Perfect Framework 创建了一个 Swift 3.0 服务器。一切都按预期进行得很好,但我正在尝试了解是否有更好的方法来做一些事情。 来自 iOS 背景,我知道总是在不同的线程中
我有一个固定大小的正方形 div,希望使用 CSS 在其中放置任意大小的图像,以便它在水平和垂直方向上都居中。横向很容易: .container { text-align: center } 对于垂直
程序员离不开终端,配置一个好看又好用的终端,可以提高工作效率. 本篇文章记录了使用 Oh My Zsh + PowerLevel9k + zsh插件 快速配置Ubuntu下默认终端的过程. 我们在
在请求处理程序中,处理例如获取 https://example.com/collections/1或 POSThttp://0.0.0.0:8080/collections 如何获取服务器地址 htt
我正在使用 perfect 和 SQLite司机和StORM作为连接器。我可以一一保存(创建)多行。为了使其更快,我想一次创建多行,我该怎么做? 最佳答案 从完美的 SQLite-StORM 和 Pe
这是我在这里的第一篇文章,所以我希望我提供所有正确的信息。 我目前正在开发一个简单的菜单应用程序,它有一个按钮控制数组(使用 MSDN 建议的控制数组的变通方法),我很难重新调整表单大小和将按钮居中。
在 androidplot XYPlot 中,如果您有较大的值(许多数字)和/或较大的字体大小,则 Y 轴上的刻度标签会被剪裁。这个(以及 X 轴上的类似问题)之前已经在这些问题中讨论过: Range
注意:我遗漏了不相关的代码 所以我目前正在研究 CCC 1996 P1,这个问题的全部目的是能够计算一个整数输入是完美数、不足数还是充数。我上面列出的代码可以工作,但是我认为它太慢了。该代码会迭代每个
我需要什么 我需要一个产生双射输出的算法。我有一个 31 位输入,需要一个伪随机 31 位输出。 我考虑过的 CRC 在其位宽内是双射的。 我查看了 Google 并找到了多项式,但找不到表格或算法。
我在 Ubuntu 14.04.1、clang-3.8 上使用 PerfectSwift我使用的是 Perfect,一切正常,但现在,我不能再编译了(但它可以在我的 mac 上编译) 错误日志是 /h
如果您对分表有以下痛点那么不妨试试我这边开源的框架sharding-core ,是否需要无感知使用分表组件,是否需要支持abp,是否需要支持自定义分表规则,是否需要支持自定义分表键,是否需要支持特定
我正在尝试确定我的 crc 与“ 理想 ”32 位 crc 的比较。 因此,我运行我的 crc 超过 100 万个完全随机的数据样本并收集了碰撞数量,我想将此数字与我可以从“ 理想 ”crc 中预期的
我正在开发一个项目,需要验证我的 URL,并偶然发现了以下正则表达式模式; /(((http|ftp|https):\/{2})+(([0-9a-z_-]+\.)+(aero|asia|biz|cat
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 4 年前。 Improve
我正在创建一个需要居中于中间的圆形网站。背景由围绕中心图像的圆圈组成。每当我以全屏(F11 快捷键)查看我的网站时,无论我的屏幕分辨率如何,它都完美居中。 如果我在没有全屏显示的情况下查看我的网站,我
所以我有一个网站,在开发人员工具中测试响应能力时看起来很棒,但在 iPhone 本身上实际测试时却没有居中并且看起来有些破烂。 什么会导致这种情况,如果我无法使用 iPhone(在我的 android
我有一个内部类,它扩展了 AbstractTableModel。 import javax.swing.table.AbstractTableModel; public class MyClass e
所以我正在使用 Perfect 服务器开发一个将值返回给客户端的应用程序。目前,它需要从另一个 API 下载一些数据,对其进行处理,然后将其发送给客户端。 然而,出于某种原因,它在 OSX 中编译良好
我有一些 CSS 按钮。 “按钮”效果是通过在 anchor 标记中使用固定大小的 元素来完成的,并且 css 规则以 a span:active 、 a span:hover 的形式显示按钮状态。
我是一名优秀的程序员,十分优秀!