So, I'm programming my custom styles for my disassembler. Unfortunately, it seems like it always overwrites the style to the latest characters. Here my code:
And here my functions which do the styling:
![Image]()
I've tried some (horrible) ways, but they also didn't result in what I wanted. Does someone have an idea what could be the cause of this? For additional information, I use Visual Studio 2012, .NET 4.5
if (Base)
{
ITypeBase Instr = new ITypeBase();
Instr = BaseTypeSplit(bits, Instr);
Disassemble._dis.updateOP(CheckOpcode(Instr.opcode) + " ");
Disassemble._dis.updateREG(CheckReg(Instr.rt));
Disassemble._dis.updateCOMMA(", ");
Disassemble._dis.updateIMM(CheckImm(Instr.imm));
Disassemble._dis.updateREGB("(" + CheckReg(Instr.@base) + ")");
}
Yes, my main code calls the scintilla Box from another class. I use my constructor from the other class (_dis = this;) to access it. And here my functions which do the styling:
public Disassemble()
{
InitializeComponent();
_dis = this;
}
public static Disassemble _dis;
public void updateOP(string message)
{
int length = scintilla1.TextLength; // 12
int length2 = message.Length; // 3
int sum = length + length2; // 15
scintilla1.Styles[1].Font = new Font("Arial", 25, FontStyle.Bold);
scintilla1.Styles[1].ForeColor = Color.FromArgb(255, 128, 0);
scintilla1.Text += message;
int n = length;
while (length < sum)
{
scintilla1.GetRange(n).SetStyle(1);
n = length + 1;
length += 1;
}
}
public void updateREG(string message)
{
int length = scintilla1.TextLength; // 12
int length2 = message.Length; // 3
int sum = length + length2; // 15
scintilla1.Styles[2].Font = new Font("Arial", 25, FontStyle.Bold);
scintilla1.Styles[2].ForeColor = Color.FromArgb(128, 0, 0);
scintilla1.Text += message;
int n = length;
while (length < sum)
{
scintilla1.GetRange(n).SetStyle(2);
n = length + 1;
length += 1;
}
}
public void updateREGB(string message)
{
int length = scintilla1.TextLength; // 12
int length2 = message.Length; // 3
int sum = length + length2; // 15
scintilla1.Styles[5].Font = new Font("Arial", 25, FontStyle.Bold);
scintilla1.Styles[5].ForeColor = Color.FromArgb(172, 172, 172);
scintilla1.Text += message;
int n = length;
while (length < sum)
{
scintilla1.GetRange(n).SetStyle(5);
n = length + 1;
length += 1;
}
}
public void updateCOMMA(string message)
{
int length = scintilla1.TextLength; // 12
int length2 = message.Length; // 3
int sum = length + length2; // 15
scintilla1.Styles[3].Font = new Font("Arial", 25, FontStyle.Bold);
scintilla1.Styles[3].ForeColor = Color.FromArgb(0, 0, 0);
scintilla1.Text += message;
int n = length;
while (length < sum)
{
scintilla1.GetRange(n).SetStyle(3);
n = length + 1;
length += 1;
}
}
public void updateIMM(string message)
{
int length = scintilla1.TextLength; // 12
int length2 = message.Length; // 3
int sum = length + length2; // 15
scintilla1.Styles[4].Font = new Font("Arial", 25, FontStyle.Bold);
scintilla1.Styles[4].ForeColor = Color.FromArgb(0, 0, 255);
scintilla1.Text += message;
int n = length;
while (length < sum)
{
scintilla1.GetRange(n).SetStyle(4);
n = length + 1;
length += 1;
}
}
And this is what I get, always:
I've tried some (horrible) ways, but they also didn't result in what I wanted. Does someone have an idea what could be the cause of this? For additional information, I use Visual Studio 2012, .NET 4.5