Photonic crystals (PCs), composed of nanoparticles as building blocks, possess a unique photonic band gap (PBG). While incorporated with fluorescent materials such as quantum dots or dyes, the PCs could provide opportunities to expand their applications in anticounterfeiting and optical information security. Selecting suitable nanounits that can act as building blocks for constructing PCs and meanwhile serve as ideal carriers for fluorescent materials to maintain their intrinsic fluorescent properties has become a crucial challenge. In this study, carbon dots embedded ZIF-8 (ZIF-8/CDs) nanoparticles with different particle sizes were prepared, and ZIF-8/CDs-based PCs were successfully obtained via hand-writing and microfluidic technology. The CDs embedded in the ZIF-8 nanoparticles could effectively prevent the aggregation-caused quenching (ACQ) effect, resulting in enhanced fluorescence stability even in the solid form, which demonstrates that ZIF-8 could serve as ideal carriers for CDs. In this process, the monodispersity of the ZIF-8/CDs nanoparticles with a certain amount of CDs was maintained and could be used as building blocks for the construction of PCs. Consequently, dual-mode PCs exhibiting both PBGs and fluorescence characteristics were successfully obtained. Finally, ZIF-8/CDs-based PC beads with different structural colors and with/without CDs were employed as pixels to create an encrypted patterned array. The array can reveal an optical pattern via structural colors under visible light and a different pattern via fluorescence under UV light. The highly fluorescence-stable ZIF-8/CDs-based PCs explored in this study have paved the way for developing dual-mode optical encryption.