|
Hi everyone,
I have this little problem: for my program I have to place some labels over an image. The user can drag and drop the labels and move them around and the location is saved to db. The problem is that when I resize the form (and the image itself) the labels' location is lost, in the sense that they moved from the original position set by the user. I can understand that that is due to the fact that the location of the label is set to the parent container, but how can I reset the location on every resize? this also happens for instance if I start the form in full screen mode. Thanks.
|
|
|
|
|
Just attach to the Resize event of the ImageBox or Form or whereever you have the image.
|
|
|
|
|
I did try that: got the width and height before resizing, width and heith after resizing and calculate the new point in comparison to the old one. It almost worked: almost because even if the label do not move as much as before, they still move a bit instead of being in the exact same position over the image. Maybe my equation was wrong?
newX = (new_width * oldX) / oldWidth;
|
|
|
|
|
NETtune wrote: Maybe my equation was wrong?
I normally get those wrong too, best is the try some combination's and see what works.
PointToScreen and PointToClient may be helpful.
|
|
|
|
|
Hi!
in .net,how to get the pagenums of pdf file?
|
|
|
|
|
5
(hint: you need to specify a bit more information, like your environment, the tools you are using, etc)
|
|
|
|
|
OS:WindowsXP, visita
C#.net, .Net Framework2.0
How to get the pages of pdf file to coding(C#)?
|
|
|
|
|
42
|
|
|
|
|
Hi
I have a datatable having 10 records. I want to insert the 10 records to a table in a database using stroed procedure from my front end C#. How to do? can any one help me please?
Thanks in advance
kesavan
|
|
|
|
|
I am creating one windows application using Asp.Net 2005 with C#. I have one Label control and one button control on the Form. I am having one Class in my solution too.
I am creating the object of my class in the button_click event and calling the function ChangeLabel() as shown below.
private void button1_Click(object sender, EventArgs e)
{
Class2 c2 = new Class2();
c2.ChangeLabel();
}
Now in that ChangeLabel() function I am changing the text of the Label control but it is not reflecting on the form.
PLease help me.((
Akash Agarwal
|
|
|
|
|
Akash Agarwal wrote: Class2 c2 = new Class2();
c2.ChangeLabel();
So where is the Label's instance you are referencing?
|
|
|
|
|
Actualy I do not want to send the label reference like c2.ChangeLabel(ref label1). instead of this I want to find that label control in the ChangeLabel() method itself, may be by extracting that label control from control collection of FORM or something like this.
Akash from India
Akash Agarwal
|
|
|
|
|
Well you are going to need a reference to the Label's form or itself, else it wont be possible.
|
|
|
|
|
Hi All,Please reply me If anyone is having any hint about the solution
Hoping for the solution
Thanks
Akash From India
Akash Agarwal
|
|
|
|
|
Please try and explain what you are trying to do. From your first post it seems that the label text is not changing, then you seem to want something different in the next one - following a perfectly good answer to your original question.
Clarity helps!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello,
I am writing a C# program which performs some basic computer vision on an AVI video.
The first step is to extract a Bitmap object from the AVI file for each frame - and this code works perfectly on its own.
In order to process each bitmap, I then go into unsafe mode, and use a pointer to cycle through the bitmap data. I then store the RGB values of each pixel into a Color[,] array, so that I can then read the RGB values at any location in the bitmap [x, y]. Here is that function that returns this array:
public static Color[,] GetRGBArray(Bitmap b)
{
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),
ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;
Color[,] array = new Color[b.Width, b.Height];
unsafe
{
byte* p = (byte*)(void*)Scan0;
int nOffset = stride - b.Width * 3;
int nWidth = b.Width * 3;
for (int y = 0; y < b.Height; ++y)
{
for (int x = 0; x < b.Width; ++x)
{
array[x, y] = Color.FromArgb(p[2], p[1], p[0]) ;
p = p + 3;
}
p += nOffset;
}
}
return array;
}
This function works perfectly well too, on its own at least.
Next, I add time as a dimension. I have another array, called data, which is an array of an array (jagged arrray). It is of type Color[i][x,y], where i is the frame number, and [x, y] are the coordinates on the bitmap. As the program grabs bitmaps from the AVI, I call the GetRGBArray() function for each bitmap, and the result is stored in the data array:
data[i] = GetRGBArray(b);
where i is the number of the current frame, and b is the bitmap object for the current frame, that I have grabbed from the AVI file.
From this, I can access the Color data for every pixel for every frame.
This all works fine functionally. Here is the problem. The AVI video has 1000 frames in it, however, after the program has been running for about 300 frames, it starts to slow down, and at about 400 frames, it just completely stops, and I don't know why.
There must be some trash of some sort that is piling up as I run the program, and once it gets to a certain point it starts slowing the program down. It doesn't matter where abouts in the video file I start from, after 300 frames it starts to be affected.
Any ideas? It is driving me mad!
Thank you for any help on this
Ed.
|
|
|
|
|
Why don't you watch what is happening to the memory while the frames are being created.
Watch the process in Task manager can give you an idea.
RM
Learn to write self marginalizing code!
Call 1-888-BAD-CODE
------------------
Silver member by constant and unflinching longevity.
|
|
|
|
|
Hi,
Thanks for the advice Richard.
Yes I think it probably is something to do with memory now you mention it.
But I don't know how I can monitor the memory usage in Task manager - how can I do this?
Thank you!
|
|
|
|
|
Bring up Task Manager,switch to the "Processes" tab.
Put the list in "Image Name" order, and watch the "Mem" column number.
Think about your problem: do you really need all 300 frames in memory at once,or would you be better off cycling through the last 20 or 50 frames.
What are you trying to accomplish that requires that history to be immediately available?
Learn to write self marginalizing code!
Call 1-888-BAD-CODE
------------------
Silver member by constant and unflinching longevity.
|
|
|
|
|
Hi every body.
I saw Normalize method in some classes. but I don't know what it is.
Can you describe it clearly ?
Thanks in advanced.
Sorry for my English. I'm a freshman .
|
|
|
|
|
|
Thanks. My mean was String Normalize .
Sorry for my English. I'm a freshman .
|
|
|
|
|
Well if your talking about Graphics, if something is normal to something it's at a 90 degree(perpendicular) angle to a reference slope.
It returns a new string whose textual value is the same as this string, but whose binary representation is in Unicode normalization form C.
http://msdn.microsoft.com/en-us/library/8eaxk1x2(VS.85).aspx
Cheers,
|
|
|
|
|
Hello everyone,
Are there any API to change the value of key directly in an Dictionary? Currently I am removing an old element, and then insert a new one.
thanks in advance,
George
|
|
|
|
|
That is the correct method. By definition the key values in a dictionary cannot change. Thus the two formal steps required.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|