|
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)
|
|
|
|
|
Greetings People .
I need to restore my desktop icons to a certain position.
My problem is that my program changes the resolution of the screen, now, when it closes, it returns the screen to the normal resolution, but by now the Icons on the desktop are all screwed up and out of place.
How can I restore them to their original place. I have searched for about 2 days and can't find anything that seems to do the trick and that I understand.
Thanks in advance.
Deano
|
|
|
|
|
deanpugh wrote: My problem is that my program changes the resolution of the screen
You should NEVER do this. Your application is running on a shared system and you've written your app to NOT work and play nice with others. When the user hit's Alt-Tab to switch to another application, you've just limited them to the screen size your app imposed on the entire system. Do that on any of my machines and I'll uninstall your app and burn the install CD.
deanpugh wrote: How can I restore them to their original place
You can't. At least, I've never found a way to do it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I wouldnt change the screen resolution on any normal app, but this is for a game I am attempting to write. Most games I have seen on my PC change the resolution and take up the whole screen.
If you have another sugestion how my app can take up the whole screen and remain the same visually then please let me know.
Thanks
Deano
|
|
|
|
|
That's because they use DirectX to do so. DirectX doesn't use the normal screen you see with your Desktop. In a Full Screen mode, it creates an entirely seperate drawing surface, kind of like an entirely new Desktop, complete with it's own video card parameters.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|