|
You can inherit a control from System.Windows.Forms.Label and override its OnPaint event:
public BorderLabel() {
InitializeComponent();
this.Paint += new System.Windows.Forms.PaintEventHandler(BorderLabel_Paint);
}
void BorderLabel_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
Brush brush = new SolidBrush(Color.Red);
Pen pen = new Pen(brush);
Rectangle rect = e.ClipRectangle;
rect.Inflate(-1, -1);
e.Graphics.DrawRectangle(pen, rect);
}
Regards,
Lev
modified on Thursday, January 8, 2009 6:15 AM
|
|
|
|
|
Lev Danielyan wrote: OnPain event
I know that one well!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I wish I did it on purpose
Regards,
Lev
|
|
|
|
|
hello friends ..this the piece of code from my C# program
pls help me how to increase the the input from 2(present input intake) to 9 inputs
public void Process(int[] problem)
{
double[,] T = new double[states.Length, 3]; //We will store the probability sequence for the Viterbi Path
vPath = new int[problem.Length];
vProbs = new double[problem.Length];
//initialize T
//------------------------------------------------------------------
for (int state = 0; state < states.Length; state++)
{
T[state, 0] = startProbability[state];
T[state, 1] = state;
T[state, 2] = startProbability[state];
}
for (int output = 0; output < problem.Length; output++)
{
double[,] U = new double[states.Length, 3]; //We will use this array to calculate the future probabilities
Console.WriteLine("\nTesting hypothesis {0} ({1})", output, observations[problem[output]]);
double highest = 0;
for (int nextState = 0; nextState < states.Length; nextState++)
{
double total = 0;
double argMax = 0;
double valMax = 0;
Console.WriteLine(" Estimating probability for future state {0} ({1})", nextState, states[nextState]);
for (int state = 0; state < states.Length; state++)
{
Console.WriteLine(" The testing state is {0} ({1})", states[state], state);
double prob = T[state, 0];
double v_path = T[state, 1];
double v_prob = T[state, 2];
double p = emissionProbability[state, problem[output]] * transitionProbability[state, nextState] * scaleFactor;
|
|
|
|
|
lawrenceinba wrote: increase the the input from 2(present input intake) to 9 inputs
The current input is a int array. What do you mean "from 2 to 9"? More detail please.
I Love KongFu~
|
|
|
|
|
that array accepts only 2 inputs at present.... now i should increase it ro 9 input,, how to do tat friend
|
|
|
|
|
int[] inputs = new int[9];
Then assign the value for inputs array. Is that what you want?
I Love KongFu~
|
|
|
|
|
Dear All:
I create a usercontrol , there is a button in it, I place this control on one winform,I want to remove the control from the winform by clickinng the button on the control in design environment,
how to write the code under the button_Click?
Thanks in advance!
Tramp
|
|
|
|
|
i think u can use Form.Controls.Remove(index) ;
rahul
|
|
|
|
|
Well first you don't put the code for this in the control (bad habit).
You expose a event on your control, the button click raises this event.
Then on the form that contains the control you catch this event and there you write the code to remove the control.
From memory (so you might want/need to adjust it a bit)
'in the event off the control
'customcontrol = the name of your control as it is named on the form
controls.remove(custumcontrol);
You can also pass along the name of the control in the event, then you can replace 'customcontrol' with that.
Hope this helps
[EDIT]Adjust the code to c# (forgot I wasn't in the vb.net forum [/EDIT]
|
|
|
|
|
mctramp168 wrote: in design environment
You really want to do this in design enviroment rather than pressing the ‘Delete’ buttono?
I Love KongFu~
|
|
|
|
|
thanks, I only want to know how to realize this function.
|
|
|
|
|
my application has the following procedure.
a database of products (20,000 rows) exists.
our client has 'import' feature where he imports an excel file.
this is implemented by deleting all products table rows, then doing the import - which is a long thing since we programmatically performing calculations on the data.
the obvious problem is if the 'import' action fails (IO stuff), they now have none/partial/curropt data in the products table.
We wish that if the 'import' operation fails, the original data remains.
this is ASP.NET application, written in C#, using SQL Server 2005 and using XSD which we created through the VS2005 design tools.
|
|
|
|
|
You can use transactions and roll back in case of errors.
Try googling[^] around
Regards,
Lev
|
|
|
|
|
1) Make a copy of the table that the stuff gets imported to. Ensure that this table is empty.
2) Import all your stuff to the secondary table
3) If there are no exceptions then delete everything in the original import-table, and copy all stuff from the secondary table to the import-table. If an exception did occur, the original import-table will still hold all data.
You could also use transactions to achieve a similar functionality. SQL Server caches all changes that way, in order to 'undo' them.
I don't know which of these options would serve you best. The transaction-approach would probably be faster to implement.
I are troll
|
|
|
|
|
Hi all
In windows forms we use "Application.StartupPath" to get the application folder does anyone know the equavalent for webpages,
I need to write a file using a filestream but i need the root folder for the web application on the server.
Regards
|
|
|
|
|
i think Server.MapPath is there.
rahul
|
|
|
|
|
Rahul Thank you very much, it worked fine.
Regards
|
|
|
|
|
[DllImport("kernel32.dll")]
private static extern bool ReadFile(
int hFile, // handle to file
byte[] lpBuffer, // data buffer
int nNumberOfBytesToRead, // number of bytes to read
ref int lpNumberOfBytesRead, // number of bytes read
IntPtr lpOverlapped // overlapped buffer
);
Anyone know what is this? How do i know what ReadFile do?
Thanks
|
|
|
|
|
|
Nope. Noone. Even documentation ignore it [^], [^] (and the function's name, 'ReadFile ', is so obscure!).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: the function's name, 'ReadFile', is so obscure
it can mean many things, such as lets go and read some data from a serial port...
|
|
|
|
|
You know, the serial port is a file.
cpallinux.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
what the differences here: number of bytes to read and number of bytes read?
|
|
|
|
|
I would think that one refers to the number of bytes read and the other refers to the number of bytes to read.
...are you kidding?
I read 14 threads today, now I only have 6 left to read....
do you see the difference?
|
|
|
|