Photonic crystal is a kind of periodic optical nanostructure consisting of two or more materials with different dielectric constants, which has attracted great deal of attention because of its wide range of potential applications in the field of optics. Photonic crystal can be fabricated into one-, or two-, or three- dimensional one. Among them, the two-dimensional photonic crystal turns into a hot focus due to its fantastic optical and electrical properties and relatively simple fabrication technique. Since the tunable band gaps of two-dimensional photonic crystals are beneficial to designing the novel optical devices, to study their optical and electrical properties for controlling the electromagnetic wave is quite valuable in both theoretical and practical aspects. In this work, we propose a new type of two-dimensional function photonic crystal, which can tune the band gaps of photonic crystals. The two-dimensional function photonic crystal is different from the traditional photonic crystal composed of medium columns with spatially invariant dielectric constants, since the dielectric constants of medium column are the functions of space coordinates. Specifically, the photorefractive nonlinear optical effect or electro-optic effect is utilized to turn the dielectric constant of medium column into the function of space coordinates, which results in the formation of two-dimensional function photonic crystal. We use the plane-wave expansion method to derive the eigen-equations for the TE and TM mode. By the Fourier transform, we obtain the Fourier transform form (G) for the dielectric constant function (r) of two-dimensional function photonic crystal, which is more complicated than the Fourier transform in traditional two-dimensional photonic crystal. The calculation results indicate that when the dielectric constant of medium column is a constant, the Fourier transforms for both of them are the same, which implies that the traditional two-dimensional photonic crystal is a special case for the two-dimensional function photonic crystal. Based on the above theory, we calculate the band gap structure of two-dimensional function photonic crystal, especially investigate in detail the corresponding band gap structures of TE and TM modes. The function of dielectric constant can be described as (r) = kr + b, in which k and b are adjustable parameters. Through comparing the calculation results for both kinds of photonic crystals, we can find that the band structures of TE and TM modes in two-dimensional function photonic crystals are quite different from those in traditional two-dimensional photonic crystal. Adjusting parameter k, we can successfully change the number, locations and widths of band gaps, indicating that the band gap structure of two-dimensional function photonic crystal is tunable. These results provide an important design method and theoretical foundation for designing optical devices based on two-dimensional photonic crystal.