首页 \ 问答 \ Rowspan不使用顶行(Rowspan not using top row)

Rowspan不使用顶行(Rowspan not using top row)

我不明白为什么我的列不会跨越我创建的顶行和底行。 它应该看起来像“今天”列在顶部和底部比其他列更高。

这是很多代码,我不确定在不变形或添加新变量(它需要流体高度)的情况下应该切割什么。 JSFiddle: http//jsfiddle.net/DaAwesomeP/aU9Le/

基本HTML布局:

<table id="weatherForecast">
  <tr class="weatherForecast-row-outer">
    <td></td>
  </tr>
  <tr id="weatherForecast-row">
    <td id="weatherForecast-DATE" class="weatherForecast-day  weatherForecast-day-today" rowspan="3">
    <!-- Cell Content for "Today" Here -->
      <td id="weatherForecast-DATE" class="weatherForecast-day ">
      <!-- Cell Content Here -->
      </td>
    </tr>
    <tr class="weatherForecast-row-outer">
      <td></td>
    </tr>
</table>

这是一张显示我想要的图片:


I don't understand why my column won't span to the top and bottom rows I created. It is supposed to look like the "Today" column is taller on the top and bottom then the other columns.

It's a lot of code, and I wasn't sure what I should cut without deforming it all or adding a new variable (it needs a fluid height). JSFiddle: http://jsfiddle.net/DaAwesomeP/aU9Le/

Basic HTML Layout:

<table id="weatherForecast">
  <tr class="weatherForecast-row-outer">
    <td></td>
  </tr>
  <tr id="weatherForecast-row">
    <td id="weatherForecast-DATE" class="weatherForecast-day  weatherForecast-day-today" rowspan="3">
    <!-- Cell Content for "Today" Here -->
      <td id="weatherForecast-DATE" class="weatherForecast-day ">
      <!-- Cell Content Here -->
      </td>
    </tr>
    <tr class="weatherForecast-row-outer">
      <td></td>
    </tr>
</table>

Here is an image that shows what I want:


原文:https://stackoverflow.com/questions/19736096
更新时间:2023-02-28 15:02

最满意答案

我已经测试了你的代码,实际上它们确实重叠了。 (每次迭代时,背景颜色中的红色增加y_value / 2)。

在此处输入图像描述

将PictureBox的高度设置为(fe)20,你会发现它们显示得很好:

Label[] l = new Label[15];
PictureBox[] pic1 = new PictureBox[15];
int y_value = 47;

for (int i = 0; i < 6; ++i)
{

    l[i] = new Label
    {
        Text = "Test Text",
        Font = new System.Drawing.Font("Calibri", 8, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (128))),
        ForeColor = System.Drawing.Color.White,
        BackColor = System.Drawing.Color.FromArgb(1, 0, 64),
        Size = new System.Drawing.Size(145, 20),
        Location = new Point(30, y_value),
        Anchor = AnchorStyles.Left,
        Visible = true
    };

    pic1[i] = new PictureBox
    {
        Size = new System.Drawing.Size(400, 20),
        Location = new Point(2, y_value - 10),
        Anchor = AnchorStyles.Left,
        Visible = true,
        BackColor = Color.FromArgb(y_value/2, 0, 0)
    };

    y_value += 37;
}

this.Controls.AddRange(l);
this.Controls.AddRange(pic1);

在此处输入图像描述


I've tested your code and in fact they do overlap. (increased red in backgroundcolor by y_value / 2 every iteration).

enter image description here

set height of your PictureBox to (f.e.) 20 and you will see that they show up just fine:

Label[] l = new Label[15];
PictureBox[] pic1 = new PictureBox[15];
int y_value = 47;

for (int i = 0; i < 6; ++i)
{

    l[i] = new Label
    {
        Text = "Test Text",
        Font = new System.Drawing.Font("Calibri", 8, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (128))),
        ForeColor = System.Drawing.Color.White,
        BackColor = System.Drawing.Color.FromArgb(1, 0, 64),
        Size = new System.Drawing.Size(145, 20),
        Location = new Point(30, y_value),
        Anchor = AnchorStyles.Left,
        Visible = true
    };

    pic1[i] = new PictureBox
    {
        Size = new System.Drawing.Size(400, 20),
        Location = new Point(2, y_value - 10),
        Anchor = AnchorStyles.Left,
        Visible = true,
        BackColor = Color.FromArgb(y_value/2, 0, 0)
    };

    y_value += 37;
}

this.Controls.AddRange(l);
this.Controls.AddRange(pic1);

enter image description here

相关问答

更多
  • 只需使用+=运算符添加一个事件处理程序: picOneFaceUpA.MouseClick += new MouseEventHandler(your_event_handler); 要么: picOneFaceUpA.MouseClick += new MouseEventHandler((o, a) => code here); Just add an event handler using the += operator: picOneFaceUpA.MouseClick += new Mouse ...
  • 我猜你正在使这件事变得更加复杂。 为了更好地理解和理解,我假定当你说我需要将一个图片框(pictureBox11到pictureBox30)添加到一个数组。 你的意思是你的表单上有30多个PictureBox ,每个PictureBox使用命名约定,每个命名约定都被命名为“pictureBoxX”,其中“X”是1,2,3 ... 30,31。 然后,您想要在表单上获得(连续?)一组“图片框”以使其不可见。 我希望这是正确的。 为了简单地使图片框不可见,我不认为需要数组。 如果名称与“pictureBoxX” ...
  • 感谢LarsTech,它已得到修复。 使picturebox在循环内移动, this.controls.add更改为PIC_Map.controls.add和Ore_Area.Parent = PIC_Map; 被删除。 Thanks to LarsTech, it has been fixed. Making the picturebox is moved inside the loop, this.controls.add is changed to PIC_Map.controls.add and O ...
  • 我已经测试了你的代码,实际上它们确实重叠了。 (每次迭代时,背景颜色中的红色增加y_value / 2)。 将PictureBox的高度设置为(fe)20,你会发现它们显示得很好: Label[] l = new Label[15]; PictureBox[] pic1 = new PictureBox[15]; int y_value = 47; for (int i = 0; i < 6; ++i) { l[i] = new Label { Text = "Test ...
  • 表单容器(PictureBox或Panel)的缩放方法可以用来调整它的大小,所有的子表单都应该使用SizeMode来扩展它们,以便它们遵循缩放。 The scale method of the forms container (PictureBox or Panel) can be used to resize it, all child forms should have the SizeMode to stretch so that they will follow the scaling.
  • 您需要在for循环中移动代码,以创建多个PictureBox 。 目前,您只创建一个实例,为每个blastHole重用它。 尝试这样的事情: private void CreateBlastHole(string[] pointCoordinate) { for (int i = 0; i < pointCoordinate.Length; i++) { PictureBox blastHole = new PictureBox(); blastHole.H ...
  • 工作范例: Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles PictureBox1.Click, ...., PictureBox50.Click Dim pic As PictureBox = CType(Controls(CType(sender, PictureBox).Name), PictureBox) 'now you have ...
  • 您可以通过sender参数访问PictureBox 。 所以试试这个: PictureBox[] txtTeamNames; void YourMethod() { Image myImage = Image.FromFile("image/Untitled6.png"); txtTeamNames = new PictureBox[5]; //The same as your code } void clcikeventhandle(object sen ...
  • 你不是在这里使用错误的长度吗? for (int i = 0; i < picturebox.Length; i++) 应该 for (int i = 0; i < picturebox[0].Length; i++) 当您加载图片框时,您只从索引13开始,因此您需要在13处启动隐藏循环,或检查是否为空。 for (int i = 13; i < picturebox[0].Length; i++) { ... } 要么 for (int i = 0; i < picturebox[0].Length ...
  • 您可以像这样添加图片框点击事件: picturebox[0, 0].Click += picturebox_Click; // in your form load event, this is only for one picture box void picturebox_Click(object sender, EventArgs e) { // do whatever you want to do when the picture box is clicked } You can add ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)