SidebarLibrary.WinControls.OutlookBar.DrawBandBitmap C# (CSharp) Метод

DrawBandBitmap() приватный Метод

private DrawBandBitmap ( IntPtr hDC, OutlookBarBand band, int bandIndex, Rectangle drawingRect ) : void
hDC System.IntPtr
band OutlookBarBand
bandIndex int
drawingRect System.Drawing.Rectangle
Результат void
		void DrawBandBitmap(IntPtr hDC, OutlookBarBand band, int bandIndex, Rectangle drawingRect)
		{
			// Don't do GDI+ calls since you cannot mix them with GDI calls
			if ( !HasChild(bandIndex))
			{
				Color cb = band.Background;
				IntPtr brush = WindowsAPI.CreateSolidBrush(ColorUtil.RGB(cb.R, cb.G, cb.B));

				RECT rect;
				rect.left = drawingRect.Left;
				rect.top = drawingRect.Top;
				rect.right = drawingRect.Left + drawingRect.Width;
				rect.bottom = drawingRect.Top + drawingRect.Height;

				WindowsAPI.FillRect(hDC, ref rect, brush);
				WindowsAPI.DeleteObject(brush);
			}

			if ( HasChild(bandIndex) )
			{
				// Paint child control into memory device context
				Control child = bands[bandIndex].ChildControl;
				bool visible = child.Visible;
				child.Visible = true;

				// Change viewport if needed
				WindowsAPI.SendMessage( child.Handle,
					(int)Msg.WM_ERASEBKGND, (int)hDC, 0);
				WindowsAPI.SendMessage( child.Handle,
					(int)Msg.WM_PAINT, (int)hDC, 0);
				if ( !visible) child.Visible = false;
			}
			else
			{
				DrawItems(Graphics.FromHdc(hDC), drawingRect, bands[bandIndex]);
			}
		}