DevExpress
2014.04.24 10:45
Ribbon Control에서 우측에 로그(이미지)삽입하는 방법
다물칸 주소복사
조회 수 1386 추천 수 0 댓글 0
구분 | 팁&트릭 |
---|---|
출처 | http://www.devexpress.com/Support/Center/Question/Details/Q362083 |
데모에서는 짜잔하고 자기들 로고 박았으면서 이에 대한 방법이 명시되지 않아 찾아보았다.
private void ribCtrl_Paint(object sender, PaintEventArgs e) { //if (IsCurrentAbout) // return; DevExpress.XtraBars.Ribbon.ViewInfo.RibbonViewInfo ribbonViewInfo = ribCtrl.ViewInfo; if (ribbonViewInfo == null) return; DevExpress.XtraBars.Ribbon.ViewInfo.RibbonPanelViewInfo panelViewInfo = ribbonViewInfo.Panel; if (panelViewInfo == null) return; Rectangle bounds = panelViewInfo.Bounds; int minX = bounds.X; DevExpress.XtraBars.Ribbon.ViewInfo.RibbonPageGroupViewInfoCollection groups = panelViewInfo.Groups; if (groups == null) return; if (groups.Count > 0) minX = groups[groups.Count - 1].Bounds.Right; Image img = null; if (File.Exists(gMain.pInfo.pathInfo.LogoPath)) // 200x60 { img = Image.FromFile([로고파일경로]); } else img = DevExpress.Utils.Frames.ApplicationCaption8_1.GetImageLogoEx(LookAndFeel); if (bounds.Height < img.Height) return; int offset = (bounds.Height/2) - (img.Height / 2); int width = img.Width + 60; bounds.X = bounds.Width - width; if (bounds.X < minX) return; bounds.Width = width; bounds.Y = offset + 30; bounds.Height = img.Height; e.Graphics.DrawImage(img, bounds.Location); }