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


Golang walk.RGB函数代码示例

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


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

示例1: createBitmap

func createBitmap() *walk.Bitmap {
	bounds := walk.Rectangle{Width: 200, Height: 200}

	bmp, _ := walk.NewBitmap(bounds.Size())

	succeeded := false
	defer func() {
		if !succeeded {
			bmp.Dispose()
		}
	}()

	canvas, _ := walk.NewCanvasFromImage(bmp)
	defer canvas.Dispose()

	brushBmp, _ := walk.NewBitmapFromFile("../img/plus.png")
	defer brushBmp.Dispose()

	brush, _ := walk.NewBitmapBrush(brushBmp)
	defer brush.Dispose()

	canvas.FillRectangle(brush, bounds)

	font, _ := walk.NewFont("Times New Roman", 40, walk.FontBold|walk.FontItalic)
	defer font.Dispose()

	canvas.DrawText("Walk Drawing Example", font, walk.RGB(0, 0, 0), bounds, walk.TextWordbreak)

	succeeded = true
	return bmp
}
开发者ID:IniZio,项目名称:Go,代码行数:31,代码来源:walkerGUI.go

示例2: drawStuff

func (mw *MainWindow) drawStuff(canvas *walk.Canvas, updateBounds walk.Rectangle) error {
	bmp := createBitmap()
	defer bmp.Dispose()

	bounds := mw.paintWidget.ClientBounds()

	rectPen, _ := walk.NewCosmeticPen(walk.PenSolid, walk.RGB(255, 0, 0))
	defer rectPen.Dispose()

	canvas.DrawRectangle(rectPen, bounds)

	ellipseBrush, _ := walk.NewHatchBrush(walk.RGB(0, 255, 0), walk.HatchCross)
	defer ellipseBrush.Dispose()

	canvas.FillEllipse(ellipseBrush, bounds)

	linesBrush, _ := walk.NewSolidColorBrush(walk.RGB(0, 0, 255))
	defer linesBrush.Dispose()

	linesPen, _ := walk.NewGeometricPen(walk.PenDash, 8, linesBrush)
	defer linesPen.Dispose()

	canvas.DrawLine(linesPen, walk.Point{bounds.X, bounds.Y}, walk.Point{bounds.Width, bounds.Height})
	canvas.DrawLine(linesPen, walk.Point{bounds.X, bounds.Height}, walk.Point{bounds.Width, bounds.Y})

	bmpSize := bmp.Size()
	canvas.DrawImage(bmp, walk.Point{(bounds.Width - bmpSize.Width) / 2, (bounds.Height - bmpSize.Height) / 2})

	return nil
}
开发者ID:IniZio,项目名称:Go,代码行数:30,代码来源:walkerGUI.go

示例3: main

func main() {
	rand.Seed(time.Now().UnixNano())

	model := NewFooModel()

	MainWindow{
		Title:  "Walk TableView Example",
		Size:   Size{800, 600},
		Layout: VBox{},
		Children: []Widget{
			PushButton{
				Text:      "Reset Rows",
				OnClicked: model.ResetRows,
			},
			TableView{
				AlternatingRowBGColor: walk.RGB(255, 255, 224),
				CheckBoxes:            true,
				ColumnsOrderable:      true,
				Columns: []TableViewColumn{
					{Title: "#"},
					{Title: "Bar"},
					{Title: "Baz", Format: "%.2f", Alignment: AlignFar},
					{Title: "Quux", Format: "2006-01-02 15:04:05", Width: 150},
				},
				Model: model,
			},
		},
	}.Run()
}
开发者ID:2105666566,项目名称:walk,代码行数:29,代码来源:tableview.go

示例4: main

func main() {
	walk.Initialize(walk.InitParams{PanicOnError: true})
	defer walk.Shutdown()

	rand.Seed(time.Now().UnixNano())

	mainWnd, _ := walk.NewMainWindow()

	mw := &MainWindow{
		MainWindow: mainWnd,
		model:      NewFooModel(),
	}

	mw.SetLayout(walk.NewVBoxLayout())
	mw.SetTitle("Walk TableView Example")

	resetRowsButton, _ := walk.NewPushButton(mw)
	resetRowsButton.SetText("Reset Rows")

	resetRowsButton.Clicked().Attach(func() {
		// Get some fresh data.
		mw.model.ResetRows()
	})

	tableView, _ := walk.NewTableView(mw)

	tableView.SetAlternatingRowBGColor(walk.RGB(255, 255, 224))
	tableView.SetReorderColumnsEnabled(true)

	// Everybody loves check boxes.
	tableView.SetCheckBoxes(true)

	// Don't forget to set the model.
	tableView.SetModel(mw.model)

	mw.SetMinMaxSize(walk.Size{320, 240}, walk.Size{})
	mw.SetSize(walk.Size{800, 600})
	mw.Show()

	mw.Run()
}
开发者ID:etel,项目名称:walk,代码行数:41,代码来源:tableview.go

示例5: RunMainWindow

func RunMainWindow() error {
	if _, err := (MainWindow{
		Name:    "mainWindow", // Name is needed for settings persistence
		Title:   "Walk Settings Example",
		MinSize: Size{800, 600},
		Layout:  VBox{},
		Children: []Widget{
			TableView{
				Name: "tableView", // Name is needed for settings persistence
				AlternatingRowBGColor: walk.RGB(255, 255, 200),
				ColumnsOrderable:      true,
				Columns: []TableViewColumn{
					{DataMember: "Index"},
					{DataMember: "Bar"},
					{DataMember: "Baz", Format: "%.2f", Alignment: AlignFar},
					{DataMember: "Quux", Format: "2006-01-02 15:04:05", Width: 150},
				},
				Model: NewFooModel(),
			}},
	}.Run()); err != nil {
		return err
	}

	return nil
}
开发者ID:2105666566,项目名称:walk,代码行数:25,代码来源:settings.go

示例6: main

func main() {
	model := NewClipsModel()

	MainWindow{
		Title:  "VitecTV",
		Size:   Size{800, 600},
		Layout: VBox{},
		Children: []Widget{
			PushButton{
				Text:      "Actualizar Lista",
				OnClicked: model.ResetRows,
			},
			TableView{
				AlternatingRowBGColor: walk.RGB(255, 255, 224),
				CheckBoxes:            true,
				ColumnsOrderable:      true,
				Columns: []TableViewColumn{
					{Title: "ID"},
					{Title: "Titulo"},
					{Title: "Duração"},
					{Title: "Data", Format: "2006-01-02 15:04:05", Width: 150},
				},
				Model: model,
			},
			PushButton{
				Text:      "Converter",
				OnClicked: model.Select,
			},
			TextEdit{AssignTo: &model.output, ReadOnly: true},
		},
	}.Run()
}
开发者ID:thesyncim,项目名称:ae2vod,代码行数:32,代码来源:ae2vod.go

示例7: main

func main() {
	var mw *walk.MainWindow
	var c1 *walk.Composite
	var c2 *walk.Composite

	bmp, err := walk.NewBitmapFromFile("../../img/plus.png")
	if err != nil {
		panic(err)
	}
	defer bmp.Dispose()

	MainWindow{
		AssignTo: &mw,
		Title:    "Background Example",
		Layout:   VBox{MarginsZero: true},
		MinSize:  Size{300, 400},
		Children: []Widget{
			Composite{
				AssignTo: &c1,
				Layout:   VBox{},
				Children: []Widget{
					TextEdit{},
				},
			},
			Composite{
				AssignTo: &c2,
				Layout:   VBox{},
				Children: []Widget{
					TextEdit{},
				},
			},
			ImageView{
				Image: bmp,
			},
		},
	}.Create()

	scb, err := walk.NewSolidColorBrush(walk.RGB(255, 0, 0))
	if err != nil {
		panic(err)
	}
	defer scb.Dispose()

	c1.SetBackground(scb)

	bmb, err := walk.NewBitmapBrush(bmp)
	if err != nil {
		panic(err)
	}
	defer bmb.Dispose()

	c2.SetBackground(bmb)

	mw.Show()
	mw.Run()
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:56,代码来源:main.go

示例8: CreateProj_Query

/**
** 查看所有项目的方法
**/
func CreateProj_Query(owner walk.Form) {
	var dlg *walk.Dialog
	var tv *walk.TableView
	var dialog = Dialog{}
	model := xorm.NewProjectModel()

	dialog.AssignTo = &dlg
	dialog.Title = "项目管理"
	dialog.Layout = VBox{}
	dialog.MinSize = Size{650, 300}
	dialog.Children = []Widget{
		TableView{
			AssignTo:              &tv,
			AlternatingRowBGColor: walk.RGB(255, 255, 224),
			ColumnsOrderable:      true,
			Columns: []TableViewColumn{
				{Title: "编号", Width: 50},
				{Title: "名称"},
				{Title: "创建者"},
				{Title: "创建时间", Format: "2006-01-02 15:04:05", Width: 130},
				{Title: "描述", Width: 200},
			},
			Model: model,
		},
		Composite{
			Layout: HBox{},
			Children: []Widget{
				HSpacer{},
				PushButton{
					Text: "创建",
					OnClicked: func() {
						CreateProj_Triggered(owner, model)
					},
				},
				PushButton{
					Text: "删除",
					OnClicked: func() {
						indexs := tv.SelectedIndexes()
						if indexs.Len() == 0 {
							walk.MsgBox(owner, "提示", "请选择要删除的数据", walk.MsgBoxIconError)
							return
						}
						walk.MsgBox(owner, "提示", "确认是否删除此工程", walk.MsgBoxOKCancel)

						obj := model.GetItemByindex(int64(indexs.At(0)))
						xorm.DeleteProjectByObj(obj)
						model.ResetRows()
					},
				},
			},
		},
	}
	dialog.Run(owner)
}
开发者ID:starmoonlove,项目名称:packutil,代码行数:57,代码来源:projectview.go

示例9: main

func main() {
	mw := new(MyWindow)
	if err := (MainWindow{
		AssignTo: &mw.MainWindow,
		MinSize:  Size{800, 600},
		Layout:   HBox{},
		Children: []Widget{

			TabWidget{
				MinSize: Size{700, 500},
				Pages: []TabPage{
					TabPage{
						Title:   "测试1",
						MinSize: Size{500, 300},
						Layout:  HBox{},
						Children: []Widget{
							TableView{
								AlternatingRowBGColor: walk.RGB(255, 255, 224),
								CheckBoxes:            true,
								ColumnsOrderable:      true,
								Columns: []TableViewColumn{
									{Title: "#"},
									{Title: "Bar"},
									{Title: "Baz", Format: "%.2f", Alignment: AlignFar},
									{Title: "Quux", Format: "2006-01-02 15:04:05", Width: 150},
								},
							},
						},
					},
					TabPage{
						Title:   "测试2",
						MinSize: Size{500, 300},
						Layout:  HBox{},
						Children: []Widget{
							Label{
								Text: "测试",
							},
							PushButton{
								Text: "提交",
							},
						},
					},
				},
			},
		},
	}.Create()); err != nil {
		log.Fatal(err)
	}

	mw.Run()
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:51,代码来源:main.go

示例10: main

func main() {
	defer SqlDisConnect(conn)
	_, ex := SqlExec(conn, `select * from dbo.product`, "product")
	Browse("product")
	if ex != nil {
		fmt.Println("can not load product:", ex)
		return
	}

	model := new(productModel)

	MainWindow{
		Title:  "VFP data and Walk table view Example",
		Size:   Size{800, 600},
		Layout: VBox{},
		Children: []Widget{
			PushButton{
				Text: "Reset Rows",
				OnClicked: func() {
					Usein("product")
					_, ex := SqlExec(conn, `select * from dbo.product`, "product")
					if ex != nil {
						fmt.Println("can not reload product:", ex)
						return
					}
					model.ResetRows()
				},
			},
			TableView{
				AlternatingRowBGColor: walk.RGB(255, 255, 224),
				CheckBoxes:            true,
				ReorderColumnsEnabled: true,
				Columns: []TableViewColumn{
					{Title: "产品编号"},
					{Title: "产品名称"},
					{Title: "产品价格", Format: "%.2f", Alignment: AlignFar},
					{Title: "类别"},
				},
				Model: model,
			},
		},
	}.Run()
}
开发者ID:enderlu,项目名称:vfp,代码行数:43,代码来源:xgrid.go

示例11: main

func main() {
	rand.Seed(time.Now().UnixNano())

	model := NewFooModel()

	var tv *walk.TableView

	MainWindow{
		Title:  "Walk TableView Example",
		Size:   Size{800, 600},
		Layout: VBox{MarginsZero: true},
		Children: []Widget{
			PushButton{
				Text:      "Reset Rows",
				OnClicked: model.ResetRows,
			},
			PushButton{
				Text: "Select first 5 even Rows",
				OnClicked: func() {
					tv.SetSelectedIndexes([]int{0, 2, 4, 6, 8})
				},
			},
			TableView{
				AssignTo:              &tv,
				AlternatingRowBGColor: walk.RGB(255, 255, 224),
				CheckBoxes:            true,
				ColumnsOrderable:      true,
				MultiSelection:        true,
				Columns: []TableViewColumn{
					{Title: "#"},
					{Title: "Bar"},
					{Title: "Baz", Format: "%.2f", Alignment: AlignFar},
					{Title: "Quux", Format: "2006-01-02 15:04:05", Width: 150},
				},
				Model: model,
				OnSelectedIndexesChanged: func() {
					fmt.Printf("SelectedIndexes: %v\n", tv.SelectedIndexes())
				},
			},
		},
	}.Run()
}
开发者ID:Ryanker,项目名称:walk,代码行数:42,代码来源:tableview.go

示例12: NewMyWidget

func NewMyWidget(parent walk.Container) (*MyWidget, error) {
	w := new(MyWidget)

	if err := walk.InitChildWidget(
		w,
		parent,
		myWidgetWindowClass,
		winapi.WS_VISIBLE,
		0); err != nil {

		return nil, err
	}

	bg, err := walk.NewSolidColorBrush(walk.RGB(0, 255, 0))
	if err != nil {
		return nil, err
	}
	w.SetBackground(bg)

	return w, nil
}
开发者ID:richardjoo,项目名称:walk,代码行数:21,代码来源:externalwidgets.go

示例13: main

func main() {
	font := Font{
		Family:    "Times New Roman",
		PointSize: 13,
		Bold:      true,
	}
	usr, _ := user.Current()
	usrModel := env.NewModel(0)
	sysModel := env.NewModel(1)
	var usrTableView, sysTableView *walk.TableView
	var mw *walk.MainWindow
	MainWindow{
		Title:    "Enviroment Variable",
		Size:     Size{600, 700},
		Layout:   VBox{},
		AssignTo: &mw,
		Font:     font,
		Children: []Widget{
			VSplitter{
				Children: []Widget{
					GroupBox{
						Title:  "User variables for " + usr.Username,
						Font:   font,
						Layout: VBox{},
						Children: []Widget{
							TableView{
								AssignTo:              &usrTableView,
								AlternatingRowBGColor: walk.RGB(255, 255, 224),
								ColumnsOrderable:      true,
								Columns: []TableViewColumn{
									{Title: "name", Width: 200},
									{Title: "value"},
								},
								LastColumnStretched: true,
								Model:               usrModel,
								OnItemActivated: func() {
									index := usrTableView.CurrentIndex()
									if index != -1 {
										EditVariable(mw, usrModel, usrModel.GetVariable(index).Name, usrModel.GetVariable(index).Value)
									}
								},
							},
							Composite{
								Layout: HBox{},
								Children: []Widget{
									HSpacer{},
									PushButton{
										Text: "New...",
										OnClicked: func() {
											NewVariable(mw, usrModel)
										},
									},
									PushButton{
										Text: "Edit...",
										OnClicked: func() {
											index := usrTableView.CurrentIndex()
											if index != -1 {
												EditVariable(mw, usrModel, usrModel.GetVariable(index).Name, usrModel.GetVariable(index).Value)
											}
										},
									},
									PushButton{
										Text: "Delete",
										OnClicked: func() {
											index := usrTableView.CurrentIndex()
											if index != -1 {
												DeleteVariable(mw, usrModel, usrModel.GetVariable(index).Name)
											}
										},
									},
								},
							},
						},
					},
					GroupBox{
						Title:  "System variables",
						Font:   font,
						Layout: VBox{},
						Children: []Widget{
							TableView{
								AssignTo:              &sysTableView,
								AlternatingRowBGColor: walk.RGB(255, 255, 224),
								ColumnsOrderable:      true,
								Columns: []TableViewColumn{
									{Title: "Variable", Width: 200},
									{Title: "Value"},
								},
								LastColumnStretched: true,
								Model:               sysModel,
								OnItemActivated: func() {
									index := sysTableView.CurrentIndex()
									if index != -1 {
										EditVariable(mw, sysModel, sysModel.GetVariable(index).Name, sysModel.GetVariable(index).Value)
									}
								},
							},
							Composite{
								Layout: HBox{},
								Children: []Widget{
									HSpacer{},
//.........这里部分代码省略.........
开发者ID:ZhuBicen,项目名称:EnvSetting,代码行数:101,代码来源:main.go

示例14: serverWindow

func serverWindow() {
	mw.Close()

	if err := (MainWindow{
		AssignTo: &mw,
		DataBinder: DataBinder{
			AssignTo:       &db,
			DataSource:     Input,
			ErrorPresenter: ErrorPresenterRef{&ep},
		},
		Title:   config.APP_NAME + "                                                          【 运行模式 -> 服务器 】",
		MinSize: Size{1100, 700},
		Layout:  VBox{ /*MarginsZero: true*/ },
		Children: []Widget{

			Composite{
				AssignTo: &setting,
				Layout:   Grid{Columns: 2},
				Children: []Widget{
					// 任务列表
					TableView{
						ColumnSpan:            1,
						MinSize:               Size{550, 350},
						AlternatingRowBGColor: walk.RGB(255, 255, 224),
						CheckBoxes:            true,
						ColumnsOrderable:      true,
						Columns: []TableViewColumn{
							{Title: "#", Width: 45},
							{Title: "任务", Width: 110 /*, Format: "%.2f", Alignment: AlignFar*/},
							{Title: "描述", Width: 370},
						},
						Model: spiderMenu,
					},

					VSplitter{
						ColumnSpan: 1,
						MinSize:    Size{550, 0},
						Children: []Widget{

							VSplitter{
								Children: []Widget{
									Label{
										Text: "自定义输入:(多任务之间以 | 隔开,选填)",
									},
									LineEdit{
										Text: Bind("Keywords"),
									},
								},
							},

							VSplitter{
								Children: []Widget{
									Label{
										Text: "*并发协程:(1~99999)",
									},
									NumberEdit{
										Value:    Bind("ThreadNum", Range{1, 99999}),
										Suffix:   "",
										Decimals: 0,
									},
								},
							},

							VSplitter{
								Children: []Widget{
									Label{
										Text: "采集页数:(选填)",
									},
									NumberEdit{
										Value:    Bind("MaxPage"),
										Suffix:   "",
										Decimals: 0,
									},
								},
							},

							VSplitter{
								Children: []Widget{
									Label{
										Text: "*分批输出大小:(1~5,000,000 条数据)",
									},
									NumberEdit{
										Value:    Bind("DockerCap", Range{1, 5000000}),
										Suffix:   "",
										Decimals: 0,
									},
								},
							},

							VSplitter{
								Children: []Widget{
									Label{
										Text: "*间隔基准:",
									},
									ComboBox{
										Value:         Bind("BaseSleeptime", SelRequired{}),
										BindingMember: "Uint",
										DisplayMember: "Key",
										Model:         GuiOpt.SleepTime,
									},
//.........这里部分代码省略.........
开发者ID:Huangyan9188,项目名称:pholcus,代码行数:101,代码来源:server.go

示例15: serverWindow

func serverWindow() {
	mw.Close()

	if err := (MainWindow{
		AssignTo: &mw,
		DataBinder: DataBinder{
			AssignTo:       &db,
			DataSource:     Input,
			ErrorPresenter: ErrorPresenterRef{&ep},
		},
		Title:   config.FULL_NAME + "                                                          【 运行模式 -> 服务器 】",
		MinSize: Size{1100, 700},
		Layout:  VBox{MarginsZero: true},
		Children: []Widget{

			Composite{
				AssignTo: &setting,
				Layout:   Grid{Columns: 2},
				Children: []Widget{
					// 任务列表
					TableView{
						ColumnSpan:            1,
						MinSize:               Size{550, 450},
						AlternatingRowBGColor: walk.RGB(255, 255, 224),
						CheckBoxes:            true,
						ColumnsOrderable:      true,
						Columns: []TableViewColumn{
							{Title: "#", Width: 45},
							{Title: "任务", Width: 110 /*, Format: "%.2f", Alignment: AlignFar*/},
							{Title: "描述", Width: 370},
						},
						Model: spiderMenu,
					},

					VSplitter{
						ColumnSpan: 1,
						MinSize:    Size{550, 450},
						Children: []Widget{

							VSplitter{
								Children: []Widget{
									Label{
										Text: "自定义配置(多任务请分别多包一层“<>”)",
									},
									LineEdit{
										Text: Bind("Keyins"),
									},
								},
							},

							VSplitter{
								Children: []Widget{
									Label{
										Text: "*采集上限(默认限制URL数):",
									},
									NumberEdit{
										Value:    Bind("Limit"),
										Suffix:   "",
										Decimals: 0,
									},
								},
							},

							VSplitter{
								Children: []Widget{
									Label{
										Text: "*并发协程:(1~99999)",
									},
									NumberEdit{
										Value:    Bind("ThreadNum", Range{1, 99999}),
										Suffix:   "",
										Decimals: 0,
									},
								},
							},

							VSplitter{
								Children: []Widget{
									Label{
										Text: "*分批输出大小:(1~5,000,000 条数据)",
									},
									NumberEdit{
										Value:    Bind("DockerCap", Range{1, 5000000}),
										Suffix:   "",
										Decimals: 0,
									},
								},
							},

							VSplitter{
								Children: []Widget{
									Label{
										Text: "*暂停时长参考:",
									},
									ComboBox{
										Value:         Bind("Pausetime", SelRequired{}),
										DisplayMember: "Key",
										BindingMember: "Int64",
										Model:         GuiOpt.Pausetime,
									},
//.........这里部分代码省略.........
开发者ID:ZenithDandelion,项目名称:pholcus,代码行数:101,代码来源:server.go


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