Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

help on code

afflatusafflatus Member Posts: 5
I want to show a mark before each title to become easy to read but it won't work! what should I do ??

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private int _t;

private Label _show = new Label();
private void button1_Click(object sender, EventArgs e)
{
foreach (object o in panel1.Controls)
{
if (((Label)o).Top > _t)
{
_t = ((Label)o).Top;
label1.Text = _t.ToString();
label2.Text = ((Label)o).Top.ToString();
break;
}

}

_show.Top = _t;
this.panel1.Controls.Add(_show);

if (_t + 40 > panel1.Height)
{
this.panel1.AutoScrollPosition = new Point(0, _t);
_t = 0;
}

}

private void Form1_Load(object sender, EventArgs e)
{

_show.Width = 10;
_show.BackColor = Color.Beige;
_t = 0;
int _top = 20; int _left = 25;
for (int i = 0; i < 61; i++)
{
Label L = new Label();
L.Name = i.ToString() + "label";
L.Text = i.ToString();
L.BackColor = Color.BlueViolet;
L.Top = _top;
L.Left = _left;
_top += 35;
this.panel1.Controls.Add(L);
}
}
}
}
Sign In or Register to comment.