- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在寻找一种方法,将 C# 中的 ColorDialog Box 返回的颜色代码转换为 KML/KMZ 文件格式使用的颜色格式。任何信息将不胜感激!!
最佳答案
经过几个小时的研究,我已经回答了我自己的问题。
Kml 使用 8 位十六进制颜色格式。红色的传统十六进制格式看起来像#FF0000。在 Kml 中,红色看起来像这样 FF0000FF。前 2 位数字用于不透明度(alpha)。颜色格式为 AABBGGRR。我一直在寻找一种方法来设置颜色和不透明度,并将其返回到一个字符串中以放置在 KML 的属性中。这是我的解决方案。
string color
string polyColor;
int opacity;
decimal percentOpacity;
string opacityString;
//This allows the user to set the color with a colorDialog adding the chosen color to a string in HEX (without opacity (BBGGRR))
private void btnColor_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
btnColor.BackColor = colorDialog1.Color;
Color clr = colorDialog1.Color;
color = String.Format("{0:X2}{1:X2}{2:X2}", clr.B, clr.G, clr.R);
}
}
//This method takes the Opacity (0% - 100%) set by a textbox and gets the HEX value. Then adds Opacity to Color and adds it to a string.
private void PolyColor()
{
percentOpacity = ((Convert.ToDecimal(txtOpacity.Text) / 100) * 255);
percentOpacity = Math.Floor(percentOpacity); //rounds down
opacity = Convert.ToInt32(percentOpacity);
opacityString = opacity.ToString("x");
polyColor = opacityString + color;
}
我愿意寻找更有效的方法来获取颜色值
关于c# - 如何将 ColorDialog 颜色转换为 KML 颜色格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18902294/
我是 Delphi 新手,我需要一些帮助。 我有一个程序,一个背景颜色更改器(mutator),带有一个TColorDialog。否则效果很好,但是当我关闭 ColorDialog 而不从中选择颜色时
我有一个 Windows 窗体应用程序。在主窗体上,用户将输入一些项目等,然后单击将打开一个新窗体的按钮(小窗体或大窗体取决于复选框)。现在在我的主应用程序上,我有一个文件菜单 - 在其下是设置 -
我正在旋转 ColorDialog WinForms 中的组件,让用户选择特定自定义控件的图表的背景颜色和前景色。两个配置选项都在配置对话框的同一页面上,所以我想在弹出对话框时将颜色对话框的标题设置为
我没有看到任何可用的字段。我尝试了所有这些: ColorDialog cd = new ColorDialog(); cd.AnyColor = true;
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Setting the start position for OpenFileDialog/SaveFile
我想问一下是否可以只使用 QColorDialog 的颜色渐变(红色包围)部分。 我在不同的 Linux 机器(ubuntu + raspian)上使用 PyQt5 和 Python3。 最佳答案 只
我可以获得 ColorDialog 中使用的自定义颜色(vb.net) 使用 myColorDialog.CustomColors ,这将返回一个颜色数组作为整数值。 是否有可能以类似的方式获得 48
我的应用程序使用 SWT Color Cell Editor 来设置颜色属性。此类又使用 native 颜色对话框 - 它提供预设和自定义颜色。 我的用户感到沮丧,因为虽然颜色对话框允许他们输入自定义
这是来自 Qt5 的标准 Color Dialog 框 是否可以单独查看基本颜色并从对话框中删除颜色渐变? 最佳答案 我找到了这个问题的简单解决方案。这不是删除,但使用我的代码,我们看不到这个渐变,也
在 Visual C#.NET 中: 我希望能够制作一个颜色对话框,并让用户只能选择几种颜色(特别是可用于命令提示符/批处理文件的颜色)。这是怎么做到的?如何限制用户可以选择的颜色? 此外,有没有一种
应该使用以下代码将颜色对话框中的自定义颜色设置为 {Blue, Blue}: colorDialog1.CustomColors = new int[] { System.Drawing.Color.
我正在使用 .net 4.0 开发 winforms,我需要让用户选择一种颜色。默认的颜色选择器非常难看。有人知道有人喜欢 winforms 吗?? 谷歌搜索我只发现了 wpf 表单,一个很酷的是:
我正在寻找一种方法,将 C# 中的 ColorDialog Box 返回的颜色代码转换为 KML/KMZ 文件格式使用的颜色格式。任何信息将不胜感激!! 最佳答案 经过几个小时的研究,我已经回答了我自
我有一个应用程序,其中 System.Windows.Forms.ColorDialog 对话框用作颜色选择器。无论如何,我可以 (1) 保存用户在此对话框的“自定义颜色”部分中保存的色板,或者 (2
这是用于测试的 js fiddle 上的代码 https://jsfiddle.net/em7yfa12/ 还有代码在这里:但首先让我解释一下代码的作用。然后我会告诉我我需要达到什么。我自己找不到路。
我是一名优秀的程序员,十分优秀!