Notifications
Clear all

[Closed] dotnet btn – get read of square

Please help me make this button appearance correct. I have made a record btn with dotnet and images with transparency converted to string. It gives a square that I don’t want.

Here is the code:

(
   	local COL1 = (dotNetClass "System.Drawing.Color").fromARGB (((colorMan.getColor #background) * 255)[1] as integer) (((colorMan.getColor #background) * 255)[2] as integer) (((colorMan.getColor #background) * 255)[3] as integer)
   	local rec_grey = "iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADImlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4zLWMwMTEgNjYuMTQ1NjYxLCAyMDEyLzAyLzA2LTE0OjU2OjI3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo5MDEyRUZEOEJGQUExMUUyOERCOEUxRDdFMEFBNTE1QyIgeG1wTU06R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xy1LTSoY/RaE5RqQm/A4qtvAfPLmH7xZQz6qvGxySyDOde4x5pherj9riAOUKrNNimpqPF6Y0fyCnCevtwEXW9M8uLOsTPAtUWkxy/g+sleGcy5xr3PbV7EbRX4NFCPfWo92EN+kM2iJfUepTqn1GCcBjgqbsDM/uexEu/D3Utfy2DOtSGzG6f1dgyGtuCwuxpRcf1ByrsSCBzcpdFmuukLDJLRCN37LD2HfkGDE1aCRYM+oRinaZlPii6cCTUhRthmsGbCgfUVkY143zzenjYyO0xf4YTJiQHJg7hUiQGrG33WDTjlDqKfUgy2duKNxxrxuChlaCtyl/YhKFlUFFPPKLU4ZC1DN83gVEMbBuhwb3M73oxsxbP2SjSU2lM168v6L3KNCPKflscTqyu1J1sFMb1Da8ju1JmyLebSdL3DlayhvZI1OefCin8AZflnIYFyotMAAAAASUVORK5CYII="
   	local ConvertClass = dotNetClass "System.Convert"
   	local ImageClass = dotNetClass "System.Drawing.Image"
   	fn StringToImage str = --  http://lonerobot.net/ 
   	(
   		byteArr = ConvertClass.FromBase64String str
   		memstream = dotnetobject "System.IO.MemoryStream" byteArr
   		DecodedImg = ImageClass.fromstream memstream
   		memstream.close() ; return DecodedImg
   	)
   	rollout ui_items "ui items"
   	(
   		local bm1 = bitmap 50 50 color:red
   		local bm2 = bitmap 50 50 color:green
   		local redcol = true
   		dotnetcontrol rec_btn "CheckBox" width:25 height:25 border:false align:#center
   
   		on rec_btn MouseUp arg do
   		(
   			if rec_btn.checked then 
   			(	
   				rec_btn.image = (StringToImage rec_red)
   				rec_btn.BackColor = COL1 
   			)	
   			else 
   				rec_btn.image = (StringToImage rec_grey)
   		)
   		on ui_items open do
   		(
   			rec_btn.Appearance = rec_btn.Appearance.Button
   			rec_btn.FlatStyle = rec_btn.FlatStyle.Flat
   			rec_btn.UseVisualStyleBackColor = false
   			rec_btn.image = (StringToImage rec_grey)
   			rec_btn.BackColor = COL1 
   		)	
   			
   	)
   	createdialog ui_items width:100 height:100
   )

I don’t use imgtag because it doesn’t allays change the image at me.

14 Replies

I found by myself! Thank you anyway
If you have any better solution, please add it here.

(
 	global CamSwitch
 	local COL1 = (dotNetClass "System.Drawing.Color").fromARGB (((colorMan.getColor #background) * 255)[1] as integer) (((colorMan.getColor #background) * 255)[2] as integer) (((colorMan.getColor #background) * 255)[3] as integer)
 	local rec_grey = "iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADImlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4zLWMwMTEgNjYuMTQ1NjYxLCAyMDEyLzAyLzA2LTE0OjU2OjI3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo5MDEyRUZEOEJGQUExMUUyOERCOEUxRDdFMEFBNTE1QyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo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LmH7xZQz6qvGxySyDOde4x5pherj9riAOUKrNNimpqPF6Y0fyCnCevtwEXW9M8uLOsTPAtUWkxy/g+sleGcy5xr3PbV7EbRX4NFCPfWo92EN+kM2iJfUepTqn1GCcBjgqbsDM/uexEu/D3Utfy2DOtSGzG6f1dgyGtuCwuxpRcf1ByrsSCBzcpdFmuukLDJLRCN37LD2HfkGDE1aCRYM+oRinaZlPii6cCTUhRthmsGbCgfUVkY143zzenjYyO0xf4YTJiQHJg7hUiQGrG33WDTjlDqKfUgy2duKNxxrxuChlaCtyl/YhKFlUFFPPKLU4ZC1DN83gVEMbBuhwb3M73oxsxbP2SjSU2lM168v6L3KNCPKflscTqyu1J1sFMb1Da8ju1JmyLebSdL3DlayhvZI1OefCin8AZflnIYFyotMAAAAASUVORK5CYII="
 	local ConvertClass = dotNetClass "System.Convert"
 	local ImageClass = dotNetClass "System.Drawing.Image"
 	fn StringToImage str = --  http://lonerobot.net/ 
 	(
 		byteArr = ConvertClass.FromBase64String str
 		memstream = dotnetobject "System.IO.MemoryStream" byteArr
 		DecodedImg = ImageClass.fromstream memstream
 		memstream.close() ; return DecodedImg
 	)
 	rollout CamSwitch "ui items"
 	(
 		local bm = bitmap 50 50 color:blue
 		local rm = bitmap 50 50 color:red
 		local redcol = false
 		dotnetcontrol rec_btn "Label" width:25 height:25 
 		on rec_btn Click arg do
 		(
 			if redcol == true then 
 			(	
 				rec_btn.image = (StringToImage rec_grey)
 				redcol = false
 			)	
 			else
 			(
 				rec_btn.image = (StringToImage rec_red)
 				redcol = true
 			)	
 			
 		)	
 		on CamSwitch open do
 		(
 			rec_btn.image = (StringToImage rec_grey)
 			rec_btn.BackColor = COL1 
 		)	
 			
 	)
 	createdialog CamSwitch width:100 height:100
 )

This might also work for the CheckBox control:

rec_btn.FlatAppearance.BorderSize = 0

Thank you PolyTools3D!

Here is the final code:

(
	global ui_items
	   local COL1 = (dotNetClass "System.Drawing.Color").fromARGB (((colorMan.getColor #background) * 255)[1] as integer) (((colorMan.getColor #background) * 255)[2] as integer) (((colorMan.getColor #background) * 255)[3] as integer)
	   local rec_grey = "iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAX  NSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3  YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADImlUWHRYTUw6Y2  9tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78i  IGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG  1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0  az0iQWRvYmUgWE1QIENvcmUgNS4zLWMwMTEgNjYuMTQ1NjYxLC  AyMDEyLzAyLzA2LTE0OjU2OjI3ICAgICAgICAiPiA8cmRmOlJE  RiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMD  IvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9u  IHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG  9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8v  bnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj  0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jl  c291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG  90b3Nob3AgQ1M2IChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJ  RD0ieG1wLmlpZDo5MDEyRUZEOEJGQUExMUUyOERCOEUxRDdFME  FBNTE1QyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MDEy  RUZEOUJGQUExMUUyOERCOEUxRDdFMEFBNTE1QyI+IDx4bXBNTT  pEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4b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UKrNNimpq  PF6Y0fyCnCevtwEXW9M8uLOsTPAtUWkxy/g+sleGcy5xr3PbV7EbRX4NFCPfWo92EN+kM2iJfUepTqn1GCcB  jgqbsDM/uexEu/D3Utfy2DOtSGzG6f1dgyGtuCwuxpRcf1ByrsSCBzcpdFmuukLD  JLRCN37LD2HfkGDE1aCRYM+oRinaZlPii6cCTUhRthmsGbCgfU  VkY143zzenjYyO0xf4YTJiQHJg7hUiQGrG33WDTjlDqKfUgy2d  uKNxxrxuChlaCtyl/YhKFlUFFPPKLU4ZC1DN83gVEMbBuhwb3M73oxsxbP2SjSU2lM1  68v6L3KNCPKflscTqyu1J1sFMb1Da8ju1JmyLebSdL3DlayhvZ  I1OefCin8AZflnIYFyotMAAAAASUVORK5CYII="
	   local ConvertClass = dotNetClass "System.Convert"
	   local ImageClass = dotNetClass "System.Drawing.Image"
	   fn StringToImage str = --  http://lonerobot.net/ 
	   (
		   byteArr = ConvertClass.FromBase64String str
		   memstream = dotnetobject "System.IO.MemoryStream" byteArr
		   DecodedImg = ImageClass.fromstream memstream
		   memstream.close() ; return DecodedImg
	   )
	   rollout ui_items "ui items"
	   (
		   local bm1 = bitmap 50 50 color:red
		   local bm2 = bitmap 50 50 color:green
		   local redcol = true
		   dotnetcontrol rec_btn "CheckBox" width:25 height:25 border:false align:#center
   
		   on rec_btn MouseUp arg do
		   (
			   if rec_btn.checked then 
			   (	
				   rec_btn.image = (StringToImage rec_red)
				   rec_btn.BackColor = COL1 
			   )	
			   else 
				   rec_btn.image = (StringToImage rec_grey)
			rec_btn.FlatAppearance.BorderSize = 0
			rec_btn.UseVisualStyleBackColor =false		
		)
		   on ui_items open do
		   (
			   rec_btn.Appearance = rec_btn.Appearance.Button
			   rec_btn.FlatStyle = rec_btn.FlatStyle.Flat
			   rec_btn.UseVisualStyleBackColor = false
			   rec_btn.image = (StringToImage rec_grey)
			   rec_btn.BackColor = COL1 
			rec_btn.FlatAppearance.BorderSize = 0
			rec_btn.FlatAppearance.MouseOverBackColor = COL1
			rec_btn.FlatAppearance.MouseDownBackColor = COL1
			rec_btn.FlatAppearance.CheckedBackColor = COL1
		   )	
			   
	   )
	   createdialog ui_items width:100 height:100
   )

I want to use Popup Style.
This style displays another square – a grey one.

rec_btn.flatstyle = (dotnetclass “System.Windows.Forms.Flatstyle”).PopUp

rec_btn.FlatAppearance.BorderSize = 0
does not help this time.

I need to use this style because I have some other simple max btns, and I want to keep the look and feel.

I love also
rec_btn.flatstyle = (dotnetclass “System.Windows.Forms.Flatstyle”).System

  • It doesn’t display this square, but unfortunatelly it doesnt display the image of the btn as well.

I want finally a simple max btn (or any dotnet btn that will look the same) with encoded image – not bmp file

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

You can use “mouseHover” and “mouseLeave” events in comb with FlatStyle.
In this example I use same colored image but you can add another a bit desaturated icon.


 (
	global ui_items
	local maxBC = (colorMan.getColor #background) * 255.0
	local COL1 = (dotNetClass "System.Drawing.Color").FromArgb maxBC.x maxBC.y maxBC.z
	local rec_grey = "iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADImlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4zLWMwMTEgNjYuMTQ1NjYxLCAyMDEyLzAyLzA2LTE0OjU2OjI3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4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	luTAXfRL3v7gI3FzA6rlhXO/9QAZzrnHv6sYmXKFknKorLx8Rry+m2O50JseURbinNWCpIoCVD	48Di0tIvPQCvmzehK9qfPgmUiVzrnGPNVccZRhVFuMIGTXa7Un	FXoMxfZli3qGr/VwfAWYuY7n3KM76yjFX7cFKwIcHj4ZxkzjXuMeaqdowRlQ6vJ1	XiDadPq04oFRnZ9Qa3C7SYWrPE8DvN3DxqU5MljmxotEhuw7mX	OMeayZIO1wk4P0CNdrzC7OK58iIEy2otZjsbAF++wUX9uzGecm	OX7UW3FcbZDDnGvdY821HCz7TinhXqcMuNtotGNKjNLRZSpXwV	wCJS7j90XF8YrRhylGOn8ySDOZc4x5rxkkbN7vwusaE7Xy1LTS	oY/RaE5RqQm/A4qtvAfPLmH7xZQz6qvGxySyDOde4x5pherj9riAOUKrNNimpq	PF6Y0fyCnCevtwEXW9M8uLOsTPAtUWkxy/g+sleGcy5xr3PbV7EbRX4NFCPfWo92EN+kM2iJfUepTqn1GCcB	jgqbsDM/uexEu/D3Utfy2DOtSGzG6f1dgyGtuCwuxpRcf1ByrsSCBzcpdFmuukLD	JLRCN37LD2HfkGDE1aCRYM+oRinaZlPii6cCTUhRthmsGbCgfU	VkY143zzenjYyO0xf4YTJiQHJg7hUiQGrG33WDTjlDqKfUgy2d	uKNxxrxuChlaCtyl/YhKFlUFFPPKLU4ZC1DN83gVEMbBuhwb3M73oxsxbP2SjSU2lM1	68v6L3KNCPKflscTqyu1J1sFMb1Da8ju1JmyLebSdL3DlayhvZ	I1OefCin8AZflnIYFyotMAAAAASUVORK5CYII="
	local ConvertClass = dotNetClass "System.Convert"
	local ImageClass = dotNetClass "System.Drawing.Image"
	fn StringToImage str = --  http://lonerobot.net/ 
	(
		byteArr = ConvertClass.FromBase64String str
		memstream = dotnetobject "System.IO.MemoryStream" byteArr
		DecodedImg = ImageClass.fromstream memstream
		memstream.close() ; DecodedImg
	)
	rollout ui_items "ui items"
	(
		dotnetcontrol rec_btn "CheckBox" width:25 height:25 border:false align:#center
		on rec_btn MouseUp arg do
		(
			if rec_btn.checked then rec_btn.image = StringToImage rec_red else rec_btn.image = StringToImage rec_grey
			rec_btn.FlatAppearance.BorderSize = 0
			rec_btn.UseVisualStyleBackColor = off		
		)
		on rec_btn MouseHover arg do (if not rec_btn.checked do rec_btn.image = StringToImage rec_red)
		on rec_btn MouseLeave arg do (if not rec_btn.checked do rec_btn.image = StringToImage rec_grey)
		on ui_items open do
		(
			rec_btn.BackColor = rec_btn.FlatAppearance.MouseOverBackColor = rec_btn.FlatAppearance.MouseDownBackColor = rec_btn.FlatAppearance.CheckedBackColor = COL1 
			rec_btn.Appearance = rec_btn.Appearance.Button
			rec_btn.FlatAppearance.BorderSize = 0
			rec_btn.FlatStyle = rec_btn.FlatStyle.flat
			rec_btn.UseVisualStyleBackColor = off
			rec_btn.image = (StringToImage rec_grey)
		)	
	)
	createdialog ui_items width:100 height:100
)
 

Method that you use is ok but in general I not like to see big length of base64 string.
With this function you can break and merge base64 string with simple multidimensional array.
Maybe there is better approch … Anyway


  fn breakBase64 str =
 (
 	local arr = #("",str.count,#())
 	local sysStr = (dotNetclass "System.String")
 	local newStr = dotnet.ValueToDotNetObject arr[1] sysStr
 	for s in 1 to str.count do
 	(
 		if (idx = (newStr.indexOf str[s])+1) > 0 then append arr[3][idx] s else
 		(
 			append arr[3] #(s)
 			newStr = dotnet.ValueToDotNetObject (arr[1]+=str[s]) sysStr 
 		)
 	) ; arr
 )
 fn mergeBase64 data =
 (
 	local sysStr = (dotNetclass "System.String"), strArr = #(), strArr[data[2]] = ""
 	for i = 1 to data[3].count do (for j in data[3][i] do strArr[j] = data[1][i])
 	sysStr.Concat strArr
 )
 
 -- example
 str = "AajKmdj0UjKkpdfakUikass058kd52RTiyrRyT891646sdsd6FFg66wwe8d2221ersrdfvkjxkjwewQPIuskQeryud"
 breakB64Data = breakBase64 str
 base64FromData = mergeBase64 breakB64Data
 -- verify the identity
 str == base64FromData
  

Thank you, Branko! Thank you for the record btn, it’s looking now exactly as I want.
In addition, I need to make some other btns like in the image bellow, that should work for both – light and dark max UI.

and here is the first btn icon with alpha

local create_cam = "iVBORw0KGgoAAAANSUhEUgAAACMAAAAaCAYAAAA9rOU8AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADImlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4zLWMwMTEgNjYuMTQ1NjYxLCAyMDEyLzAyLzA2LTE0OjU2OjI3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpERDcyQzdBQzAxRDkxMUU0QjIyMTlCNkYzNzJBMTdCNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpERDcyQzdBRDAxRDkxMUU0QjIyMTlCNkYzNzJBMTdCNSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRENzJDN0FBMDFEOTExRTRCMjIxOUI2RjM3MkExN0I1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRENzJDN0FCMDFEOTExRTRCMjIxOUI2RjM3MkExN0I1Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+UFlnmwAAAYpJREFUSEvN1MErRFEUx/GhYYSmKYqZhREhKwuxYaH5E6xsZEPZsRBlNbKxtFL+AhvJwh/AlKX4G2wslChho+d7x3m3+2ZOt6k3uk59eu+d+979neZNLxNF0b+hNkNRm6GozVDUpittjZdHp3CCI8xKO1E2yw3WpC0G2EIN19hBjyzZsllusCZtET6Pc1xiEVlZsmWz3GCNKTboRsGjq36jUqxNYh1rmJF2omyWG6xhg1184tXjA5uyt3mmiFMsSMtbcVYiWMOGX5iQ59RifQ4vyOMQbzDPLckt3oqzEsEaNvx9V57iHvOqIjzD/Dem8YBgw9zCvhbOgw3TIae2zDBjI+VKNpcrOPrMGse824+zmsIbtTKMVmaY0nBxmbCqY8Wscdx2+3FWU3ijFn+ZXqyiU1r1YRD0D3yHivT+Zhg0fTXdYn0Q39jAE67wiLYPc48zVD0ucGM25tiPA7yj7cMMYR/HHnsYkL3rxbX5Cpfk0ltxViI4NLUZitoMRW2GojZDUZuhqM0woswPpYWurpUrcJYAAAAASUVORK5CYII="

to make any other them rectangle shape for .net button is not a problem (image with alpha, custom region, etc.)
the real pain is to make focus frame (dotted rectangle around focused control) not rectangle shape

That’s always a problem

Tell me please, do you find this concept good or not? If yes, then how to find out if the scheme is dark in order to draw icons for dark scheme?

download btns script

3 Replies
(@denist)
Joined: 11 months ago

Posts: 0

you have to have two sets of icons: dark and light. and change then when a scheme was changed.

(@gazybara)
Joined: 11 months ago

Posts: 0

Simply check x value of max beckground color


maxBC = (colorMan.getColor #background) * 255.0
fn checkScheme color = if color.x < 100 then #dark else #light
checkScheme maxBC

(@denist)
Joined: 11 months ago

Posts: 0

there is a general callback – #colorChanged. IColorManager can tell what scheme is currently used.

Page 1 / 2