Page 1 of 1

Ich muss den Tooltip -Text schließen, bevor ich ein Formular öffne

Posted: 03 Jun 2025, 12:17
by Anonymous
Das hat mich verrückt gemacht und ich habe schließlich festgestellt, dass wenn ich 2 Modale über ein Steuerelement mit dem Tooltip Active zeige, hängt es die zweite Form.

Code: Select all

using System;
using System.Data;

namespace PruebasDisenyLib
{
public partial class Form7 :  System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.DataGridView dataGridView2;

public Form7()
{
InitializeComponent();
}

private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.dataGridView2 = new System.Windows.Forms.DataGridView();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(819, 472);
this.tabControl1.TabIndex = 0;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.TabControl1_SelectedIndexChanged);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.dataGridView1);
this.tabPage1.Location = new System.Drawing.Point(4, 29);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(811, 439);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(3, 3);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.Size = new System.Drawing.Size(805, 433);
this.dataGridView1.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.dataGridView2);
this.tabPage2.Location = new System.Drawing.Point(4, 29);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(811, 439);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// dataGridView2
//
this.dataGridView2.AllowUserToAddRows = false;
this.dataGridView2.AllowUserToDeleteRows = false;
this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView2.Location = new System.Drawing.Point(3, 3);
this.dataGridView2.Name = "dataGridView2";
this.dataGridView2.ReadOnly = true;
this.dataGridView2.Size = new System.Drawing.Size(805, 433);
this.dataGridView2.TabIndex = 0;
this.dataGridView2.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView2_CellDoubleClick);
//
// Form7
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F,  20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(819, 472);
this.Controls.Add(this.tabControl1);
this.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "Form7";
this.Text = "Form7";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.tabPage2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
this.ResumeLayout(false);

}

private void TabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
var table = new DataTable();
table.Columns.Add("column1");
table.Columns.Add("column2");
table.Rows.Add(0, "ZERO");
table.Rows.Add(1, "ONE");
table.Rows.Add(2, "TWO");
dataGridView2.DataSource = table;
//dataGridView2.ShowCellToolTips = false;
}

private void DataGridView2_CellDoubleClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
{
var dialog = new System.Windows.Forms.Form();
dialog.Shown += Dialog_Shown;
dialog.ShowDialog();
}

private void Dialog_Shown(object sender, EventArgs e)
{
var dialog2 = new System.Windows.Forms.Form();
dialog2.Shown += Dialog2_Shown;
dialog2.ShowDialog();
}

private void Dialog2_Shown(object sender, EventArgs e)
{
new System.Windows.Forms.Form().ShowDialog();
}
}
}
< /code>
Wenn ich die Ausführung in dieser Zeile pausiere. < /p>
dialog2.ShowDialog();
Im Moment habe ich es nur gelöst, indem ich es in der DataGridView deaktiviere und showcelltooltips auf false eingestellt habe, aber ich möchte es bei Bedarf auf einfache Weise verbergen.