小编Cle*_*ven的帖子

更改ComboBox边框颜色 - SelectedIndex更改时闪烁

我只是想知道在Windows窗体中我是否可以在组合框的边框周围创建一条红线?就像一缕红色然后又一次只是为了表明它已被改变.抓住用户的眼睛或其他东西.我将提供屏幕来表示我想要的东西.

如果有可能,请告诉我在哪里可以查找它以获取一些信息.

无边界 在此输入图像描述 边境闪现变化 在此输入图像描述 一两秒后边界再次消失 在此输入图像描述

.net c# combobox winforms

3
推荐指数
1
解决办法
495
查看次数

使用图像填充纹理画笔,而不是平铺

我有一个纹理画笔,它使用某个图像来使纹理显示如下:

Image image = new Bitmap("Untitled.png");
for (int i = 0; i < points.Count; i++)
{
    using (TextureBrush tbr = new TextureBrush(image))
    {
          tbr.RotateTransform(i * 4);
          var p = PointToClient(Cursor.Position);
          tbr.Transform = new Matrix(
          75.0f / 640.0f,
          0.0f,
          0.0f,
          75.0f / 480.0f,
          0.0f,
          0.0f);
          e.Graphics.FillEllipse(tbr, p.X - 50, p.Y - 50, 100, 100);
          Pen p3 = new Pen(tbr);
          e.Graphics.DrawEllipse(Pens.DeepSkyBlue, p.X - 50, p.Y - 50, 100, 100);
    }
}
Run Code Online (Sandbox Code Playgroud)

这是它正在使用的图像:

图片

结果是这样的:

最初的

我希望图像填充圆圈,使其看起来像这样(编辑后的图像):

最终的

任何帮助,将不胜感激。

c# textures imagebrush winforms

3
推荐指数
1
解决办法
2125
查看次数

更改 recyclerview 中所有其他元素的背景

当用户单击背景cardView中的a 时recyclerView,其背景会改变颜色以显示其所选内容。我正在努力解决的是,当我选择另一张卡时,我希望之前选择的卡返回到“未选择”形式。

如何才能让之前的选择cardview恢复正常呢?

这就是我到目前为止所拥有的

private fun updateRecyclerViewTest(items: List<Item>) {
    val list = ArrayList<Item>()
    fun init() {
        recycler_view_test.apply {
            layoutManager = LinearLayoutManager(this@EditModActivity, LinearLayoutManager.HORIZONTAL, false)
            adapter = GroupAdapter<ViewHolder>().apply {
                testSection = Section(items)
                add(testSection)
                setOnItemClickListener(onItemClick)
            }
        }
        shouldInitRecyclerView = false
    }
    if (shouldInitRecyclerView)
        init()
    else
    {
        testSection.update(items)
        testSection.setHeader(items[1])
    }
}

private val onItemClick = OnItemClickListener { item, view ->
    if (item is TestItem) {
        view.backgroundColorResource = R.color.colorAccent1
        txtview1.text = item.test.Desc
        txtview2.text = item.test.module
    }
}
Run Code Online (Sandbox Code Playgroud)

截屏:

在此输入图像描述

适配器类 …

android android-viewholder android-recyclerview

2
推荐指数
1
解决办法
1370
查看次数

无法将void转换为列表,返回已排序的列表

我想返回一个排序列表,但它给了我这个错误.我该怎么办?

public class sortA : sortMethod
{
    public override List<int> Sort(List<int> A)
    {
        //List<int> Asorted = new List<int>();
        //Asorted = A.Sort(){ };
        return A.Sort();
    }
}
Run Code Online (Sandbox Code Playgroud)

c# sorting list

0
推荐指数
1
解决办法
97
查看次数