|
Any control on your panel will draw above the panel. If this were not so, then you wouldn't be able to see your controls at all.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
so like you say, how can i put a frame(drawing image) may be this image on another or same panel which is displaying images that are capturing by webcam.
sorry about my bad English!
-- modified at 0:16 Wednesday 26th October, 2005
|
|
|
|
|
Are you doing this in the FORM's on paint, or a control's (what is this)? the co-ordinates you specify should draw the rectangle positionned at the top left of this and 10 pix smaller than the control's size - i.i the top left corner of the rectangle will be at the same point as the top left corner of the control's client area, with it's bottom right corner 10 pix in from this's botoom right corner...
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
my panel still has alot controls and i want this rectangle draw above these controls,and i have just done it buy set the BackColor=Color.Transparency;
but while my panel display images capture by webcam, this doesn't qork anymore?
Sorry about my bad English!
thanks for your help!
|
|
|
|
|
Hi there,
i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error: The name Var1 does not exist in the class or namespace of the project....
here is the codesnippet:
string strsql;
DataTable dt;
SqlDataAdapter da;
SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage");
dt = new DataTable();
strsql = "select * from Articles_production";
da = new SqlDataAdapter(strsql,objConn);
da.Fill(dt);
if(dt.Rows.Count > 0)
{
//foreach (DataRow dr in dt.Rows) //ervy loop
for (int i=0;i
|
|
|
|
|
If your code looks the way that it is posted. the for loop is incomplete.
|
|
|
|
|
no i posted my codesnippet as
For (int i=0;i
|
|
|
|
|
ur text box is truncate the code...pls check the code project page
regards
ybasha
|
|
|
|
|
ybasha wrote: 'where identifier='" + Id +"'";
Unless your unique ID is a string, you need to remove the quotes.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Since you didn't cut an paste the real code (as evidinced by the incomplete for statement) it is possible that the error message is correct: Var1 doesn't exist in the posted code. its var1... C# is after all case sensitive...
This would be better done as a parameterized query anyway. Parameters have fewer issues with text characters (don't mind unescaped single quotes for instance) and so are less likely to give strange errors than dynamically built SQL.
I notice that two or more of your replacements are replaceing unicode characters with double quotes, which likely totally corrupt the concatenated query sting (causing it to appear to terminate early). Using parameters would avoid that issue as well.
Christian's observation is also likely a problem, and is another that would be avoided by using parameters.
Building up SQL statements by concatenating stuff like this is bad practice for a number of reasons (increased garbage generation from all the string reallocations, vulnerability to SQL injection attack, etc).
[edit] On top of all that, all the string variables (var1, var2, etc) are declared inside the scope of the for loop, and so do not exist outside of it (where your sql sting is declared and concatenated)...move the declarations to before the for loop, and this might have a chance [edit]
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
-- modified at 0:00 Wednesday 26th October, 2005
|
|
|
|
|
It looks like Var1 is outside the scope of the loop.
|
|
|
|
|
did you spell the variables correctly (i.e Var1 != var1)?
|
|
|
|
|
Not really related to your question, but I hope you are aware that you can convert between code pages/encodings in a few lines (this looks like UTF-8 read as for example cp1252).
If it is indeed the case do something like this:
byte[] bytes = System.Text.Encoding.GetEncoding(1252).GetBytes(sourceString);
string result = System.Text.Encoding.UTF8.GetString(bytes);
|
|
|
|
|
I need help to write a program that includes two functions named calc_avg() and varience(). The calc_avg() function should calculate and return the average of the values stored in a static array called testvals. The array should be declared in main() and include that values 89, 95, 72, 83, 99, 54, 86, 75, 92, 73, 79, 75, 82, and 73. The varience is obtained by subtracting the average from each value in testvals, squaring the values obtained, adding them, and dividing by the number of elements in testvals. The values returned from calc_avg() and varience() should be displayed in main()???
|
|
|
|
|
No - we won't do your homework. You need to try to do it yourself. This problem is kind of trivial - have you been paying attention in class ?
If you get stuck, you can ask *specific* questions. Posting your homework question without trying to do it yourself is not what this forum is for.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
This sounds like homework? If so, shouldn't you be able to do this by yourself if you paid attention in class?
You say that you need help to write the program. What kind of help?
---
b { font-weight: normal; }
|
|
|
|
|
This is the part i'm stuck on, i don't understand the coding for this last part, the rest i have done, it's the end that's stalling me, i do pay attention in class but people do get stuck sometimes
thanks,
....The varience is obtained by subtracting the average from each value in testvals, squaring the values obtained, adding them, and dividing by the number of elements in testvals. The values returned from calc_avg() and varience() should be displayed in main()???
|
|
|
|
|
Right, what part are you getting stuck at? Have you squared, added, and divided the values? Are you having trouble writing the values to stdout? What's the problem?
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
I readded u to my MSN again. Did you get the request?
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
Got it.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
here's my code so far:
[STAThread]
static void Main(string[] args)
{
double [] testvals = new double [14];
testvals [0] = 89;
testvals [1] = 95;
testvals [2] = 72;
testvals [3] = 83;
testvals [4] = 99;
testvals [5] = 54;
testvals [6] = 86;
testvals [7] = 75;
testvals [8] = 92;
testvals [9] = 73;
testvals [10] = 79;
testvals [11] = 75;
testvals [12] = 82;
testvals [13] = 73;
}
static double [] calc_avg (double []testvals)
{
double [] avgerage = new double [14];
for(int i = 0; i<14; i++)
{
average[i] = testvals[i]/14;
}
return average;
}
static double [] variance (double [] calc_avg, double []testvals)
{
double []variance = new double [14];
for (int i = 0; i<14; i++)
{
variance[i] = (average[i] - testvals[i])^2
Now, i'm stuck with writing the part where you have to : The variance is obtained by subtracting the average from EACH VALUE in testvals, SQUARING THE VALUES OBTAINED, ADDING them, DIVIDING by the number of elements in testvals. The values returned from calc_avg() and variance() should be DISPLAYED IN THE MAIN..........the bolded words are where i'm getting stuck, do i do this all in one line, or multiple, or what does the coding look like???
|
|
|
|
|
Zjaded wrote: for (int i = 0; i<14; i++)
{
variance[i] = (average[i] - testvals[i])^2
SQUARING THE VALUES OBTAINED, ADDING them, DIVIDING
So you've subtracted the values from the average for each value already. Now sum all the values in variance[i], divide it by 14 (i.e. take the average of them).
Zjaded wrote: DISPLAYED IN THE MAIN
I assume they mean write it to the console?
|
|
|
|
|
If you've already done some of it, why did you ask for help with all of it ?
Zjaded wrote: subtracting the average from each value in testvals
Do you know how to calculate an average ?
Zjaded wrote: squaring the values obtained
Math.Pow, or just x*x.
Zjaded wrote: adding them, and dividing by the number of elements in testvals
Which bits are you stuck on here ? Post your code, and explain where you can't work out how to proceed.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hey
its the first time I'm trying to draw something myself, so its pretty basic...
well, I have 2 questions:
1. how can I draw just one dot on the screen? not a line, not a rectangle, just one simple dot (color a specific point).
I tried to draw a line from a point to the same on (drawline(pen, point1, point1)), but it didn't work...
2. is it possible to flip the (x,y) positions of the window?
so my x,y won't start at the upper-left side, but at the buttom, or at the middle of my window.
Thanks alot for your help!
|
|
|
|
|
SetPixel.
You can do a translateTransform, which means that you change where 0,0 is considered to be.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|