本文整理汇总了C#中System.Windows.Forms.Panel.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.Dispose方法的具体用法?C# Panel.Dispose怎么用?C# Panel.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Panel
的用法示例。
在下文中一共展示了Panel.Dispose方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: add_total
public void add_total(int total)
{
for (int i = 0; i < total; i++)
{
Panel Temp_Panel = new Panel();
Temp_Panel.BackColor = System.Drawing.Color.Aqua;
Temp_Panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
Temp_Panel.BringToFront();
Temp_Panel.Location = new System.Drawing.Point(X_Location, Y_Location);
Temp_Panel.Name = "Panel" + i;
Temp_Panel.Size = new System.Drawing.Size(10, 16);
panels.Add(Temp_Panel);
Temp_Panel = null;
if (Temp_Panel != null)
Temp_Panel.Dispose();
write_controls(panels.Count - 1);
//Controls.Add(panels[panels.Count - 1]);
if ((X_Location + 16) > 575)
{
write_textbox("\r\n");
Y_Location += 18;
X_Location = 4;
}
else
X_Location += 16;
//panels[panels.Count - 1].Show();
}
write_progress(0, panels.Count);
if (panels.Count >= 200)
MessageBox.Show("Achievement Unlocked: Over 200!", "Achievement Unlocked", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
示例2: WorkAsync
public void WorkAsync(WorkAsyncInfo info)
{
if (info.Host == null)
{
throw new NullReferenceException("WorkAsyncInfo Host property is null!");
}
_infoPanel = InformationPanel.GetInformationPanel(info.Host, info.Message, info.MessageWidth, info.MessageHeight);
_worker = new BackgroundWorker
{
WorkerReportsProgress = info.ProgressChanged != null,
WorkerSupportsCancellation = info.IsCancelable
};
_worker.DoWork += info.PerformWork;
if (_worker.WorkerReportsProgress && info.ProgressChanged != null)
{
_worker.ProgressChanged += info.PerformProgressChange;
}
_worker.RunWorkerCompleted += (s, e) =>
{
if (info.Host.Controls.Contains(_infoPanel))
{
_infoPanel.Dispose();
info.Host.Controls.Remove(_infoPanel);
}
if (info.PostWorkCallBack != null)
{
info.PostWorkCallBack(e);
}
};
_worker.RunWorkerAsync(info.AsyncArgument);
}
示例3: WorkAsync
public void WorkAsync(Control host, string message, Action<DoWorkEventArgs> work, Action<RunWorkerCompletedEventArgs> callback, object argument = null, int messageWidth = 340, int messageHeight = 150)
{
_infoPanel = InformationPanel.GetInformationPanel(host, message, messageWidth, messageHeight);
var worker = new BackgroundWorker();
worker.DoWork += (s, e) => work(e);
worker.RunWorkerCompleted += (s, e) =>
{
if (host.Controls.Contains(_infoPanel))
{
_infoPanel.Dispose();
host.Controls.Remove(_infoPanel);
}
callback(e);
};
worker.RunWorkerAsync(argument);
}
示例4: btnPrint_Click
/// <summary>
/// Printing Functionality
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnPrint_Click(object sender, System.EventArgs e)
{
//Create a Panel and clip all other panels to this panel
Panel pnl=new Panel();
pnl.Tag = "Department Information";
pnl.Font = new Font("Arial", 8F, GraphicsUnit.Point);
pnl.Width = tbcDepartment.Width;
pnl.Height = tbcDepartment.Height*2+20;
pnl.Controls.Add(pnlContact);
pnl.Controls.Add(pnlAddress);
pnlDeptInfo.Controls.Remove(chkNoDept);
pnl.Controls.Add(pnlDeptInfo);
//Resize for print-outs
pnlDeptInfo.Height = 185;
pnlDeptInfo.Dock = DockStyle.Top;
pnlAddress.Dock = DockStyle.Fill;
CreateFormPrintingObject(pnl);
//PrintingFunctions.SetProperties(ref fp, ps);
PrintingFunctions.SetProperties(ref xfp);
// Print!
//fp.Print();
xfp.PaperKind = PaperKind.A4;
xfp.Print();
pnlDeptInfo.Controls.Add(chkNoDept);
tbpDeptInfo.Controls.Add(pnlDeptInfo);
tbpAddress.Controls.Add(pnlAddress);
//tbpContact.Controls.Clear();
tbpContact.Controls.Add(pnlContact);
//pnlContact.Height = 484;
//pnlContact.Dock = DockStyle.Fill;
//pnlContact.Dock = DockStyle.Fill;
//pnlContact.Controls[0].Dock = DockStyle.Fill;
//pnlContact.Controls[1].Dock = DockStyle.Bottom;
//Back to original values so the panel displays fine on the UI
pnlDeptInfo.Height = 484;
pnlDeptInfo.Dock = DockStyle.Fill;
pnl.Dispose();
pnl=null;
}
示例5: ProcessPrintRequest
//.........这里部分代码省略.........
lbTabSquare.Location = new Point(control.Location.X, control.Location.Y);
lbTabSquare.Size = TextRenderer.MeasureText(lbTabSquare.Text, lbTabSquare.Font);
lbTabSquare.Size = new Size(lbTabSquare.Size.Width + lbTabSquare.Padding.Size.Width, lbTabSquare.Size.Height + lbTabSquare.Padding.Size.Height);
lbTabSquare.Tag = "showtab";
lbTabSquare.BringToFront();
printPanel.Controls.Add(lbTabSquare);
}
}
}
}*/
printPanel.BackgroundImageLayout = ImageLayout.None;
if (printPanel.Size.Width > 0 && printPanel.Size.Height > 0)
{
try
{
Bitmap b = new Bitmap(printPanel.Size.Width, printPanel.Size.Height);
Graphics bufferGraphics = Graphics.FromImage(b);
if (!(color.Equals(Color.Empty)))
{
printPanel.BackColor = color;
}
bufferGraphics.Clear(printPanel.BackColor);
if (image != null)
{
Image img = image;
switch (imageLayout.ToUpper())
{
case "TILE":
TextureBrush tileBrush = new TextureBrush(img, System.Drawing.Drawing2D.WrapMode.Tile);
bufferGraphics.FillRectangle(tileBrush, 0, 0, printPanel.Size.Width, printPanel.Size.Height);
tileBrush.Dispose();
break;
case "STRETCH":
bufferGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
bufferGraphics.DrawImage(img, 0, 0, printPanel.Size.Width, printPanel.Size.Height);
bufferGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
break;
case "CENTER":
int centerX = (printPanel.Size.Width / 2) - (img.Size.Width / 2);
int centerY = (printPanel.Size.Height / 2) - (img.Size.Height / 2);
bufferGraphics.DrawImage(img, centerX, centerY);
break;
default:
bufferGraphics.DrawImage(img, 0, 0);
break;
}
}
foreach (Control control in pageControls)
{
if (control is DragableGroupBox)
{
Pen pen = new Pen(Color.Black);
Point ul = control.Location;
Point ur = new Point(control.Location.X + control.Width, control.Location.Y);
Point ll = new Point(control.Location.X, control.Location.Y + control.Height);
Point lr = new Point(control.Location.X + control.Width, control.Location.Y + control.Height);
bufferGraphics.DrawLine(pen, ul, ur);
bufferGraphics.DrawLine(pen, ur, lr);
bufferGraphics.DrawLine(pen, lr, ll);
示例6: btnPrint_Click
private void btnPrint_Click(object sender, EventArgs e)
{
//Create a Panel and clip all other panels to this panel
Panel pnl = new Panel();
pnl.Tag = "User Information";
pnl.Width = tbcUser.Width;
pnl.Height = tbcUser.Height*3 + 20;
TextBox password = (TextBox)pnlLogin.Controls["txtPwd"];
Label lpass = (Label)pnlLogin.Controls["lblPassword"];
pnlLogin.Controls.Remove(password);
pnlLogin.Controls.Remove(lpass);
pnl.Controls.Add(pnlContact);
pnl.Controls.Add(pnlPersonal);
pnl.Controls.Add(pnlLogin);
pnlLogin.Dock = DockStyle.Top;
pnlPersonal.Dock = DockStyle.Top;
pnlContact.Dock = DockStyle.Top;
//pnl.Controls.Add(pnlBody);
CreateFormPrintingObject(pnl);
//PrintingFunctions.SetProperties(ref fp, ps);
PrintingFunctions.SetProperties(ref xfp);
// Print!
//fp.Print();
xfp.PaperKind = PaperKind.A4;
xfp.Print();
tbpLogin.Controls.Add(pnlLogin);
tbpPersonal.Controls.Add(pnlPersonal);
pnlLogin.Controls.Add(password);
pnlLogin.Controls.Add(lpass);
tbpContact.Controls.Add(pnlContact);
pnl.Dispose();
pnl = null;
}
示例7: btnPrint_Click
private void btnPrint_Click(object sender, System.EventArgs e)
{
Panel pnl=new Panel();
//pnl.Tag = "Client Information";
pnl.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
pnl.Tag = "Client Information";
pnl.Width = tbcClient.Width;
pnl.Height = tbcClient.Height*3+20;
pnlClientInfo.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
//pnlClientInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
pnl.Controls.Add(pnlAddress);
pnl.Controls.Add(pnlClientInfo);
//Resize for print-outs
pnlClientInfo.Height = 160;
pnlClientInfo.Dock = DockStyle.Top;
pnlAddress.Dock = DockStyle.Fill;
CreateFormPrintingObject(pnl);
//PrintingFunctions.SetProperties(ref fp, ps);
PrintingFunctions.SetProperties(ref xfp);
// Print!
xfp.PaperKind = PaperKind.A4;
xfp.Print();
tbpClientInfo.Controls.Add(pnlClientInfo);
tbpAddress.Controls.Add(pnlAddress);
pnlClientInfo.Height = 484;
pnlClientInfo.Dock = DockStyle.Fill;
pnl.Dispose();
pnl=null;
}
示例8: btnUpdate_Click
private void btnUpdate_Click(object sender, EventArgs e)
{
chart["name"] = txtName.Text;
chart["description"] = txtDescription.Text;
chart["datadescription"] = tecDataDescription.Text;
chart["presentationdescription"] = tecVisualizationDescription.Text;
infoPanel = InformationPanel.GetInformationPanel(this, "Updating chart...", 350, 150);
var worker = new BackgroundWorker {WorkerReportsProgress = true};
worker.DoWork += (w, evt) =>
{
service.Update((Entity)evt.Argument);
((BackgroundWorker)w).ReportProgress(0,"Publishing entity...");
service.Execute(new PublishXmlRequest
{
ParameterXml = [email protected]"<importexportxml><entities><entity>{chart.GetAttributeValue<string>("primaryentitytypecode")
}</entity></entities><nodes/><securityroles/><settings/><workflows/></importexportxml>"
});
};
worker.ProgressChanged += (w, evt) =>
{
InformationPanel.ChangeInformationPanelMessage(infoPanel, evt.UserState.ToString());
};
worker.RunWorkerCompleted += (w, evt) =>
{
if (evt.Error != null)
{
MessageBox.Show(this, evt.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
HasUpdatedContent = true;
}
Controls.Remove(infoPanel);
infoPanel.Dispose();
};
worker.RunWorkerAsync(chart);
}
示例9: OnMouseDown
protected override void OnMouseDown(MouseEventArgs e)
{
this.Focus();
this.Leave += new EventHandler(p_Leave);
img = ResClass.GetImgRes("login_inputbtn_down");
if (Items != null)
{
p = new Panel();
p.Left = 2;
p.Top = 24;
p.Width = this.Width - 5;
p.Height = Items.Length * 20;
p.AutoScroll = true;
p.Focus();
p.Leave+=new EventHandler(p_Leave);
bool isScroll = false;
int maxHeight = this.Parent.Height - this.Top - 24;
int h = 20 * Items.Length + 5;
if (h > maxHeight)
{
isScroll = true;
}
else
{
isScroll = false;
}
for (int i = 0; i < Items.Length; i++)
{
QQComboBoxItem item = new QQComboBoxItem();
item.Name = "qqcomboBoxItem_" + i;
item.Texts = Items[i];
item.Left = 0;
item.Top = 20 * i;
if (isScroll)
item.Width = p.Width - 20;
else
item.Width = p.Width;
item.Height = 20;
item.MouseClick += new MouseEventHandler(item_MouseClick);
p.Controls.Add(item);
}
this.Controls.Add(p);
if (this.Height == 26)
{
if (isScroll)
{
this.Height += 20 * (maxHeight / 20) + 5;
p.Height = 20 * (maxHeight / 20);
}
else
{
this.Height += h;
p.Height = h - 5;
}
showed = true;
}
else
{
this.Height = 26;
p.Height = 0;
showed = false;
p.Controls.Remove(p);
p.Dispose();
}
ControlCollection cce = this.Parent.Controls;
for (int i = 0; i < cce.Count; i++)
{
if (cce[i] is BasicComboBox && !cce[i].Name.Equals(this.Name))
(cce[i] as BasicComboBox).CloseListPanel();
}
}
this.BringToFront();
this.Invalidate();
}
示例10: btnPrint_Click
private void btnPrint_Click(object sender, System.EventArgs e)
{
//Create a Panel and clip all other panels to this panel
Panel pnl=new Panel();
pnl.Tag = "Instructor Information";
pnl.Font = new Font("Arial", 8F, GraphicsUnit.Point);
pnl.Width = tbcUser.Width;
pnl.Height = tbcUser.Height*3+20;
pnl.Controls.Add(pnlAddress);
pnl.Controls.Add(pnlPersonal);
pnlPersonal.Dock = DockStyle.Top;
pnlAddress.Dock = DockStyle.Fill;
CreateFormPrintingObject(pnl);
//PrintingFunctions.SetProperties(ref fp, ps);
PrintingFunctions.SetProperties(ref xfp);
// Print!
//fp.Print();
xfp.PaperKind = PaperKind.A4;
xfp.Print();
tbpPersonal.Controls.Add(pnlPersonal);
tbpContact.Controls.Add(pnlAddress);
pnlPersonal.Dock = DockStyle.Fill;
pnl.Dispose();
pnl=null;
}
示例11: Add
public void Add(string url)
{
#region GENERATED CODE
VistaControls.ProgressBar pbPercent = new VistaControls.ProgressBar();
VistaControls.ThemeText.ThemedLabel lblName = new VistaControls.ThemeText.ThemedLabel();
VistaControls.ThemeText.ThemedLabel lblPercent = new VistaControls.ThemeText.ThemedLabel();
VistaControls.ThemeText.ThemedLabel lblSizeInfo = new VistaControls.ThemeText.ThemedLabel();
VistaControls.Button btnCancel = new VistaControls.Button();
System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel();
panel.SuspendLayout();
//
// pbPercent
//
pbPercent.Location = new System.Drawing.Point(3, 40);
pbPercent.Name = "pbPercent";
pbPercent.Size = new System.Drawing.Size(373, 23);
pbPercent.TabIndex = 6;
//
// lblName
//
lblName.BorderSize = 10;
lblName.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
lblName.Location = new System.Drawing.Point(3, 4);
lblName.Name = "lblName";
lblName.Padding = new System.Windows.Forms.Padding(10, 9, 0, 0);
lblName.Size = new System.Drawing.Size(334, 34);
lblName.TabIndex = 9;
lblName.Text = "Loading";
//
// btnCancel
//
btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
btnCancel.Image = Download_Manager.Properties.Resources.icon_cross.ToBitmap();
btnCancel.Location = new System.Drawing.Point(376-22, 10);
btnCancel.Name = "btnCancel";
btnCancel.Size = new System.Drawing.Size(22, 23);
btnCancel.TabIndex = 11;
btnCancel.Text = " ";
btnCancel.TextAlign = System.Drawing.ContentAlignment.BottomRight;
btnCancel.UseVisualStyleBackColor = true;
btnCancel.Parent = panel;
btnCancel.Show();
//
// lblPercent
//
lblPercent.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
lblPercent.Location = new System.Drawing.Point(3, 63);
lblPercent.Name = "lblPercent";
lblPercent.Size = new System.Drawing.Size(196, 27);
lblPercent.TabIndex = 7;
lblPercent.Text = ".............";
lblPercent.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// lblSizeInfo
//
lblSizeInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
lblSizeInfo.Location = new System.Drawing.Point(205, 63);
lblSizeInfo.Name = "lblSizeInfo";
lblSizeInfo.Size = new System.Drawing.Size(172, 27);
lblSizeInfo.TabIndex = 8;
lblSizeInfo.Text = ".............";
lblSizeInfo.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// panel
//
panel.BackColor = System.Drawing.Color.Transparent;
panel.Controls.Add(pbPercent);
panel.Controls.Add(lblSizeInfo);
panel.Controls.Add(lblName);
//panel.Controls.Add(btnCancel);
panel.Controls.Add(lblPercent);
panel.ForeColor = System.Drawing.Color.Black;
panel.Location = new System.Drawing.Point(12, 12);
panel.Name = "panel";
panel.Size = new System.Drawing.Size(376, 99);
panel.TabIndex = 10;
#endregion
panel.Parent = this._Form;
//btnCancel.Parent = _Form;
Download dl = new Download(url, "", panel, pbPercent, lblName, lblSizeInfo, lblPercent, btnCancel);
dl.SaveTo = Environment.GetEnvironmentVariable("USERPROFILE") + Path.DirectorySeparatorChar + "Downloads" + Path.DirectorySeparatorChar + dl.Name;
btnCancel.Click += delegate(object sender, EventArgs e)
{
dl.Stop();
dl.RemoveControls();
panels.Remove(panel);
panel.Dispose();
RePosition();
};
DateTime start = DateTime.Now;
dl.Start(start, delegate()
{
dl.RemoveControls();
CommandLink btn = new CommandLink();
btn.Parent = dl._Panel;
btn.SetBounds(1, 1, dl._Panel.Width - 1, dl._Panel.Height - 10);
//.........这里部分代码省略.........