Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
.NET
»
Topic:
How to get the current index of paletteset?
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: How to get the current index of paletteset? (Read 1506 times)
0 Members and 1 Guest are viewing this topic.
guohq
Newt
Posts: 84
How to get the current index of paletteset?
«
on:
December 25, 2013, 06:06:10 AM »
There'er four palettes in paletteset.I can set the acitve palette use mouse.how can I get the current index of paletteset by code?
Logged
Andrey Bushman
Swamp Rat
Posts: 864
Re: How to get the current index of paletteset?
«
Reply #1 on:
April 02, 2014, 04:46:17 AM »
I think the index is not need for you in this case. For example, you can to get necessary Palette via such code:
Code - C#:
[Select]
using
Wn
=
Autodesk
.
AutoCAD
.
Windows
;
...
public
static
class
PaletteSetExtentions
{
/// <summary>
/// Get Palette by its name
/// </summary>
/// <param name="ps">Owner (PaletteSet)</param>
/// <param name="name">Palette's name</param>
/// <returns>Returns the Palette or null if is not exist.</returns>
public
static
Wn
.
Palette
GetPalette
(
this
Wn
.
PaletteSet
ps,
String
name
)
{
if
(
name
==
null
||
name
.
Trim
(
)
==
String
.
Empty
)
return
null
;
foreach
(
Wn
.
Palette
item
in
ps
)
if
(
item
.
Name
.
Equals
(
name, StringComparison
.
InvariantCultureIgnoreCase
)
)
return
item
;
return
null
;
}
}
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
.NET
»
Topic:
How to get the current index of paletteset?