Пример #1
0
func (app *DemoApp) CreateDeviceResources() {
	if app.render_target.RawPtr() == 0 {
		var rc = w32.GetClientRect(app.hwnd)
		var hwndRenderTargetProperties = d2d.HwndRenderTargetProperties(app.hwnd)
		hwndRenderTargetProperties.PixelSize = d2d.D2D1_SIZE_U{
			uint32(rc.Right - rc.Left),
			uint32(rc.Bottom - rc.Top),
		}
		app.render_target = app.factory.CreateHwndRenderTarget(
			app.factory,
			d2d.RenderTargetProperties(),
			hwndRenderTargetProperties)
		var LightSlateGray = d2d.D2D1_COLOR_F{0x77 / 255., 0x88 / 255., 0x99 / 255., 1}
		var CornflowerBlue = d2d.D2D1_COLOR_F{0x64 / 255., 0x95 / 255., 0xED / 255., 1}
		light_slate_gray_brush := app.render_target.CreateSolidColorBrush(
			app.render_target,
			&LightSlateGray,
			nil)
		defer light_slate_gray_brush.Release(light_slate_gray_brush)
		light_slate_gray_brush.QueryInterface(
			light_slate_gray_brush,
			&(app.light_slate_gray_brush))
		cornflower_blue := app.render_target.CreateSolidColorBrush(
			app.render_target,
			&CornflowerBlue,
			nil)
		defer cornflower_blue.Release(cornflower_blue)
		cornflower_blue.QueryInterface(
			cornflower_blue,
			&(app.cornflower_blue))
	}
}
Пример #2
0
func (this *ControlBase) Invalidate(erase bool) {
	pRect := w32.GetClientRect(this.hwnd)
	if this.isForm {
		w32.InvalidateRect(this.hwnd, pRect, erase)
	} else {
		rc := ScreenToClientRect(this.hwnd, pRect)
		w32.InvalidateRect(this.hwnd, rc.GetW32Rect(), erase)
	}
}
Пример #3
0
func (this *ControlBase) ClientRect() *Rect {
	rect := w32.GetClientRect(this.hwnd)
	return ScreenToClientRect(this.hwnd, rect)
	//    return (*Rect)(rect)
}