|
I seen an article on this subject here on code project some months ago, search through the aricles section.
|
|
|
|
|
i wanna create a form which shows list of all systems in network
If, u know please help.
Thanks
|
|
|
|
|
When fast user switching is enabled, how can a service find out which user is the active user?
(I realise this is more of an operating system question than a C# one, but there didn't seem to be a suitable operating system message board, and I am developing with C#/.NET 2.0, so I hope it's OK here.)
Dave
|
|
|
|
|
Ok, I have to admit that I am more of a VBer (no flames PLEASE) than a C#er here but I am trying to work through something that just does not seem to make sense and am looking for some help. I am trying to convert a OS project called NClass over form C# to VB, mostly just as an exercise in reading C#, learning the REAL differences between the two as well as to end up with a component that I can use latter on.
I have run across the following lines of C# code that, although I can convert it to VB no problem, makes little sense to me and in fact throws an error.
shapes[i].Draw(g, shapes[i].Location - (Size) area.Location + marginSize);
Does C# allow you to cast a Point type to a Size type?
I THINK I get the idea about what they are trying to do here (draw a shape on an image based upon its location in relation to the location of the shape on the drawing area plus adding a bit for a margin) but it simply makes no sense to me that you would be allowed to do this in this manner.
Can anyone enlighten me?
Seems to me this falls into the category of one of those things that C# lets you get away with but is not all that proper.
|
|
|
|
|
Ray Cassick wrote: Does C# allow you to cast a Point type to a Size type?
Yes.
public static explicit operator Size (
Point p
)
Specifically so you can use points in size operations. Otherwise you would have to do something like "new Size(p.X, p.Y)". Of course, that's what's happening internally, I imagine.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
There is an explicit conversion (op_Explicit) defined for a Point to a Size structure.
public static explicit operator Size (Point p)
You can do this in Visual Basic as well. The syntax is just different.
//C#
Point myPoint = new Point();
Size mySize = (Size)myPoint;
'Visual Basic
Dim myPoint As New Point
Dim mySize As Size = CType(myPoint, Size)
'or
'Dim mySize As Size = Point.op_Explicit(myPoint)
|
|
|
|
|
Thanks for that...
I guess you DO learn something new every day.
|
|
|
|
|
I splitted an image into small pieces (segments) and made some functions on them, then now i want to merge (reconstruct) these pieces into one image agian using c#, does anyone know how can I do this?
Thank you
Mayy Magdy Saad
Junior Solutions Developer
|
|
|
|
|
You can create a new Bitmap (an empty one with known size, or a copy of an existing image),
then create a Graphics object for it with Graphics.FromImage
then perform whatever drawing operations you want to apply,
and maybe end it all with a Bitmap.Save()
Luc Pattyn
|
|
|
|
|
Good anwser .. it almost sounds like a breakfast recipe
|
|
|
|
|
|
Hi all,
We have developed a web application with .net 2.0 in asp.net.
I am trying hard for the last couple of weeks to use sitemap for role based access.
we are authenticating users with our custom code (LDAP and database table based on user type).
I am not able to use the role based access for sitemap.
tried enabled securitytrimming in web.config and enabling rolemanager etc. but when i enabled that nothing was visible in the menu bar.
when i dont keep security trimming in web.config i see all the menu items (roles are not applied).
any one who has worked on this, could you please through some light on this.
this is bit urgent.
|
|
|
|
|
Is there a way to compile C# applications to native win32 executables that don't need the framework to be executed?
Thanks in advace.
Mohamed El Gohary
|
|
|
|
|
Yes, using this tool. But doing so is not recommended at all.
|
|
|
|
|
i read from database but i dont know how many labels ill need. so how can i make label in for loop:
DataTable strani= upo.return(ime);
for (int i = 0; i!=x; i++)
{
//i dont want that->
Label1.Text = strani.Rows[i][0].ToString();
HyperLink1.Text = strani.Rows[i][1].ToString();
HyperLink1.NavigateUrl = strani.Rows[i][1].ToString();
...}
|
|
|
|
|
...just on first glance, I would assume that you could just create a new System.Windows.Controls.Label inside your for loop, set the label text appropriately, and offset it's location on your form...you'd probably want to resize the form while you're at it so you don't end up running off the appspace while you're dynamically creating this thing
(Nyquist Rate || ! Nyquist Rate)
{
Console.WriteLine("That is the question.");
}
|
|
|
|
|
i am making it in asp.net,so i dont know if that is the same you wrote. i tried Label neki = new Label(); but it doesn work
|
|
|
|
|
Hello,
boss-tech wrote: i tried Label neki = new Label(); but it doesn work
What, doesnt work?
Have you added your new label instance to the controls collection of youre form?
YourForm.Controls.Add(YourLabel);
P.S.: * I just cant find the question mark on that french keyboard Im working on!
found it
All the best,
Martin
-- modified at 9:59 Monday 22nd January, 2007
|
|
|
|
|
You're going to want to use a PlaceHolder.
protected PlaceHolder ph = new PlaceHolder();
.
.
.
for(int i = 0; i < numberOfLabels; i++)
{
Label l1 = new System.Web.UI.WebControls.Label();
l1.ID = "Label" + i;
l1.Text = strani.Rows[i][0].ToString();
ph.Controls.Add(l1);
}
...You're probably not going to want to add it to the form.Controls default placeholder. ...It could screw your formatting up later on
(Nyquist Rate || ! Nyquist Rate)
|
|
|
|
|
It works
Does anyone know how to get datatable size- not original size, but how many data was written into datatable- how many rows? help
-- modified at 16:09 Tuesday 23rd January, 2007
|
|
|
|
|
|
that article pertains to winforms...and it's very convoluted. He was building an ASP.NET app. ..Using a PlaceHolder for his labels is much more straight forward.
(Nyquist Rate || ! Nyquist Rate)
{
Console.WriteLine("That is the question");
}
|
|
|
|
|
The technic to apply is exactly the same...
|
|
|
|
|
(I don't want to hijack the OP's thread, so this will be my last post in here unless OP requests my input) Actually, they are not the same techniques. In ASP.NET you can simply put a PlaceHolder control on the page and add dynamic content to it. You can set the PlaceHolder up so that it is dynamically sized, and none of your formatting is broken. The way you describe creating dynamic content using a PictureBox seems to be very, VERY 'hacky'
(Nyquist Rate || ! Nyquist Rate)
{
Console.WriteLine("That is the question");
}
|
|
|
|
|
Hi everybody,
I'm currently developing an API that acts as a wrapper for an external pay-for-use web service. I have to authenticate our account information and the external provider returns an encoded key that I have to pass to every one of their service methods. To make it so that not just anyone can hook into the API and eat up the license, the decision was made that all of the account information had to be passed from the client to the API via a .config file. The thing that I'm concerned with is that the API is just exposed as a class library. Does anyone have have any ideas for best practices on allowing the client to pass configuration information to the authentication method in the API? The idea that I have was that the API shouldn't care and that the client side should worry about loading that info through their config file and just pass it to the interface method as strings. Does anybody see any conflicts with that? Anybody know of more elegant methods?
(Nyquist Rate || ! Nyquist Rate)
|
|
|
|