我对在 C# 中制作自定义 gui 感兴趣,我想要一些关于如何最好地做到这一点的建议。所附图片通常是我想要创建的 - 即绘制文本、框/背景、图片、线条、圆圈和其他 gui 元素(如文本输入字段等)。
我真的不知道从哪里开始,我从谷歌搜索中了解到的是 GDI+ 和使用 Paint 事件可能能够做我正在寻找的东西 - 但我不知道那是不是这样去做这样的事情,或者如果它是工作的错误工具(也就是说,与其他东西相比,它很慢/无效)。
//something along the lines of this:
private void Form1_Paint(object sender, PaintEventArgs e)
{
System.Drawing.Graphics graphicsObj;
graphicsObj = this.CreateGraphics();
Pen myPen = new Pen(System.Drawing.Color.Red, 5);
Rectangle myRectangle = new Rectangle(20, 20, 250, 200);
graphicsObj.DrawRectangle(myPen, myRectangle);
}
Run Code Online (Sandbox Code Playgroud)
感谢您的时间,如果我说错了什么,请原谅我;我什至很难向谷歌描述我想要做什么---所以非常感谢你的帮助!!!!
我想按键对字典进行排序,然后从该字典中获取所有值并将它们放入数组中.
例如,
Dictionary<int, string> customerNamesByIDs = new Dictionary<int, string>();
customerNamesByIDs.Add(9, "joe");
customerNamesByIDs.Add(2, "bob");
//sort customerNamesByIDs by int
//take sorted dictionary and put them into an array
List<string> customerNames;
//customerNames[0] == "bob";
//customerNames[1] == "joe";
Run Code Online (Sandbox Code Playgroud)
似乎应该有一个简单的方法来做到这一点,但我完全不知道如何.谢谢你的时间!!