On Mon, 11 Aug 2008 16:20:48 -0500, Mel Weaver wrote:
I have a user that wants to define his own tooltips hints for any
edit/combobox in the program. It is a multiuser window form
application, so the hints are for the other users. The backend is a sql
server database. I'm looking for ideas of how to readily identify the
edit/combobox and store the hint.
Mel
The following builds buttons from a database table and adds a tool tip
from the database. Gives you an idea on how to make this happen. I add
the row to the button so that I can have a generic click routine for all
buttons.
foreach (MyDataSet.tableRow dismissal in
DB.scoreDataset.table.Rows)
{
if (dismissal.IsButtonColumnNull())
{
continue;
}
RadioButton button = new RadioButton();
button.Appearance =
System.Windows.Forms.Appearance.Button;
// button.AutoSize = true;
int offset = dismissal.ButtonColumn 2 ? 160 : 15;
button.Location = new System.Drawing.Point(10 +
((dismissal.ButtonColumn % 3) * 105), offset + (dismissal.ButtonRow *
35));
button.Name = String.Format("Name{0}", dismissal.ID);
button.Size = new System.Drawing.Size(100, 23);
button.TabIndex = 0;
button.TabStop = true;
button.TextAlign = ContentAlignment.MiddleCenter;
button.Text = dismissal.Description;
button.Tag = dismissal;
button.UseVisualStyleBackColor = true;
button.Checked = (dismissal.ID == 0);
button.CheckedChanged += new System.EventHandler
(DismissalCheckedChanged);
TypeGroup.Controls.Add(button);
if (!dismissal.IsTooltipNull())
{
toolTip1.SetToolTip(button, dismissal.Tooltip);
}
}
Ta
Ken