|
Hey guys,
got a problem. is there any way to align a text inside a graphics object from bottom to top without rotating the whole canvas itself? .net only provides an alignment from top to bottom and rotating the bloody canvas is too complicated since there are too many other accesses on that canvas. thanks a lot in advance.
-- modified at 17:44 Tuesday 21st February, 2006
|
|
|
|
|
Why not just rotate the canvas, then rotate it back to its original position when you're done with it. This way you can always assume your canvas is right-side up before dealing with any transformations on the canvas.
That said, have you looked at the StringFormat class?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
Hello!
Hope you all will be fine, I have a question about printing of a Page in Visual Studio 2003 by using C#, I have created a button and want to print a Page against the click Event of button without showing the Crystal Report Viewer,The values to be print can be from Datagrid (Dataset),Labels,Textboxes etc... How is it possible Please send me some code or sample project for it, I will be really thankful to you.
Regards,
AbuBakar Malik
|
|
|
|
|
hi
i want to writing 3d program in c# , i believe that OpenGL is good for this, how to use opengl in c#?
please give me OpenGL sdk for download and tutorial from very beginner to professional.
and i am 3dsmax user.
thanks.
|
|
|
|
|
|
I'm a C# newbie so execuse my ignorance. I'm coding a client server application. One of the problems i've run into is that when the client is initially loaded and can't find a network connection to the server, i get this ugly .NET error message. I would like to be able to check for a network connection before loading the program. Please help!!!!
|
|
|
|
|
You can do this two ways: the nice one and the bold one.
Let's start with the bold one.
try {
}
catch {
}
finally {
}
The nice way is to actually check using the WinAPI if there is a connection.
The following functionality checks for an internetconnection:
[DllImport("WININET", CharSet=CharSet.Auto)]
static extern bool InternetGetConnectedState(
ref InternetConnectionState lpdwFlags,
int dwReserved);
[Flags]
enum InternetConnectionState: int
{
INTERNET_CONNECTION_MODEM = 0x1,
INTERNET_CONNECTION_LAN = 0x2,
INTERNET_CONNECTION_PROXY = 0x4,
INTERNET_RAS_INSTALLED = 0x10,
INTERNET_CONNECTION_OFFLINE = 0x20,
INTERNET_CONNECTION_CONFIGURED = 0x40
}
[DllImport("wininet.dll", SetLastError=true)]
static extern int InternetAttemptConnect(int dwReserved);
Here is a simple example showing a messagebox if with the connection state:
InternetConnectionState flags = 0;
InternetGetConnectedState(ref flags, 0);
MessageBox.Show(String.Format("InternetState : {0} - {1}",(InternetGetConnectedState(ref flags, 0)?"ONLINE":"OFFLINE"),flags));
I suggest going to http://www.pinvoke.net[^] for more win API for connection checks.
|
|
|
|
|
I'm using .NET 2.0 and I have a Windows Forms app in which I want to create an rdlc report - this is the Reporting Services-type report you get in VS 2005.
I want to have an object as a datasource for the report, and I have no problem setting, populating, or binding the "top-level" object into the rdlc report, until I try to "nest" an object.
For example, I have a "Shipping" object in which a person has placed an order on a certain date, to a certain address. Has some other info like tracking number. This Shipping object will have one or more "LineItem" objects, which obviously is what they purchased.
I can bind the Shipping object to the rdlc report, but when I try to create a table, or grouping, or any list or anything on the LineItem subset, I can't figure out how to do this, if I can.
Has anyone tried this? Have any tips?
Thanks very much in advance.
Susan H
|
|
|
|
|
I have this weird comparision to do.
Any idea or suggestions are really appreciated
one decimal digit will be like 900.0 where 9 means optional and 0 means Required.
and 2nd # will be 88.8 which I have to compare and say it's valid because
decimal is required 2 digit on left are required and one digit on right .. so what ever is required are there.
8888.88 is not valid since 3rd digit is optional but cannot have more than that.
1.8 is not valid since at least 2 digit on left and one on right are required.
Thanks
|
|
|
|
|
Use a Regex object with the pattern "^\d{2,3}\.\d$" to verify the value.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks and sorry.
Thanks for your help amd sorry i didn't get it.
Thanks
|
|
|
|
|
Hello,
I'm trying to use tristate checkboxes in my TreeView control. But I can't find how. The Checked property is bool , and I was expecting a CheckState property that isn't there. So, .NET 2.0 seems not to support it but I'm sure I have seen them (the indeterminate checkboxes) in other apps.
Am I overlooking something?
Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Nope, you're not missing anything. I have some code that will do what you what, but I can't post it as an article since the bulk of it was taken from another article elsewhere, but I don't recall from where.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
As has been said, no, you're not missing anything. The way to do it is to use imagelists with graphics stolen from elsewhere and just set the item to the check in question. You'd have to override mousedown to determine if a click is on-top of the image and then switch it to the appropiate image.
That said, I'm sure there are third-party controls that already do it, but I never looked into it myself.
|
|
|
|
|
how can i convert this code to c#
especially the ReDim Preserve...
Public Function Get_Key(ByVal KeyPath As String, ByVal KeyName As String, ByVal host As String) As String
Dim RKey As Byte()
Dim ilByte As Integer
Try
Dim Key As Byte() = Get_Reg(KeyPath, KeyName, host)
ReDim Preserve RKey(14)
For ilByte = 52 To 66
RKey(ilByte - 52) = Key(ilByte)
Next ilByte
Catch ex As Exception
Return ""
Exit Function
End Try
Return ""
End Function
PAO
|
|
|
|
|
superPaul101 wrote: especially the ReDim Preserve
The .NET framework Array class has a static Resize method that should do the job.
|
|
|
|
|
how am i going to code it?
Wjousts wrote: The .NET framework Array class has a static Resize method that should do the job.
PAO
|
|
|
|
|
|
|
Our Instant C# VB to C# converter produces:
public string Get_Key(string KeyPath, string KeyName, string host)
{
byte[] RKey = null;
int ilByte = 0;
try
{
byte[] Key = Get_Reg(KeyPath, KeyName, host);
byte[] tempReDim1 = new byte[15];
if (RKey != null)
System.Array.Copy(RKey, tempReDim1, System.Math.Min(RKey.Length, tempReDim1.Length));
RKey = tempReDim1;
for (ilByte = 52; ilByte <= 66; ilByte++)
{
RKey[ilByte - 52] = Key[ilByte];
}
}
catch (Exception ex)
{
return "";
//yes - silly, but this is what you're original code does
//(the statement is never executed)
return null;
}
return "";
}
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
I have a DataGridView control on a form which is bound to a class that is derived from CollectionBase and implements IBindingList. This works okay except that the sorting acts really strangely in certain situations. To sort my class I implement IBindingList.ApplySort and in the method I use CollectionBase.InnerList.Sort and pass it an instance of a class that implements IComparer to sort the data objects in my list. The implementation of the IComparer.Compare method is relatively straightforward:
object a = MyType.GetProperty(PropertyName).GetValue(x, null);
object b = MyType.GetProperty(PropertyName).GetValue(y, null);
if (a != null && b == null)
return 1;
if (a == null && b != null)
return -1;
if (a == null && b == null)
return 0;
return ((IComparable)a).CompareTo(b);
Now this sort of works okay. For example, if my data object has properties a, b, and c which are displayed on the DataGridView like this:
a b c
100 1 1
90 2 1
80 3 1
70 4 1
60 5 1
50 6 1
40 7 1
And I click on the header for row a I get this:
a b c
40 7 1
50 6 1
60 5 1
70 4 1
90 3 1
90 2 1
100 1 1
And if I click it again I get back to the original. So far so good. If I click on column b, I get the expected behavor too. However, if I click on column c (where all the values are the same) I get this:
a b c
60 5 1
50 6 1
40 7 1
70 4 1
100 1 1
90 2 1
80 3 1
Clicking a second time gets me to the second table above. Clicking a third times gives me this:
a b c
80 3 1
90 2 1
100 1 1
70 4 1
40 7 1
50 6 1
60 5 1
And finally, clicking a fourth time gets be back to the original order.
Does anybody have any idea what is going on here and how I can avoid it? This doesn't seem to ever happen if I use a DataTable as a data source.
|
|
|
|
|
I am curious as to what the code is to put an application in the Task Bar like Windows Media does when you minimize it.
The only other application I've seen do this was Norton Antivirus 2006.
I did my googles to try and find out the api calls for this but came up empty.
Anyone have a clue as to how this is done?
Steve Welborn
|
|
|
|
|
|
Excellent, just what I was looking for.
Thank you very much.
Steve Welborn
|
|
|
|
|
It appears that a ToolstripLabel control (in a ToolStrip ) won't render its text unless the control is wide enough to completely display it. This occurs even if the text contains embedded spaces.
Is there any way to relax this restriction?
Thanks,
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|