|
Suuuhweeet! Thanks. That's what I was looking for.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi...
I have created a normal color dialig like this:
ColorDialog cd = new ColorDialog();
cd.Color = Color.Black;
Color NewColor = Color.Empty;
if(cd.ShowDialog() == DialogResult.OK)
NewColor = cd.Color;
It works great, but my problem is, that i only wants
the SystemColors to be shown in the ColorDialog,
so the NewColor only can be a System Color.
Can anyone help me?
Thanks
QzRz
|
|
|
|
|
Try this,
ColorDialog colorDlg = new ColorDialog();
colorDlg.AllowFullOpen = false;
colorDlg.ShowDialog();
|
|
|
|
|
I tried it, but its still not giving me System
colors only.
My problem is, that i load the color using the
System.Drawing.Color.FromName and when i do that,
i must have the name, and not the code like ffff0080.
To get the name I use the pictureBoxSomething.BackColor.Name!
|
|
|
|
|
Well do you see the "Define Custom Colors>>" button as disabled. I think this is all you need.
colorDlg.AllowFullOpen = false;
exactly does what you want. I guess by doing this the user can select only named colors.
Can you please elaborate on what is not working? I guess I did not understand you question well enough.
|
|
|
|
|
The AllowFullOpen disabled the "Define Costom Colors" as you said.
But some of the colors which the user still can select are not named colors.
At my Dialog, the color on the fourth row in the right side(somekind of blue color i think)
does not return a name, it gives me this code insted "ff8000ff" when i try to get the name.
Basicly my problem is very simple, i wants the colordialog to show colors
which only return named colors, so i can use them through the System.Drawing.Color.FromName event.
Is that possible?
|
|
|
|
|
Hello guys,
Does anybody know where i could find a decent reference for configuration files for .net 2.0
besides msdn2.microsoft.com ?
|
|
|
|
|
Im trying now to get the coords of the mouse on the SCREEN out side my form
i was thinking to use win32 WindowProc function on the desktop handler
( using getDesktopWindow() )
im familiar with using external functions like getDesktopWindow
but i just have no clue how to use WindowProc function ..
it suposed to get callback function or something
how to do it in c# ???
thanks
|
|
|
|
|
Have a look at System.Windows.Forms.Cursor.Position.
|
|
|
|
|
But it will only give me the position can i make a function which will catch mousemove event outside the window?
|
|
|
|
|
Search for global hooks here on CodeProject and you'll find some articles that describe how to do what you're looking for.
www.troschuetz.de
|
|
|
|
|
|
I have following:
string dec = "2";
string amount = "1000"
I want to put a decimal in 1000 based on dec number. So for instance if dec=3 >>> amount should become 10.000....if dec = 2, amount=100.00
How can I achieve this type of operation??
regards
|
|
|
|
|
how about something like this:
<br />
int iDec = int.Parse(dec)<br />
double dAmount = double.Parse(amount)<br />
dAmount *= 10;
dAmount /= Math.Pow(10,iDec);<br />
Amount = dAmount.ToString("f" + iDec);<br />
<code>
|
|
|
|
|
or
amount.Substring(0,amount.Length-(dec[0]-'0'))+"."+amount.SubString(amount.Length-(dec[0]-'0')
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
this worked for me. thanks
|
|
|
|
|
Is there any equivalent of the _MFC_VER macro for the C# preprocessor that allows the user to detect the CLR version at compile time? I saw something like _CLR_VER in the 2005 C++ docs, but nothing for VB.net, C# or C++ for the .NET 1.0, 1.1 versions. ( I am using C# 2003 latest service packs.)
.............................
There's nothing like the sound of incoming rifle and mortar rounds to cure the blues. No matter how down you are, you take an active and immediate interest in life.
Fiat justitia, et ruat cælum
|
|
|
|
|
No, there isn't.
If you using C# 2003, you'll be compiling using the .NET Framework 1.1. VS.NET 2003 will NOT compile using 1.0 or 2.0 of the .NET Framework.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
There isn't. Java and .Net have been gravitating away from the concept of a "pre-compile" step so there is no "preprocessor" to mess with. I believe ultimately this is a good thing since it leads to cleaner, far more readible code.
More to the point, why do you need to know, at compile time, what version of the CLR is available? You need to remember that a machine might have multiple versions (if not multiple implementations) of CLR available to run against. What would one do with such information in any C# code anyway? Versioning is handled by attributes and metadata where the compiler doesn't care (beyond generating correct IL).
|
|
|
|
|
I was concerned with the availability of obsolete functions or methods from one version of the CLR to another. With a CLR version compile time symbol definition I hoped to avoid all those obsolete methods messages.
I will have to perform run-time detection of the CLR, but was hoping to use a ConditionalAttribute with the CLR version for source I might distribute that would work on 1.1 or 2.0 of the CLR.
Oh well.
.............................
There's nothing like the sound of incoming rifle and mortar rounds to cure the blues. No matter how down you are, you take an active and immediate interest in life.
Fiat justitia, et ruat cælum
|
|
|
|
|
hi to all,
in a listview how can align right only the data in the column without the title of the same column.
in other word :
the title must be align to the left and the data must be align to the right
best regards and thanks in advance
fady
|
|
|
|
|
I'm learning C# and am using VS.net 2003 with SQL server 2005. I have a table called Train_Schedule with a filed of type smalldatetime called Arrival_Time .
I created a typed dataset called Train (similar in structure to Train_Schedule ) and bound it to my datagrid, stationGrid . In my form, I have a datetimepicker called arrivalTimePicker , which displays the time in a custom format of hh : mm tt . The MaxDate and MinDate properties are set to the current date, so the user can only select the time.
In a button click's event handler, I have the following code:
string arrivalTime = arrivalTimePicker.Value.ToShortTimeString();
MessageBox.Show(arrivalTime);
object[] rowData = new object[5];
rowData[0] = trainNumber;
rowData[1] = stopNumber;
rowData[2] = stationCode;
rowData[3] = arrivalTime;
rowData[4] = departureTime;
DataSet trainDataSource = (DataSet) stationGrid.DataSource;
trainDataSource.Tables[0].Rows.Add(rowData);
But the grid displays only the date, not the time. How can I display the time and not the date in the datagrid?
Thanks in advance!
Cheers,
Vikram.
Google talk: binarybandit upsdude: when I looked at laurens profile, a couple of gears got stripped in my brain.
Michael Martin: Too bad she bats for the other team.
|
|
|
|
|
Have you tried -
string arrivalTime = arrivalTimePicker.Value.ToString("hh:mm:ss");
|
|
|
|
|
I have some code that builds a web form datagrid on the fly. This method ...
{
bc = new BoundColumn();
.
.
.
if( c.ItemType == "Time" )
{
bc.DataFormatString = "{0:t}";
bc.ItemStyle.Wrap = false;
}
if( c.ItemType == "Date" )
{
bc.DataFormatString = "{0:d}";
bc.ItemStyle.Wrap = false;
}
DataGrid1.Columns.Add( bc );
}
... seems to work for me.
-- modified at 8:51 Tuesday 18th October, 2005
|
|
|
|
|
Stan, I'm using a Windows forms application. I don't generate columns on the fly; rather, I use a typed dataset.
DataFormatString is not a property of System.Data.DataColumn .
Any workarounds?
Woah! Managed to post this after 1+ hour of trying!
Cheers,
Vikram.
http://www.geocities.com/vpunathambekar
Google talk: binarybandit After all is said and done, much is said and little is done.
|
|
|
|