|
Hi all
I have main form and this form mdi container and I add another form to customize controls colors in the main form
How can I send new colors to main form????
Thanks for help
|
|
|
|
|
To get a reference to your parent use the following code:
((ParentName)this.MdiParent) where ParentName is the class name of the Mdi Parent.
|
|
|
|
|
and how can i call the controll it self, and if it possible to call control without being public static????
|
|
|
|
|
public static void Detect Edges(Bitmap original, ref Bitmap modified, Color c, int noise)<br />
{<br />
Graphics g = Graphics.FromImage(original);<br />
for(Int32 x = 0; x < original.Width; x++)<br />
{<br />
for(Int32 y = 0; y < original.Height; y++)<br />
{<br />
if(x > 2 && y > 2)<br />
{<br />
try<br />
{<br />
Color current = modified.GetPixel(x , y);<br />
Color right = modified.GetPixel(x + 1, y);<br />
Color left = modified.GetPixel(x - 1, y);<br />
<br />
int total Current = current.R + current.G + current.B;<br />
int total Right = right.R + right.G + right.B;<br />
int total Left = left.R + left.G + left.B;<br />
<br />
if(total Current > (total Left + noise) || total Current > (total Right + noise))<br />
{<br />
modified.SetPixel(x - 1, y, Color.White);
}<br />
else if(total Current > (total Right + noise))<br />
{<br />
modified.SetPixel(x + 1, y, Color.White);
}<br />
else<br />
modified.SetPixel(x, y, Color.Black);
<br />
Color upon = modified.GetPixel(x, y - 1);<br />
Color down One = modified.GetPixel(x, y + 1);<br />
<br />
int totalUpOne = upOne.R + upOne.G + upOne.B;<br />
int totalDownOne = downOne.R + downOne.G + downOne.B; <br />
<br />
if(totalUpOne > (total Current + noise)) <br />
{<br />
modified.SetPixel(x, y - 1, Color.White);<br />
}<br />
else if(totalDownOne > (total Current + noise))<br />
{<br />
modified.SetPixel(x, y + 1, Color.White);<br />
}<br />
else<br />
modified.SetPixel(x, y, Color.Black); <br />
<br />
<br />
<br />
<br />
Color uplift = modified.GetPixel(x - 1, y - 1);<br />
Color downright = modified.GetPixel(x + 1, y + 1);<br />
<br />
int totalUpLeft = upLeft.R + upLeft.G + upLeft.B;<br />
int totalDownRight = downRight.R + downRight.G + downRight.B;<br />
if(totalUpLeft > (total Current + noise))<br />
{<br />
modified.SetPixel(x - 1, y - 1, Color.White);<br />
}<br />
else if(totalDownRight > (total Current + noise))<br />
{<br />
modified.SetPixel(x + 1, y + 1, Color.White);<br />
}<br />
else<br />
modified.SetPixel(x, y, Color.Black); <br />
<br />
Color upright = modified.GetPixel(x + 1, y - 1);<br />
Color down Left = modified.GetPixel(x - 1, y + 1);<br />
<br />
int totalupRight = upRight.R + upRight.G + upRight.B;<br />
int totalDownLeft = downLeft.R + downLeft.G + downLeft.B;<br />
if(totalupRight > (total Current + noise))<br />
{<br />
modified.SetPixel(x + 1, y - 1, Color.White);<br />
}<br />
else if(totalDownRight > (total Current + noise))<br />
{<br />
modified.SetPixel(x - 1, y + 1, Color.White);<br />
}<br />
else<br />
modified.SetPixel(x, y, Color.Black); <br />
}<br />
catch(System.ArgumentException)<br />
{<br />
<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
}
in this method, there are four arguments
1- input picture
2- output picture (that is modified)
3- color
4-noise
this method making edge detection for the face
i want to passing a picture to this method and having the modified picture,.........how can this task accomplished
i will be grateful if the answer be in code
thanks to u in advance
haitham
-- modified at 7:49 Sunday 19th February, 2006
|
|
|
|
|
So you have a method, and you can't even figure out how to call it? Don't you think that face recognition might be something that is far beyond your current skill level?
The method that you are showing is not possible to call anyway. A method name can not contain a space character.
---
b { font-weight: normal; }
|
|
|
|
|
the problem is how can i handle the modified picture but not in calling the method
2and the space u mentioned is here(fault for any reason) but i am sure that it wasn't in the code
haitham
-- modified at 11:28 Sunday 19th February, 2006
|
|
|
|
|
In what way is there a problem with handling the modified picture?
---
b { font-weight: normal; }
|
|
|
|
|
This is going to be horribly slow. You should read my image processing articles to see how you should be accessing the bits of your image.
eng:haitham wrote: i want to passing a picture to this method and having the modified picture,.........how can this task accomplished
i will be grateful if the answer be in code
Your question does not make sense - what do you want ? Why are you passing in a ref Bitmap and returning void, wouldn't returning the bitmap be easier ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
eng:haitham wrote: this method making edge detection for the face
Are you following a specific algorithim? If not I am not sure your approach to doing it by detecting edges will be a feasible approach[versus using it as a stepping stone]. From your previous post its not clear if your trying to match faces or detect them. One method you might want to look at is eigenfaces. Here is a paper about it if you don't mind the math[^] It should come out to about a page of matlab code.
The Quran's Rational Arguments (Audio)
Background on Prophet Muhammad (in progress)
"They are MUSLIM. It does not matter how you split it up: all msulims (so they say) see every other muslim as a brother, regardless of origin or nationality." -legalAlien. Alhamdullah for the blessing of Islam
|
|
|
|
|
first i would like to thank u about ur help and i want to tell u that i changed the algorithm to that code
public static void DetectSkin(Bitmap original, ref Bitmap modified)<br />
{<br />
Graphics g = Graphics.FromImage(original);<br />
ArrayList points = new ArrayList();<br />
for(Int32 x = 0; x < original.Width; x++)<br />
{<br />
for(Int32 y = 0; y < original.Height; y++)<br />
{<br />
<br />
<br />
Color c = modified.GetPixel(x, y);<br />
<br />
double I = (Math.Log(c.R) + Math.Log(c.B) + Math.Log(c.G)) / 3;<br />
double Rg = Math.Log(c.R) - Math.Log(c.G);<br />
double By = Math.Log(c.B) - (Math.Log(c.G) + Math.Log(c.R)) / 2;<br />
double hue = Math.Atan2(Rg, By) * (180 / Math.PI);<br />
<br />
<br />
<br />
<br />
if (I <= 5 && (hue >= 4 && hue <= 255))<br />
{<br />
points.Add(new Point(x, y));<br />
} <br />
else<br />
{<br />
modified.SetPixel(x, y, Color.Black);<br />
}<br />
<br />
<br />
}<br />
}<br />
}
but the output was not good (i.e the modified picture has black regions from the light)
do u have a solution to prevent this regions but plz i don't want the solution be in the environment i want the solution in code ...if u know any article regarding this problem plz tell me
thanks to u in advance
haitham
|
|
|
|
|
Hi, Has anyone experienced this problem?
by VS2005 C#, i had made class library project contains custom control called "DynamicPanel" inherited from System.Windows.Forms.Panel, this "DynamicPanel" contains some child controls ..
now in my WindowsApplicationProject --> Form1 i'm Draging "DynamicPanel" from the toolbox and all properties was found in PropertyGrid ..
my problem is: i want to be able to access the properties of any of the child controls in "DynamicPanel" by selecting them ( by clicking on them ) in design time. how can i do that?
I would appreciate your help ...
|
|
|
|
|
How To change a user's group or account type in c# (or command line)?
|
|
|
|
|
In Visual Stdio 2005, the "WebBrowser" control. How can i get the url of user
clicked?
void CurrentBrowser_NewWindow(object sender, CancelEventArgs e)
{
e.Cancel = true;
//i want to get the url of user clicked to open the web in
//my own browser
string url = ???
this.CurrentBrowser.Navigate( url )
}
THANK YOU
|
|
|
|
|
Hello,
Is it possible to get a progress value of any method in general which can be used in progresbar control ? I mean, I have some method which takes long time and in the mean time method is being executed, I want to show the user about the percentage of done work ( of that method ).
Is it a solution if i think about using background worker if in these cases ? If so, then how do a background worker know how much work is still left before it finishes it's work ?
thanks and regards
Emran
|
|
|
|
|
There is a very easy way to show the progress of your method into a progress bar : decide into your method when the progress bar should be incremented (note that at the exit of the procedure the progress bar should have reached the max value).
In order to obtain a continous effect, you should run the method that affect the progress bar into a worker thread.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Is it possible to add the 'events' tab in a property grid just like the the actual properties pane in Visual Studio .NET.
|
|
|
|
|
I need to count the number of forms in a C# project. One solution to this is to parse the '.csproj' file which is xml. There is a tag called 'subtype' which represents a form, so a counter can be incremented each time a subtype tag is obtained, but i need the exact name of the form (i.e the string which is entered in the 'name' property of the form) so that i can create an object of that particular form. What the '.csproj' xml represents under the sybtype tag is the name of the form in solution explorer (e.g if one form is 'Form1.cs' in the solution explorer, even if the 'name' property of that form is changed, it is not reflected in the xml so the exact form name is not know and hence instantiating it becomes a problem.). The problem is that changing the 'name' property of a form does not change the name of the actual corresponding 'Form.cs' file in solution explorer.
Any suggestions
|
|
|
|
|
Anyone know how to read memory? I have heard pointers, but the articles I have seen do too much with them are are written poorly(not on codeproject). I know this isn't a rent-a-coder, but if someone wouldn't mind posting a code snipit that simply read the number out of a specfic memory address, that would be great, if not a link to a good web site.
|
|
|
|
|
This example just declares an integer value of 5 and uses a pointer to access the memory that 5 is in and display it.
<br />
int number = 5;<br />
<br />
unsafe<br />
{<br />
int * pointer;<br />
<br />
pointer = &number;<br />
<br />
Console.Write(*pointer);<br />
}
Hope that helps. Pointers are not very common in C# (I dont see them much anyway) but more so in C++.
Try checking out some C++ articles on pointers. The syntax is pretty much identical.
|
|
|
|
|
I have linkLabel on my UC (that I have created) and everything is ok if background is solid, but when it's gradient, it's not very pretty.
Can I somehow set the background of linkLabel to transparent (I've tried to set on Transparent, but I couldn't, VS.NET was complaining that this is an invalid color).
Is there any way to achive this?
|
|
|
|
|
Try adding the following line of code into your user control's constructor, after the InitializeComponents() call.
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
|
|
|
|
I've added this line and when I set the background of labelControl to Transparent, VS.NET complains about invalid parameter used or Iam using the wrong approach?!
|
|
|
|
|
Is there error occuring in the designer or when you are compiling your code?
If it's a compiler error, then show us the line of code it's tripping up on.
|
|
|
|
|
I have added code you tell me to add in UC's constructor.
When I drag and drop the linkLabel on to the UC everything is OK.
When I set the back color to transparent, VS.NET complains about Invalid parameter used.
If I click OK and just ignore the error I get error displaying on linkLabel.
When I try to compile, I get same error, but in Output everything is ok - Build succeed, no warnings.
If I ignore it again and run it, I get this same error.
|
|
|
|
|
The problem is that the standard LinkLabel doesn't have the control style SupportsTransparentBackColor set, so you'll get the InvalidParameterException .
Usually you set these styles in the constructor of your control.
So what you really would have to do is to create a new class that inherits from LinkLabel :
public class MyLinkLabel : LinkLabel
{
public MyLinkLabel() : base()
{
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
}
} Now, when you use your MyLinkLabel you won't get the error message when you assign Transparent as background color.
Don't know how the painting works, though. Could be that the link label doesn't paint itself properly when it's been assigned a transparent back color. In this case you'd have to override OnPaintBackground() and/or OnPaint() .
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|