In this paper, the structural stability, mechanical properties, electronic structure and optical properties of alpha-BC2N, beta-BCN and gamma-BC2N were studied by the first-principles based on density functional theory. Cohesive energy and phonon spectra verify that these structures are stable. When studying the mechanical properties, it is found that the gamma-BC2N Poisson's ratio is 0.41, which has better resistance to compression in the direction perpendicular to the plane; the Poisson of alpha-BC2N and beta-BCN is relatively large and can be used as a flexible film material. The band-gap values of the three materials are 2.541, 0.241 and 1.711 eV, respectively, which are direct band-gap semiconductors. B and N atoms break the original structure symmetry, and band gap values of these structures are enlarged. The band gap values of the three semiconductors are regulated by strain, and the band gaps are narrowed as the strain value increases. Optical properties indicate that the new structure can respond to photons in a fairly wide range of energies. Among them, the photon absorption behavior of alpha-BC2N and gamma-BC2N starts from the visible region, while beta-BCN absorbs photons from the infrared to the ultraviolet energy range. At the same time, the reflectivity of the three materials is very low, the photon transmittance is very strong, and it can be used as an absorbing material.