PDA

View Full Version : سوال: ایجاد textbox مانند یک dropdownlist



headfon
یک شنبه 03 مهر 1390, 23:03 عصر
لطفا کمک کنید

چطور میشه توی #c یک textbox مانند نمونه ضمیمه ایجاد کرد؟؟
هر چی گشتم هیچی پیدا نکردم

اسم این قابلیت چیه؟؟!!

ATTACH=CONFIG]75764[/ATTACH]]

headfon
دوشنبه 04 مهر 1390, 21:20 عصر
یعنی هیچ کس بلد نیست ؟؟؟؟
حتی اسمشم نمیدونید؟؟:گریه:

headfon
یک شنبه 17 مهر 1390, 15:01 عصر
salam
khodam peydash kardam

code for main form:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace Test_app
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for
// Windows Forms designer support.
//
InitializeComponent();

//
// TODO: Initially Set Height to only one line ,
// watch out for font size in text box it is set to 8
// Width is 300
//
textBox1.Multiline = false;
textBox1.Width = 300;
textBox1.Height = 20;
textBox1.Refresh();
}

void TextBox1MouseClick(object sender, MouseEventArgs e)
{
// TODO: Implement TextBox1MouseClick
// When you click with mouse on text box it opens
// by changing its Height
textBox1.Multiline = true;
textBox1.BringToFront();
textBox1.Width = 300;
textBox1.Height = 200;
textBox1.Refresh();
}

void TextBox1MouseDoubleClick(object sender, MouseEventArgs e)
{
// TODO: Implement TextBox1MouseDoubleClick
// When you double click with mouse on text box it closes
// by changing its Height
textBox1.Multiline = false;
textBox1.Multiline = true;
textBox1.Width = 300;
textBox1.Height = 20;
textBox1.Refresh();
}
}
}

code for Program.cs:
using System;
using System.Windows.Forms;

namespace Test_app
{
/// <summary>
/// Class with program entry point.
/// </summary>
internal sealed class Program
{
/// <summary>
/// Program entry point.
/// </summary>
[STAThread]
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new MainForm());
}

}
}


and code for MainForm.Designer.cs
namespace Test_app
{
partial class MainForm
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}

/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(3, 12);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(300, 200);
this.textBox1.TabIndex = 2;
this.textBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TextBo x1MouseDoubleClick);
this.textBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBo x1MouseClick);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(348, 244);
this.Controls.Add(this.textBox1);
this.Name = "MainForm";
this.Text = "Test app";
this.ResumeLayout(false);
this.PerformLayout();
}
public System.Windows.Forms.TextBox textBox1;

}
}



نظر یادتون نره لطفا