RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题

全部问题

Martin Hope
Yuki Rin
Asked: 2024-09-19 06:30:15 +0000 UTC

TableLayoutPanel 中行的 AutoSize 参数不起作用

  • 6

其中有TableLayoutPanel一种元素是动态添加的Button。我想AutoSize为每行的高度设置一个参数(Row),但该参数仅适用于第一行。

代码:

private void editEventsLoad(object sender, EventArgs e)
{
    ea_tableLayoutPanel.RowCount = 0;
    ea_tableLayoutPanel.RowStyles.Clear();

    // получаем все обьекты event и добавляем кнопку для них в TableLayoutPanel
    for (int i = 0; i < events.Length; i++)
    {
        EventObject _event = events[i];

        ea_addButtonToEventList(
            $"{_event.From.ToShortDateString()}, {_event.From.ToShortTimeString()}  " +
            $"{_event.To.ToShortDateString()}, {_event.To.ToShortTimeString()}" +
            $" - " +
            $"{_event.EventName}", i.ToString());
        
    }
}

// Добавляем кнопку в список
private void ea_addButtonToEventList(string text, string IndexInTheEventsArray)
{
     ea_tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
     ea_tableLayoutPanel.Controls.Add(ea_getButton(text, IndexInTheEventsArray), 0, ea_tableLayoutPanel.RowCount++);
}

// создаем кнопку с нужными параметрами
private Button ea_getButton(string text, string index)
{
    Button button = new Button();

    button.Text = text;
    button.AutoSize = true; 
    button.MinimumSize = new Size(500, 50);
    button.TextAlign = ContentAlignment.MiddleCenter;
    button.Font = new Font("Bahnschrift Light", 12f, FontStyle.Regular);
    button.Dock = DockStyle.Fill;
    button.BackColor = Color.White;
    button.Tag = index;

    return button;
}    

下面是一个更改按钮文本的示例(使按钮大于最小值):

例子

在第一个按钮上,您可以看到全文,其余按钮的大小基于 MinSize 参数。据我了解,问题不在于按钮的大小,因为一切都适用于第一个按钮。

预先感谢您的帮助。

c#
  • 1 个回答
  • 37 Views
Martin Hope
dynamic.aerospace.inc
Asked: 2024-09-19 04:09:02 +0000 UTC

如何确定哪个浏览器正在运行以及哪些选项卡打开?

  • 5

我想制作一个将启动的代码,当打开常用的浏览器(Yandex、Chrome、Age)时,它会通知这一点。我还想知道哪些选项卡被打开和关闭。是否可以做到这一点以及我应该朝什么方向挖掘?

python
  • 1 个回答
  • 55 Views
Martin Hope
bgn15
Asked: 2024-09-19 02:36:24 +0000 UTC

如何在画布上的 fillText 中显示数字数组

  • 5

我在画布上创建了一系列正方形。如何从数字数组中添加数值。以便数字按顺序显示在方块上。

const cardArray =[1,2,3,4,5,6,7,8,9,10];
// Рисуем квадрат
function draw_square(cellIdx) {
    let i = 0;
    i ++;
    ctx.fillStyle = 'green';       
    ctx.fillRect(x, y, 55, 55);
    ???  ctx.fillText(cardArray[i], x, y);
}

这是我的代码。我添加了一个正方形数组。添加了一个数字数组。我需要数组中的数字来对每个方块进行编号。我在每个方块中显示了整个数组。

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>javascript Canvas 15taggame</title>
<style>
    body {
      text-align: center;
    }
    #canvas {
      border: 2px solid green;
      background-color: lightblue;  
    }
</style>
</head>
<body>
    <h1>javascript Canvas Array_Square</h1>
    <p id="gameStateEl"></p>
    <canvas id="canvasElement"></canvas>

<script>
const canvas = document.getElementById('canvasElement');
const ctx = canvas.getContext("2d");
const CELL_SIZE = 100;
const ROWS = 4, COLS = 4;
const CELL_COUNT = ROWS * COLS;
var cellCol = "teal";
//Позиции на доске
const boardPosition = {x: 0, y: 0, w: COLS * CELL_SIZE, h: ROWS * CELL_SIZE};
canvas.width = boardPosition.x + boardPosition.w;
canvas.height = boardPosition.y + boardPosition.h;
const cells = [];   
var cellIdx = 0;
while (cellIdx < CELL_COUNT) { drawCell(cellIdx ++); }

function drawCell(cellIdx) {
    const val = cells[cellIdx];
    const x = (cellIdx % COLS) * CELL_SIZE;
    const y = (cellIdx / COLS | 0) * CELL_SIZE;
    
    ctx.font = "60px Arial";
    ctx.textAlign = "center";
    ctx.textBaseline = "middle";
    
    ctx.fillStyle = "blue";
    ctx.shadowColor = '#000';
    ctx.fillRect(x, y, CELL_SIZE, CELL_SIZE);
    
    ctx.fillStyle = cellCol;
    ctx.shadowBlur = 4;
    ctx.shadowOffsetX = 0;
    ctx.shadowOffsetY = 2;
    ctx.fillRect(x + 5, y + 5, CELL_SIZE - 10, CELL_SIZE - 10);
    ctx.fillStyle = "white"
    
    const a =[1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8];
    a.forEach((v, i) => {
      <!-- const x = 10 + ((i % 5) * 25) -->
      <!-- const y = 50  + (50 * Math.trunc(i / 5)) -->
      <!-- ctx.fillText(v, x, y) -->
      ctx.fillText(v, x + CELL_SIZE * 0.5, y + CELL_SIZE * 0.5);
    })
    <!-- ctx.fillText(val, x + CELL_SIZE * 0.5, y + CELL_SIZE * 0.5); -->
}
</script>
</body>
</html>
javascript
  • 1 个回答
  • 32 Views
Martin Hope
Slava
Asked: 2024-09-19 02:26:43 +0000 UTC

JS如何清除pdf.js文档对象的页面缓存或者如何不保存它

  • 5

当我获取一个页面(page = doc.getPage),渲染它然后清理它(page.cleanup())时,文档对象(doc)中留下了页面缓存,它会累积并快速填满内存。 doc._transport.#pageCache 和 doc._transport.#pagePromises 是私有的,我还没有找到清除它们的方法(doc.cleanup() 和 doc._transport.startCleanup() 没有帮助,并且 doc.destroy() 清除整个文档对象,并且不能选择继续与他合作)。

请告诉我,除了关闭文档并再次打开(但这需要很长时间)之外,还有什么方法可以清除此缓存或将其关闭吗?版本 pdf.js v3.11.174

javascript
  • 1 个回答
  • 21 Views
Martin Hope
typemoon
Asked: 2024-09-18 21:01:12 +0000 UTC

使用feign客户端,经过jwt授权并为每个请求使用jwt令牌

  • 5

我正在编写微服务。系统中央微服务的 API 通过基于 JWT 令牌(不是 oauth 2)的简单授权进行保护。要访问此微服务的 API,您需要将带有登录名和密码的 POST 请求发送到 /auth/login 地址,接收令牌并在每个资源请求中发送此令牌。该令牌是从服务器在 x-csrf-token 标头中返回的。这是不正确的,但却是事实。从一个新的微服务中,我需要访问该服务的 API,为此我需要登录。对于请求,我将使用 feign 客户端。如何配置 feign 在每个请求上进行身份验证并使用 jwt 令牌?

java
  • 1 个回答
  • 25 Views
上一页
下一页

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5