本文整理汇总了C#中System.Windows.Forms.Panel类的典型用法代码示例。如果您正苦于以下问题:C# Panel类的具体用法?C# Panel怎么用?C# Panel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Panel类属于System.Windows.Forms命名空间,在下文中一共展示了Panel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WaitingForAppDialog
internal WaitingForAppDialog() : base(!INCLUDE_BUTTONS)
{
Text = StringParser.Parse("${res:ComponentInspector.WaitingForAppDialog.Title}");
Height = 150;
String descText = StringParser.Parse("${res:ComponentInspector.WaitingForAppDialog.Information}");
_textBox = Utils.MakeDescText(descText, this);
_textBox.Dock = DockStyle.Fill;
Controls.Add(_textBox);
Label l = new Label();
l.Dock = DockStyle.Fill;
Controls.Add(l);
Panel bottomPanel = new Panel();
bottomPanel.Dock = DockStyle.Bottom;
l = new Label();
l.Dock = DockStyle.Fill;
bottomPanel.Controls.Add(l);
Button cancel = Utils.MakeButton(StringParser.Parse("${res:Global.CancelButtonText}"));
cancel.Dock = DockStyle.Right;
cancel.DialogResult = DialogResult.Cancel;
bottomPanel.Controls.Add(cancel);
bottomPanel.Height = Utils.BUTTON_HEIGHT;
Controls.Add(bottomPanel);
}
示例2: ProductSliderPane
public ProductSliderPane(InventoryView inventory, Panel panel, MasterController masterController)
: base(masterController, panel, DOCKSTYLE_TYPE)
{
InitializeComponent();
this.inventoryView = inventory;
this.dbController = masterController.DataBaseController;
}
示例3: MessageHandler
// We take both the EditorForm's handle and its displayPanel handle, since messages
// will sometimes be for the form, or the display panel.
public MessageHandler( Panel displayPanel, EditorForm parent )
{
m_fakeFocus = false;
m_displayPanel = displayPanel;
m_parent = parent;
m_mouseDownPosition = new System.Drawing.Point(0, 0);
}
示例4: button1_Click
private void button1_Click(object sender, EventArgs e)
{
Panel p = new Panel();
p.Name = "test";
p.Dock = DockStyle.Fill;
p.BackColor = Color.Yellow;
panelMain.Controls.Add(p);
Panel p1 = new Panel();
p1.Size = new Size(200, 200);
p1.BackColor = Color.Violet;
p.Controls.Add(p1);
Panel p2 = new Panel();
p2.Size = new Size(500, 100);
p2.BackColor = Color.Red;
//p2.Location = new Point(200, 0);
Control prev = p.Controls[p.Controls.Count - 1];
p2.Location = prev.Location + prev.Size - new Size(0, p2.Height);
p.Controls.Add(p2);
/*Label l = new Label();
l.AutoSize = true;
l.Font = new Font(l.Font.FontFamily,20);
l.BorderStyle = BorderStyle.Fixed3D;
Point point = p1.Location + p1.Size - new Size(0, l.Height);
l.Location = point;
l.Text = l.Location.ToString();
//l.Height
p.Controls.Add(l);*/
//p.Controls[p.Controls.].Location.X
}
示例5: ClientGUI
public ClientGUI(string ip, string name)
{
InitializeComponent();
this.FormBorderStyle = FormBorderStyle.FixedSingle;
panelGame1 = new Panel();
this.name = name;
this.ip = ip;
this.broadcast = "BROADCAST";
this.Text = name;
tabController.TabPages.Add(broadcast);
tabController.TabPages[0].Name = broadcast;
tabController.TabPages[0].Controls.Add(new ChatPanel());
Comm = new Communication(ip, name);
openGames = new Dictionary<string, string>();
Comm.IncommingMessageHandler += Comm_IncommingMessageHandler;
buttonRpsls.Text = "Rock - Paper - Scissors -" + Environment.NewLine +"Lizard - Spock";
this.BackColor = Color.Gray;
buttonConnect4.Enabled = false;
buttonRpsls.Enabled = false;
}
示例6: Gradient
public Gradient()
{
InitializeComponent();
//Gradients = new Panel[16];
int step = 16;
int steps = 16;
for (int i = 0; i < steps; i++)
{
var p = new Panel();
var c = Math.Floor((double)((i * 0xff / steps)));
p.BackColor = Color.FromArgb((int)c, 0, 0);
p.Location = new Point(0, i * step);
p.Size = new Size(200, step);
this.Controls.Add(p);
Gradients.Add(p);
}
UpdateGradientColors();
}
示例7: OnResize
protected override void OnResize(EventArgs e)
{
if (panels.GetLength(0) < _rows || panels.GetLength(1) < _cols)
{
panels = new Panel[_rows, _cols];
}
for (int i = 0; i < _rows; i++)
for (int j = 0; j < _cols; j++)
{
if (panels[i,j] == null)
panels[i, j] = new Panel();
Rectangle rect = GetRect(i, j);
panels[i, j].Width = rect.Width;
panels[i, j].Height = rect.Width;
panels[i, j].Top = rect.Top;
panels[i, j].Left = rect.Left;
}
base.OnResize(e);
}
示例8: ShowHand
private void ShowHand(Panel aPanel, Hand aHand)
{
aPanel.Controls.Clear();
Card aCard;
Button aButton;
for (int i = 0; i < aHand.Count; i++)
{
aCard = aHand[i];
//Make the button and add it to the form.
aButton = new Button();
aPanel.Controls.Add(aButton);
//Modify the appearance.
aButton.Image = (Image)m_icons[aCard.Suit];
aButton.Text = aCard.FaceValue.ToString();
aButton.TextAlign = ContentAlignment.BottomCenter;
aButton.ForeColor = Color.Red;
aButton.ImageAlign = ContentAlignment.TopCenter;
aButton.FlatStyle = FlatStyle.Flat;
aButton.Height = 40;
//Locate the button on the panel.
aButton.Top = 45 * i;
//Save the associated card.
aButton.Tag = aCard;
//Add a MouseDown event to the new button.
aButton.MouseDown += new System.Windows.Forms.MouseEventHandler(ButtonMouseDown);
}
}
示例9: listEntradas
public Panel listEntradas()
{
Panel panel = new Panel();
TextBox textBox1 = new TextBox();
Label label1 = new Label();
// Initialize the Panel control.
//panel.Location = new Point(56, 72);
panel.Size = new Size(694, 534); //694, 534
// Set the Borderstyle for the Panel to three-dimensional.
panel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
//panel.BackColor = System.Windows.Forms.ColorDepth.Depth4Bit;
// Initialize the Label and TextBox controls.
panel.Location = new Point(16, 16);
label1.Text = "Entradas";
label1.Size = new Size(104, 16);
textBox1.Location = new Point(16, 32);
textBox1.Text = "";
textBox1.Size = new Size(152, 20);
// Add the Panel control to the form.
this.Controls.Add(panel);
// Add the Label and TextBox controls to the Panel.
panel.Controls.Add(label1);
panel.Controls.Add(textBox1);
return panel;
}
示例10: buildGui
public void buildGui()
{
var topPanel = this.add_Panel();
Path = topPanel.insert_Above<TextBox>(20);
sourceCode = topPanel.add_SourceCodeEditor();
dataGridView = sourceCode.insert_Above<Panel>(100).add_DataGridView();
leftPanel = topPanel.insert_Left<Panel>(300);
Path.onEnter(loadFiles);
Path.onDrop(
(fileOrFolder)=>{
Path.set_Text(fileOrFolder);
loadFiles(fileOrFolder);
});
dataGridView.SelectionChanged+=
(sender,e) => {
if (dataGridView.SelectedRows.size() == 1)
{
var selectedRow = dataGridView.SelectedRows[0];
var filePath = selectedRow.Cells[0].Value.str();
var filename = selectedRow.Cells[1].Value.str();
var lineNumber = selectedRow.Cells[2].Value.str();
"opening up source code: {0}".info(filePath);
sourceCode.open(filePath.pathCombine(filename));
sourceCode.gotoLine(lineNumber.toInt() + 1);
dataGridView.focus();
}
};
}
示例11: BuildDirPanel
protected TextBox BuildDirPanel(Control parent, String name)
{
Panel panel = new Panel();
panel.Dock = DockStyle.Top;
panel.Height = 60;
Label l = new Label();
l.Location = new Point(0, 0);
l.Dock = DockStyle.Left;
l.Text = name;
l.AutoSize = true;
panel.Controls.Add(l);
TextBox textBox = new TextBox();
textBox.Location = new Point(10, 20);
textBox.Width = ((ICustPanel)this).PreferredSize.Width - 40;
panel.Controls.Add(textBox);
// Don't have a reasonable directory browser and don't feel
// like doing the P/Invoke for the underlying one. Sigh.
/*****
Button b = new Button();
b.Location = new Point(120, 20);
b.Width = 20;
b.Text = "...";
b.Tag = textBox;
b.Click += new EventHandler(DirButtonClicked);
panel.Controls.Add(b);
*****/
parent.Controls.Add(panel);
return textBox;
}
示例12: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.StartupPanel = new System.Windows.Forms.Panel();
this.OdeoLogo = new System.Windows.Forms.PictureBox();
this.ProgressMeter = new System.Windows.Forms.ProgressBar();
//
// StartupPanel
//
this.StartupPanel.Controls.Add(this.ProgressMeter);
this.StartupPanel.Controls.Add(this.OdeoLogo);
this.StartupPanel.Location = new System.Drawing.Point(0, 3);
this.StartupPanel.Size = new System.Drawing.Size(176, 194);
//
// OdeoLogo
//
this.OdeoLogo.Location = new System.Drawing.Point(42, 49);
this.OdeoLogo.Size = new System.Drawing.Size(92, 39);
//
// ProgressMeter
//
this.ProgressMeter.Location = new System.Drawing.Point(42, 94);
this.ProgressMeter.Size = new System.Drawing.Size(92, 6);
//
// FrmStartup
//
this.ClientSize = new System.Drawing.Size(176, 200);
this.Controls.Add(this.StartupPanel);
this.Text = "Odeo Syncr";
}
示例13: RectangleEnigmaPanel
/// <summary>
/// Constructeur par défaut, génère plusieurs carrés.
/// </summary>
public RectangleEnigmaPanel()
{
Random rnd = new Random();
TableLayoutPanel centerLayout = new TableLayoutPanel();
centerLayout.ColumnCount = 27;
for (int i = 0; i < 27 ;i++)
{
centerLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent,0.04f));
}
centerLayout.RowCount = 21;
for (int i = 0; i < 21; i++)
{
centerLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 0.05f));
}
centerLayout.Dock = DockStyle.Fill;
Controls.Add(centerLayout);
for (int i = 0; i < tpnlCarre.Length; i++)
{
tpnlCarre[i] = new Panel();
Random randonGen = new Random();
Color randomColor = Color.FromArgb(randonGen.Next(240), randonGen.Next(240),
randonGen.Next(255));
tpnlCarre[i].BackColor = randomColor;
tpnlCarre[i].Size = new Size(20, 20);
int iLocX = rnd.Next(1, 27);
int iLocY = rnd.Next(0, 21);
centerLayout.Controls.Add(tpnlCarre[i], iLocX, iLocY);
tpnlCarre[i].Click += new EventHandler(ClickOnCarre);
}
centerLayout.Click += new EventHandler(ClickOnPanel);
}
示例14: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panelBottom = new System.Windows.Forms.Panel();
this.grid = new SourceGrid.Grid();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.mnWindow = new System.Windows.Forms.MenuItem();
this.panelBottom.SuspendLayout();
this.SuspendLayout();
//
// panelBottom
//
this.panelBottom.BackColor = System.Drawing.SystemColors.ControlDark;
this.panelBottom.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelBottom.Controls.Add(this.grid);
this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelBottom.Location = new System.Drawing.Point(0, 342);
this.panelBottom.Name = "panelBottom";
this.panelBottom.Size = new System.Drawing.Size(772, 128);
this.panelBottom.TabIndex = 1;
//
// grid
//
this.grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grid.AutoStretchColumnsToFitWidth = false;
this.grid.AutoStretchRowsToFitHeight = false;
this.grid.BackColor = System.Drawing.SystemColors.Window;
this.grid.CustomSort = false;
this.grid.Location = new System.Drawing.Point(0, 4);
this.grid.Name = "grid";
this.grid.OverrideCommonCmdKey = true;
this.grid.Size = new System.Drawing.Size(768, 120);
this.grid.SpecialKeys = SourceGrid.GridSpecialKeys.Default;
this.grid.TabIndex = 0;
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnWindow});
//
// mnWindow
//
this.mnWindow.Index = 0;
this.mnWindow.Text = "Window";
//
// frmSample25
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(772, 470);
this.Controls.Add(this.panelBottom);
this.IsMdiContainer = true;
this.Menu = this.mainMenu1;
this.Name = "frmSample25";
this.Text = "frmSample25";
this.Load += new System.EventHandler(this.frmSample25_Load);
this.panelBottom.ResumeLayout(false);
this.ResumeLayout(false);
}
示例15: AutoCompleteTextbox
/// <summary>
/// Constructor
/// </summary>
public AutoCompleteTextbox()
: base()
{
entireList = new List<string>();
matchingList = new List<string>();
lboxSuggestions = new ListBox();
lboxSuggestions.Name = "SuggestionListBox";
lboxSuggestions.Font = this.Font;
lboxSuggestions.Visible = true;
lboxSuggestions.Dock = DockStyle.Fill;// make the listbox fill the panel
lboxSuggestions.SelectionMode = SelectionMode.One;
lboxSuggestions.KeyDown += new KeyEventHandler(listBox_KeyDown);
lboxSuggestions.MouseClick += new MouseEventHandler(listBox_MouseClick);
lboxSuggestions.DataSource = matchingList;// Bind matchingList as DataSource to the listbox
this.GotFocus += new EventHandler(AutoCompleteTextbox_GotFocus);
//Will hold listbox
panel = new Panel();
panel.Visible = false;
panel.Font = this.Font;
panel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
panel.ClientSize = new System.Drawing.Size(1, 1);
panel.Name = "SuggestionPanel";
panel.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
panel.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
panel.Text = "";
panel.PerformLayout();
if (!panel.Controls.Contains(lboxSuggestions)) { this.panel.Controls.Add(lboxSuggestions); }
}