本文整理汇总了C#中System.Windows.Forms.TextBox.set_Text方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.set_Text方法的具体用法?C# TextBox.set_Text怎么用?C# TextBox.set_Text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TextBox
的用法示例。
在下文中一共展示了TextBox.set_Text方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
};
}
示例2: buildGui
private void buildGui()
{
var controls = this.add_1x1("original text", "translated text");
source_TextBox = controls[0].add_TextBox(true);
translation_TextBox = controls[1].add_TextBox(true);
source_TextBox.TextChanged +=(sender,e) => translateText(source_TextBox.Text);
source_TextBox.set_Text("Good morning from London");
}
示例3: buildGui
public API_MSBuild_Gui buildGui(Panel _topPanel)
{
topPanel = _topPanel;
msBuild = new API_MSBuild();
buildEnabled = true;
consoleOut_TextArea = topPanel.insert_Right(300).add_GroupBox("Console Out details").add_TextArea_With_SearchPanel().wordWrap(false);
tableList = topPanel.clear().add_TableList("VisualStudio MSBuild results");
tableList.add_Columns("Project", "Path", "Status", "Time", "Console Out");
startBuild = (pathToProject) =>
{
var buildStatus = "SKIPPED";
var buildResult = false;
if (buildEnabled)
{
buildResult = msBuild.build_Ok(pathToProject);
buildStatus = buildResult ? "OK" : "FAILED";
}
else
{
"buildEnabled was set to false, so skipping build for: {0}".error(pathToProject);
msBuild.ConsoleOut = new StringBuilder();
}
tableList.add_ListViewItem( pathToProject.fileName(),
pathToProject,
buildStatus,
msBuild.BuildDuration.timeSpan_ToString(),
msBuild.ConsoleOut.str())
.foreColor(buildResult, Color.Green, Color.Red);
};
tableList.afterSelect_get_Cell(4, (value)=>consoleOut_TextArea.set_Text(value));
buildEnabled_CheckBox = tableList.insert_Below(50,"Config")
.add_CheckBox("Build Enabled",3,0,(value) => buildEnabled = value).check();
//currentTarget_TextBox = buildEnabled_CheckBox.append_Label("Current Target").top(8).autoSize().append_TextBox("").width(300);
status_Label = buildEnabled_CheckBox.append_Label("...").autoSize().top(8);
tableList.add_ContextMenu()
.add_MenuItem("Recompile project" , true ,
()=>{
startBuild(tableList.selected().values().second());
})
.add_MenuItem("Open Project folder" , true,
()=>{
tableList.selected().values()
.second()
.directoryName()
.startProcess();
})
.add_MenuItem("Clear table" ,
()=> tableList.clearRows() );
//tableList.onDoubleClick_get_Row((row)=> buildProject(row.values().second()));
tableList.columns_Width(200,200,50, 100,-2);
buildProjects = (fileOrFolder, onBuildComplete)=>
{
//currentTarget_TextBox.set_Text(fileOrFolder);
O2Thread.mtaThread(
()=>{
var start = DateTime.Now;
tableList.listView().backColor(Color.Azure);
"Loading file(s) from: {0}".info(fileOrFolder);
if (fileOrFolder.fileExists())
{
status_Label.set_Text("[1/1] Building: {0}".format(fileOrFolder.fileName()));
startBuild(fileOrFolder);
}
else
{
var files = fileOrFolder.csproj_Files();
"Found {0} csproj files to process: {0}".debug(files.size());
var processed = 1;
foreach(var file in files)
{
status_Label.set_Text("[{0}/{1}] Building: {2}".format(processed ++, files.size(), file.fileName()));
startBuild(file);
}
}
status_Label.set_Text("Build complete");
tableList.listView().backColor(Color.White);
"Build Projects action was completed in: {0}".info(start.timeSpan_ToString());
onBuildComplete();
});
};
tableList.listView().onDrop((fileOrFolder)=> buildProjects(fileOrFolder, ()=>{}));
return this;
}
示例4: add_DropArea
public static TextBox add_DropArea(this IStep step, int left, int top, int width, int height, Action<string> onDroppedFile)
{
var colorWhenNotReadyToDrop = Color.LightCoral;
var colorWhenReadyToDrop = Color.LightGreen;
var dropArea = new TextBox();
dropArea.Multiline = true;
dropArea.BackColor = colorWhenNotReadyToDrop;
dropArea.Left = left;
dropArea.Top = top;
dropArea.Width = width;
dropArea.Height = height;
dropArea.AllowDrop = true;
dropArea.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
dropArea.DragDrop += (sender, e) =>
{
var fileOrDirectory = Dnd.tryToGetFileOrDirectoryFromDroppedObject(e);
dropArea.set_Text(fileOrDirectory);
onDroppedFile(fileOrDirectory);
};
dropArea.DragEnter += (sender, e) =>
{
e.Effect = DragDropEffects.Copy;
dropArea.BackColor = colorWhenReadyToDrop;
};
dropArea.DragLeave += (sender, e) => dropArea.BackColor = colorWhenNotReadyToDrop;
step.add_Control(dropArea);
return dropArea;
}
示例5: add_SelectFolder
public static IStep add_SelectFolder(this List<IStep> steps, string stepTitle, string defaultFolder, Action<string> setResult)
{
// textbox
var textBox = new TextBox();
textBox.TextChanged += (sender, e) =>
{
setResult(textBox.Text);
PublicDI.log.info("in TextChanged");
};
textBox.Text = defaultFolder;
textBox.Width = 400;
textBox.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
textBox.AllowDrop = true;
textBox.DragDrop += (sender, e) => textBox.set_Text(Dnd.tryToGetFileOrDirectoryFromDroppedObject(e));
textBox.DragEnter += (sender, e) => e.Effect = DragDropEffects.Copy;
// button
var button = new Button();
button.Text = "Select Folder";
button.Width += 20;
button.Click += (sender, e) =>
{
var folderBrowserDialog = new FolderBrowserDialog();
folderBrowserDialog.SelectedPath = defaultFolder;
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
textBox.Text = folderBrowserDialog.SelectedPath;
folderBrowserDialog.Dispose();
}
};
// panel
var panel = new FlowLayoutPanel();
panel.Dock = DockStyle.Fill;// AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
panel.Controls.Add(textBox);
panel.Controls.Add(button);
var newStep = new TemplateStep(panel, 10, stepTitle);
steps.Add(newStep);
return newStep;
}
示例6: add_SelectFile
public static IStep add_SelectFile(this List<IStep> steps, string stepTitle, string defaultFolder, int top, int textBoxLeft, int textBoxWidth, Action<string> setResult, Action<TextBox, Button> callbackWithControls)
{
// textbox
var textBox = new TextBox();
textBox.TextChanged += (sender, e) => setResult(textBox.Text);
textBox.Text = defaultFolder;
if (top > -1)
textBox.Top = top;
if (textBoxLeft > -1)
textBox.Left = textBoxLeft;
textBox.Width = (textBoxWidth > -1) ? textBoxWidth : 90;
textBox.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
textBox.AllowDrop = true;
textBox.DragDrop += (sender, e) => textBox.set_Text(Dnd.tryToGetFileOrDirectoryFromDroppedObject(e));
textBox.DragEnter += (sender, e) => e.Effect = DragDropEffects.Copy;
// button
var button = new Button();
if (top > -1)
button.Top = top;
button.Top -= 2;
button.Text = "Select File";
button.Width += 20;
button.Left = textBox.Width + textBox.Left + 2;
button.Anchor = AnchorStyles.Right | AnchorStyles.Top;
button.Click += (sender, e) =>
{
var openFileDialog = new OpenFileDialog();
openFileDialog.InitialDirectory = defaultFolder;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
textBox.Text = openFileDialog.FileName;
openFileDialog.Dispose();
}
};
// panel
var step = steps.add_Panel("stepTitle");
//var panel = new FlowLayoutPanel();
//panel.Dock = DockStyle.Fill;// AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
step.add_Control(textBox);
step.add_Control(button);
callbackWithControls(textBox, button);
//var newStep = new TemplateStep(panel, 10, stepTitle);
//steps.Add(newStep);
return step;
}