When I run the following tests (In NUnit): -
[Test]
-
public void ShouldOffsetRectangle() {
-
RectangleF standAloneRect = new RectangleF(0, 0, 10, 10);
-
standAloneRect.Offset(1, 1);
-
Assert.AreEqual(1, standAloneRect.X, "standAlone failed");
-
}
-
-
[Test]
-
public void ShouldOffsetRectangleAsProperty() {
-
TestRect propertyRect = new TestRect();
-
propertyRect.Rectangle = new RectangleF(0, 0, 10, 10);
-
propertyRect.Rectangle.Offset(1, 1);
-
Assert.AreEqual(1, propertyRect.Rectangle.X, "propertyRect failed");
-
}
-
-
private class TestRect {
-
public RectangleF Rectangle { get; set; }
-
}
The second test fails... it says that the propertyRect.Re ctangle.X is still 0.
Any ideas why this behavior might be? I am stumped at this point.
Obviously I can get around it by offsetting the Rectangle before assigning it, I am just trying to figure out why I am seeing this behavior.
Thanks,
Matt
0 1887 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Matt |
last post by:
I posted a question before regarding the offset positions when I used
CSS. Some people suggested I should use percentage instead of pixels?
I tried many different ways, but the position still offset when I
resize the browser. Here's the modified code. I just don't want the
link and frequently used link text are mixed when i resize the
browser. Any workarounds to this problem? Please help!!
<html>
<head>
|
by: Eric Lilja |
last post by:
Hello, I had what I thought was normal text-file and I needed to locate a
string matching a certain pattern in that file and, if found, replace that
string. I thought this would be simple but I had problems getting my
algorithm to work and in order to help me find the solution I decided to
print each line to screen as I read them.
Then, to my surprise, I noticed that there was a space between every
character as I outputted the lines to the...
|
by: junky_fellow |
last post by:
I am trying to find the offset of a member "mbr" inside a structure
"str" as follows:
offset = &(struct str *)0->mbr;
But, on compilation I get the following error:
cc: Error: m1.c, line 55: In this statement, "0" has a signed int
type, but occurs in a context that requires a pointer. (needpointer)
Can anybody point out where the problem is ?
|
by: Yaron |
last post by:
Hi
Is there any EASY way to convert RectangleF to a Rectangle object? Casting doesnt work, and it doesn't have a ToRectangle function or anything like that (although it should!
Thanks
Yaron
|
by: Lyle Fairfield |
last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp
The Joy of Interoperability
Sometimes a revolution in programming forces you to abandon all that's
come before. To take an extreme example, suppose you have been writing
Visual Basic applications for years now. If you're like many
developers, you will have built up a substantial inventory of code in
that time. And if you've been following...
| |
by: Hypnotron |
last post by:
Dim Dimensions as RectangleF = RectangleF.FromLTRB(-100, 100, 100, -100)
debug.writeline( "Height = " & RectangleF.Height.ToString)
Why the heck is height -200 ? How can you have a negative height?
Width is ok, but height is clearly wrong. This looks very much like a bug to
me. Further, when you try to check
Dim mybool as Boolean = Dimensions.Contains(50.0,50.0)
|
by: lior_kovarsky |
last post by:
I have a listview with large icons. When user clicks, say the top left
of an icon, and in
the mouse down event i have
Point p = listview1.PointToClient(new Point(MousePosition.X,
MousePosition.Y)),
if I then compare p to listviewitem.Position, where listviewitem is
the icon the user clicked,
then in some cases the two points aren't equal. Anyone that can
explain why this offset exists
and is there a way to know what this offset would...
|
by: kalyan |
last post by:
Hi,
I am using Linux + SysV Shared memory (sorry, but my question is all
about offset + pointers and not about linux/IPC) and hence use
offset's instead on pointers to store the linked list in the shared
memory. I run fedora 9 and gcc 4.2. I am able to insert values in to
the list, remove values from the list, but the problem is in
traversing the list. Atlease one or 2 list nodes disappear when
traversing from the base of the list or...
|
by: GTalbot |
last post by:
Hello fellow comp.infosystems.www.authoring.stylesheets colleagues,
Imagine this situation:
#grand-parent-abs-pos
{
height: 400px;
position: absolute;
width: 600px;
}
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |