进制转换:

bin = Convert.ToString(dec, 2);

缺位补零:

bin = bin.PadLeft(8, '0');