Taimer.Hora.toString C# (CSharp) Method

toString() public method

Convierte el objeto Hora en un string
public toString ( ) : string
return string
        public string toString()
        {
            string hr = hora.ToString();
            string mn = min.ToString();
            if (hora < 10)
                hr = "0" + hr;
            if (min < 10)
                mn = "0" + mn;
            return hr + ":" + mn;
        }

Usage Example

        public void initPanelHorario(int minHor, int maxHor)
        {
            pnlHoras.Controls.Clear();
            Hora hora = new Hora(0, 0);
            int posY = 0;
            int horAux = minHor;
            while (horAux <= maxHor) {
                Label lblHora = new Label();
                if (horAux >= 24) {
                    lblHora.Text = "24:00";
                } else {
                    hora.setTiempo(horAux, 0);
                    lblHora.Text = hora.toString();
                }
                lblHora.Location = new Point(20, posY);
                lblHora.ForeColor = Color.White;
                posY += 60;
                horAux++;
                pnlHoras.Controls.Add(lblHora);
            }

            pnlHoras.Height = 1460;
            pnlLunes.Height = 1460;
            pnlMartes.Height = 1460;
            pnlMiercoles.Height = 1460;
            pnlJueves.Height = 1460;
            pnlViernes.Height = 1460;
            pnlSabado.Height = 1460;
            pnlDomingo.Height = 1460;
        }