简体   繁体   English

如何将按钮插入文件名模板编辑器的文本框

[英]How to insert buttons into textbox for filename template editor

I have ac# winform and I want to create a "File Name Template Form" for users like Adobe Photoshop Lightroom's (below picture and video).我有 ac# winform,我想为像 Adobe Photoshop Lightroom 这样的用户创建一个“文件名模板表单”(下面的图片和视频)。 How can I design textbox like Lightroom's ones?我怎样才能像 Lightroom 那样设计文本框?

I'm not sure that the UI input element is called.我不确定是否调用了 UI 输入元素。 It looks a bit like a pills/tags/chips input except each item is also a dropdown.它看起来有点像药丸/标签/芯片输入,除了每个项目也是一个下拉列表。 If you know what this input element is called, please edit this post and its title.如果您知道这个输入元素叫什么,请编辑这篇文章及其标题。

在此处输入图像描述

https://youtu.be/oJHfZtrYEbo?t=246 https://youtu.be/oJHfZtrYEbo?t=246

I tried it with tokenEdit toolbox of devexpress but it does not meet my demands.我用 devexpress 的 tokenEdit 工具箱试过了,但它不符合我的要求。

Hmm.唔。 With the built-in textbox control, this is not possible (as far as I know).使用内置的文本框控件,这是不可能的(据我所知)。 If you want to use this exact format, you are sadly forced to create your own control that has this feature as a possibility.如果您想要使用这种确切的格式,您将不得不创建自己的控件来实现此功能。

What id suggest as a quick solution is to have a normal textbox, but then you can type in special text that can be interpreted via string manipulation to give you what you want. id 建议的快速解决方案是拥有一个普通的文本框,但是您可以输入可以通过字符串操作解释的特殊文本,从而为您提供所需的内容。

example:例子:

string fileName = "image - [num] [date] [time].jpg"

gets translated like this:被翻译成这样:

public void TranslateText(ref string text)
{
    text.Replace("[num]", i.ToString());
    text.Replace("[date]", DateTime.Now.Date);
    text.Replace("[time]", DateTime.Now.TimeOfDay);
}
TranslateText(fileName);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM