|
SystemColors.ActiveCaption and SystemColors.InactiveCaption give you the 1st colors for the gradients. To get the other colors, you need to P/Invoke GetSysColor like the other reply mentioned.
To convert the DWORD return value use ColorTranslator.FromWin32 or Color.FromArgb .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
You have to use the API Function:
<br />
[DllImport("User32.dll", EntryPoint="GetSysColor")]<br />
public static extern int GetSysColor(long nIndex);<br />
The Integer you get is in the Form (hexadecimal)
<br />
0x00bbggrr<br />
(if I remeber right).
For the second color of the Title Bar gradient you need the color with the index 27. More info should be in the API description.
Greets
Roland
|
|
|
|
|
Does anyone know if the refresh version has any new featured/bug fixes? On the website it says its the same beta, plus Team Systems. I don't want to download 3.5GB just to get team systems.
|
|
|
|
|
Hi there,
I'm writing a C# application and using a C#Express Beta2 and SQLExpress Beta2:
I've created an object (say 'Human') which I persist to a SQL DB table. Human has a DateOfBirth property of the (.Net) type DateTime. The apropriate field in the table is of SQL type DateTime. Now I create an instance of my Human and set the DateOfBirth to yesterday using the following code:
Human Human1 = new Human();
Human1.DateOfBirth = new DateTime.Now.Substract(new TimeSpan(1, 0, 0, 0));
Then that I persist my you Human to the database. After that I create a new instance of my Human (Human2) and read it's property-values from the database, like:
if(Human1.DateOfBirth == Human2.DateOfBirth) {
}
Comparing Human1's DateOfBirth with Human2's I do not get the expected result as the two DateTime objects return the same Date and Time, but looking at the DateTime.Tick property I see some fractional differences .
How do you handle this? Thanks in advance.
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
The dates are probably not the same because the Time is included in it as well. So if one Human was saved 1 o clock and the other at 3 o clock, the datesTIME's wouldn't match. so match only the Date parts:
if(Human1.DateOfBirth.Date == Human2.DateOfBirth.Date) {
// this code is never reached
}
|
|
|
|
|
Human1.DateOfBirth = DateTime.Now.Date; // init with only the date portion.
Gary
"A fellow with the inventiveness of Albert Einstein but with the attention span of Daffy Duck."
Tom Shales talking about Robin Williams
|
|
|
|
|
I'm pretty sure this has a simple answer, but nothing I've found so far (of course, the tight deadline has nothing to do with that!).
I need something with CStringList-like capabilities -- I want to keep up with between 2 and 500 (or more) strings and quickly iterate through them. What is the C# equivalent that allows me to do this?
Thanks,
Glenn
|
|
|
|
|
I'm not sure how CStringList works, but System.Collections.Specialized.StringCollection allows you to store list of strings and iterate thru them using foreach statement.
|
|
|
|
|
You beat me to it!
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
That's it exactly. Thanks.
|
|
|
|
|
|
Thanks for the clicky bits.
Ever notice that MSDN code samples don't display in FireFox as they do in IE (all the linebreaks seem removed in FF). Just a peeve directed as MS.
Thanks again for the correct and fast reply.
--G
|
|
|
|
|
Glenn E. Lanier II wrote:
Ever notice that MSDN code samples don't display in FireFox as they do in IE
Nope, I always use IE.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi all,
I'm having a bit of a problem. The company i am working for run some scheduling software on WINNT which runs programmes at specific times. We are about to start rolling out upgraded back office PC's to our shops and we are going to be using XP for the OS.
The problem is, as if you can't see this one coming , the scheduling software isn't working on XP!
I've been looking into staring external programmes from within a C# app which i could install to run as a service. When i'm trying to run EXE's there is no problem
System.Diagnostics.Process.Start("c:\\MyExe.exe");
but, one of the applications is a Dos application and it's ran via a batch file
Set IRISDATA=j:
XM IRIS7
Simply using the command System.Diagnostics.Process.Start("j:\\iris7.exe"); doesn't work.
The question is, how can i run the batch file from a c# app?
Kev Pearman MCAD
P.S. The J drive is already mapped correctly!
|
|
|
|
|
Hi Kev!
Batch files are run by the shell, so you could write:
<br />
System.Diagnostics.Process.Start("cmd.exe", "/k startiris.bat");<br />
Regards,
mav
|
|
|
|
|
Cheers Mav.
It didn't quite work but with some modifications to the batch files i wanted to run i got there in the end.
One more question though, the program can be made full screen by pressing Alt + Enter, anyway of running the batch file full screen at start up?
Kev Pearman MCAD
|
|
|
|
|
To determine how an external program is run you'll have to resort to a different Process.Start() overload using a ProcessStartInfo argument.
There you can specify the WindowStyle to use (Hidden, Maximized, Minimized, Normal).
mav
|
|
|
|
|
ok, this is for people that have worked with the infragistics web grid. Either this grid is a piece of crap or I have the serious case of stupids..either way all I need is a solution to my problem.
When I go in to add the rows to my datagrid from the front end the dataset does not persist. Let me explain myself.
AS i click the add button on the front end the grid inserts an empty row and triggers the add row row event. In the add row event i have the following code.
this.Retrieve();
DataTable _t = this._dsCateringRev.Tables[e.Row.Band.BaseTableName];
this._row = (DsCateringRev.CateringRevMinimumPeakRow)_t.NewRow();
_row.propid = System.Convert.ToInt32(this._hotel);
_row.appyear = System.Convert.ToInt32(this._processYear);
_row.RevType= "Peak";
//this._dsCateringRev.CateringRevMinimumPeak.Rows.Add( _row );
e.Row.DataKey = _row[_t.PrimaryKey[0]];
e.Row.Cells.FromKey(_t.PrimaryKey[0].ColumnName).Value = e.Row.DataKey;
this._dsCateringRev.CateringRevMinimumPeak.Rows.Add( _row );
This is more or less according the the sample app that came with the grid. Then the grid executes the updatecellbatch event. Here is the code for that:
DsCateringRev.CateringRevMinimumPeakRow row = null;
DataTable table=null;
//this.Retrieve();
object key=e.Cell.Row.DataKey;
table=this._dsCateringRev.Tables[e.Cell.Band.BaseTableName];
//Try to find the row that needs to be updated.
if (key!=null)
row = (DsCateringRev.CateringRevMinimumPeakRow)table.Rows.Find(key);
if(row!=null)
{
try
{
row[e.Cell.Column.Key] = e.Cell.Value;
}
catch( Exception _ex )
{
this._dsCateringRev.RejectChanges();
}
}
}
Well the problem is that the first time I rub this the dataset has the rows that i just added. On subsequent runs the dataset.datatable.rows.count = 0. In other words the dataset if empty.
Got any words of advice.
Thanks
Sameer
|
|
|
|
|
This question really belongs in the ASP.NET Forum[^]. Either that, or the Infragistics Support web site.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm trying to double buffer DrawThemeBackground with a number of other custom drawings to prevent flicker.
The problem is, OpenThemeData is a handle to a window.
If i use a parent window as the handle to open the theme, the child paints fine.
The bitmap HDC value is valid. But if I try to use the HDC to draw directly to the bitmap using windows theme, it just doesn't render.
If i draw onto the bitmap using just conventional graphics comands, these draw.
It's really frustrating as I'm out of options really. I Can't just think of any other way to do this.
<br />
private void CustomDrawThisControl(IntPtr pTHEME, Graphics g)<br />
{<br />
DBGraphics l_ClientDC = new DBGraphics(); <br />
l_ClientDC.CreateDoubleBuffer(this.Width, this.Height);<br />
IntPtr l_HDC = l_ClientDC.g.GetHdc();<br />
<br />
<br />
<br />
l_ClientDC.Render(g);<br />
<br />
l_ClientDC.g.ReleaseHdc(l_HDC);<br />
}<br />
I've used a modified version of norm.net's double buffering class. But it basicaly works the same.
If anyone has anymore ideas about this, i'd be appreciative.
Cheers
Cata
|
|
|
|
|
Is this inside your custom control?
You can override from Control class and in constructor do:
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
that way all drawing you do in OnPaint will be drawn to buffer and then painted, thus you'll avoid flickering.
|
|
|
|
|
Yes, it's in my custom control.
I've tried this, but it makes the flickering worse and hides the icons and text that are drawn on top of it. This only happens when i'm drawing windows themes however, so i was going to manauly double buffer it first.
Any more ideas?
|
|
|
|
|
i have a simple application where i open a bitmap in a picture box,iadded near it a horizontal and vertical scroll bar.
How can i actually make the bars scroll through the picture in the picture box
thank you
|
|
|
|
|
Ill just tell you the easy unsophisticated way:
In your form, insert a panel.
In that panel, insert a picture box.
set panel.autoscroll to "true".
Then you should have a "scrollable" image.
Cheers
Sebastian
|
|
|
|
|
Like this:
...
this.panel1.Controls.Add(this.pictureBox1);
...
this.pictureBox1.Size = new System.Drawing.Size(pictureBox1.Image.Width,
pictureBox1.Image.Height);
this.panel1.AutoScroll = true;
...
These are the important lines.
The first line will add "pictureBox1" to "panel1" (it is now inside the panel)
The second line will set the pictureBox1.Size to the size of the loaded image.
The third line adds "AutoScroll" to the panel.
As soon as the panel is smaller than the image of the picturebox within, Scrollbars will appear.
Cheers
Sebastian
|
|
|
|