当前位置: 首页>>代码示例>>Golang>>正文


Golang gform.EventArg类代码示例

本文整理汇总了Golang中gform.EventArg的典型用法代码示例。如果您正苦于以下问题:Golang EventArg类的具体用法?Golang EventArg怎么用?Golang EventArg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EventArg类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: imgButton_OnPaint

func imgButton_OnPaint(arg *gform.EventArg) {
	if data, ok := arg.Data().(*gform.PaintEventData); ok {
		var b *ImgButton
		if b, ok = arg.Sender().(*ImgButton); ok {
			var bmp *gform.Bitmap
			switch b.state {
			case IBSNormal:
				bmp = newResBitmap(&b.resNormal)
			case IBSMouseHover:
				bmp = newResBitmap(&b.resMouseOver)
			case IBSClick:
				bmp = newResBitmap(&b.resClick)
			}
			if bmp != nil {
				defer bmp.Dispose()

				if b.Height() != bmp.Height() || b.Width() != bmp.Width() {
					b.SetSize(bmp.Size())
				}

				data.Canvas.DrawBitmap(bmp, 0, 0)
			}
		}
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:25,代码来源:imgbutton.go

示例2: onpaint

func onpaint(arg *gform.EventArg) {
	if data, ok := arg.Data().(*gform.PaintEventData); ok {
		if bmp, err := gform.NewBitmapFromResource(
			gform.GetAppInstance(),
			w32.MakeIntResource(IDR_PNG1),
			syscall.StringToUTF16Ptr("PNG"),
			gform.RGB(255, 0, 0)); err == nil {
			data.Canvas.DrawBitmap(bmp, 10, 10)
			bmp.Dispose()
		} else {
			println(err.Error())
		}
	}
}
开发者ID:hoperuin,项目名称:gform,代码行数:14,代码来源:testcanvas.go

示例3: mainform_OnPaint

func mainform_OnPaint(arg *gform.EventArg) {
	var mf *Mainform
	var ok bool
	var data *gform.PaintEventData

	if mf, ok = arg.Sender().(*Mainform); ok {
		if data, ok = arg.Data().(*gform.PaintEventData); ok {
			gResMainformBkColor := gform.RGB(255, 255, 255)
			bkBrush := gform.NewSolidColorBrush(gResMainformBkColor)
			defer bkBrush.Dispose()
			borderBrush := gform.NewSolidColorBrush(gform.RGB(154, 154, 154))
			defer borderBrush.Dispose()
			borderPen := gform.NewPen(w32.PS_COSMETIC|w32.PS_SOLID, 1, borderBrush)
			defer borderPen.Dispose()
			data.Canvas.DrawRect(mf.ClientRect(), borderPen, bkBrush)

			// Draw title bar
			w := mf.Width()
			titleRect := gform.NewRect(1, 1, w-1, 22)
			titleBrush := gform.NewSolidColorBrush(gMainformTitleBarColor)
			defer titleBrush.Dispose()
			data.Canvas.FillRect(titleRect, titleBrush)

			// Draw title text
			f := gform.NewFont("Bauhaus 93", 9, 0)
			defer f.Dispose()
			titleRect.Inflate(-5, 0)
			data.Canvas.DrawText(mf.Caption(), titleRect, w32.DT_LEFT|w32.DT_VCENTER|w32.DT_SINGLELINE, f, gResMainformBkColor)

			// Draw "Drop Here"
			f = gform.NewFont("Bauhaus 93", 25, gform.FontBold)
			defer f.Dispose()
			bodyRect := gform.NewRect(1, 50, w-1, 120)
			data.Canvas.DrawText("Drop Here", bodyRect, w32.DT_CENTER|w32.DT_VCENTER|w32.DT_SINGLELINE, f, gform.RGB(187, 187, 187))

			// Draw drop arrow
			if bmp, err := gform.NewBitmapFromResource(gform.GetAppInstance(), w32.MakeIntResource(IDR_DROPARROW), gResPNG, gResMainformBkColor); err == nil {
				data.Canvas.DrawBitmap(bmp, (w-bmp.Width())/2, 110)
				bmp.Dispose()
			}

			// Draw bottom panel
			h := mf.Height()
			bottomRect := gform.NewRect(1, 150, w-1, h-1)
			data.Canvas.FillRect(bottomRect, titleBrush)
		}
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:48,代码来源:mainform.go

示例4: stateButton_OnPaint

func stateButton_OnPaint(arg *gform.EventArg) {
	if b, ok := arg.Sender().(*StateButton); ok {
		var data *gform.PaintEventData
		if data, ok = arg.Data().(*gform.PaintEventData); ok {
			var bmp *gform.Bitmap
			if b.isChecked {
				bmp = newResBitmap(&b.resChecked)
			} else {
				bmp = newResBitmap(&b.resNormal)
			}
			defer bmp.Dispose()

			data.Canvas.DrawBitmap(bmp, 0, 0)
		}
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:16,代码来源:statebutton.go

示例5: progressButton_OnPaint

func progressButton_OnPaint(arg *gform.EventArg) {
	rc := arg.Sender().ClientRect()

	if pb, ok := arg.Sender().(*ProgressButton); ok {
		pen := gform.NewNullPen()
		defer pen.Dispose()
		brush := gform.NewSolidColorBrush(pb.bgColor)
		defer brush.Dispose()

		var data *gform.PaintEventData
		if data, ok = arg.Data().(*gform.PaintEventData); ok {
			data.Canvas.DrawRect(rc, pen, brush)
		}
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:15,代码来源:progressbutton.go

示例6: stateButton_OnLBUp

func stateButton_OnLBUp(arg *gform.EventArg) {
	if b, ok := arg.Sender().(*StateButton); ok {
		b.SetChecked(!b.Checked())
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:5,代码来源:statebutton.go

示例7: imgButton_OnLBUp

func imgButton_OnLBUp(arg *gform.EventArg) {
	if b, ok := arg.Sender().(*ImgButton); ok {
		b.state = IBSMouseHover
		b.Invalidate(false)
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:6,代码来源:imgbutton.go

示例8: imgButton_OnLBDown

func imgButton_OnLBDown(arg *gform.EventArg) {
	if b, ok := arg.Sender().(*ImgButton); ok {
		b.state = IBSClick
		b.Invalidate(false)
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:6,代码来源:imgbutton.go

示例9: imgButton_OnMouseLeave

func imgButton_OnMouseLeave(arg *gform.EventArg) {
	if b, ok := arg.Sender().(*ImgButton); ok {
		b.state = IBSNormal
		b.Invalidate(false)
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:6,代码来源:imgbutton.go

示例10: progressButton_OnMouseLeave

func progressButton_OnMouseLeave(arg *gform.EventArg) {
	if pb, ok := arg.Sender().(*ProgressButton); ok {
		pb.bgColor = pb.tempColor
		pb.Invalidate(false)
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:6,代码来源:progressbutton.go

示例11: progressButton_OnMouseHover

func progressButton_OnMouseHover(arg *gform.EventArg) {
	if pb, ok := arg.Sender().(*ProgressButton); ok {
		pb.bgColor = pb.highlightColor
		pb.Invalidate(false)
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:6,代码来源:progressbutton.go

示例12: btnPin_OnStateChange

func btnPin_OnStateChange(arg *gform.EventArg) {
	if b, ok := arg.Sender().(*StateButton); ok {
		mainform.EnableTopMost(b.Checked())
	}
}
开发者ID:pkf,项目名称:dropdot,代码行数:5,代码来源:mainform.go


注:本文中的gform.EventArg类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。