Determining the haplotypes in a diploid individual is a major technical challenge in genetic studies of human complex traits. Here we report a method of molecular haplotyping by directly imaging multiple polymorphic sites on individual DNA molecules simultaneously. DNA fragments amplified by long-range PCR were labeled with fluorescent dyes at each polymorphic site using a modified gap-filled padlock probe ligation approach. The labeled DNA molecules were then stretched into linear form on a functionalized glass surface and imaged with multicolor total internal reflection fluorescence (TIRF) microscopy. By determining the colors and positions of the fluorescent labels with respect to the backbone at polymorphic sites, the haplotype can be inferred accurately, in a manner similar to reading a barcode, even when the DNA fragments are not fully labeled. The feasibility of this technology is demonstrated by the determination of the haplotype of a 9.3-kbp DNA fragment containing four SNPs.