/// <Summary> convert the Color Structure in. net to the icolor interface in ArcGIS Engine. // </Summary> /// <Param name = "color"> the system. Drawing. Color Structure in. Net indicates the argb color. </param> /// <Returns> icolor interface in ArcGIS egnine </returns> Public static icolor convertcolortoicolor (color) { Icolor pcolor = new rgbcolorclass (); Pcolor. RGB = color. B * 65536 + color. g * 256 + color. R; Return pcolor; } Recommended by netizens, you can also use the built-in colortranslator method as follows: Int I = colortranslator. Toole (colordlg. Color ); Pcolor. RGB = I; The test is available. The principle is the same as that of the first method. # Region converts the irgbcolor interface in ArcGIS Engine to the color structure in. net. /// <Summary> /// Convert the irgbcolor interface in ArcGIS Engine to the color structure in. net. /// </Summary> /// <Param name = "prgbcolor"> irgbcolor </param> /// <Returns> the system. Drawing. Color Structure in. Net indicates the argb color. </returns> Public static color convertirgbcolortocolor (irgbcolor prgbcolor) { Return colortranslator. fromole (prgbcolor. RGB ); } # Endregion // Obtain the color from the color palette Color pdotbackcolor; Colordialog colordialog1 = new colordialog (); Colordialog1.allowfullopen = true; Colordialog1.fullopen = true; // Set the color. The "help" button exists in the dialog box. It does not exist by default. Colordialog1.showhelp = true; // Set the initial color of the color dialog box, so if you select "cancel" in the dialog box, the dialog box will re-color Colordialog1.color = color. darkblue; If (colordialog1.showdialog ()! = Dialogresult. Cancel) { Pdotbackcolor = colordialog1.color; Btndotbackcolor. backcolor = pdotbackcolor; } // Convert the color interface to the icolor Interface Icolor color = (icolor) ESRI. ArcGIS. ADF. converter. torgbcolor (pdotbackcolor ); Ifillsymbol pfillsymbol = new simplefillsymbolclass (); // Assign color to pfillsymbol Pfillsymbol. Color = color; |