void DrawStyleSample(Graphics gr, Rectangle rect, XRControlStyleSheet styleSheet) { Region oldClip = gr.Clip; try { gr.Clip = new Region(rect); XRControlStyle titleStyle = styleSheet[ReportBuilder.StyleNameTitle]; XRControlStyle fieldCaptionStyle = styleSheet[ReportBuilder.StyleNameFieldCaption]; XRControlStyle fieldStyle = styleSheet[ReportBuilder.StyleNameDataField]; RectangleF lineRect = rect; DrawLineByStyle(gr, ref lineRect, titleStyle, picPreview.SRTitle); DrawLineByStyle(gr, ref lineRect, fieldCaptionStyle, picPreview.SRCaption); DrawLineByStyle(gr, ref lineRect, fieldStyle, picPreview.SRData); } finally { gr.Clip = oldClip; oldClip.Dispose(); } }
void UpdateImage() { Image img = new Bitmap(CDS.Shared.Resources.Properties.Resources.WizStyles); //ResourceImageHelper.CreateBitmapFromResources("Images.WizStyles.gif", typeof(LocalResFinder)); XRControlStyleSheet styleSheet = GetStyleSheet(); if (styleSheet != null) { Bitmap newImage = new Bitmap(img.Width, img.Height); Graphics gr = Graphics.FromImage(newImage); using (gr) { gr.DrawImage(img, 0, 0); Rectangle rect = new Rectangle(43, 87, 148, 127); DrawStyleSample(gr, rect, styleSheet); img.Dispose(); img = newImage; } } picPreview.Image = img; //Image img = ResourceImageHelper.CreateBitmapFromResources("Images.WizStyles.gif", typeof(LocalResFinder)); //XRControlStyleSheet styleSheet = GetStyleSheet(); //if (styleSheet != null) //{ // Bitmap newImage = new Bitmap(img.Width, img.Height); // Graphics gr = Graphics.FromImage(newImage); // using (gr) // { // gr.DrawImage(img, 0, 0); // Rectangle rect = new Rectangle(43, 87, 148, 127); // DrawStyleSample(gr, rect, styleSheet); // img.Dispose(); // img = newImage; // } //} //picPreview.Image = img; }