|
Yep, it truly thinks that its editing an icon file.
James
Simplicity Rules!
|
|
|
|
|
Well, glad it's not the SlimFast...
Little investigation shows that creating a new 'Cursor' actually just creates an Icon instead. You can copy an old cursor into it and change it and then it works (ok).
It does NOT support 256 color cursors, only 16 color ones. (ugh).
|
|
|
|
|
hi, strange thing this:
i have an mdi-app and want to scroll the child-windows by use of the cursor-keys (which is kind of natural to me and a few others) . but i get no key-down-event for the cursor-keys in my mdi-child. i have played around a lot with the following results:
in non-mdi-environments (simple form) everything is ok (compare to petzold: chapter 6, SysInfoKeyboard)
switching back to mdi: even in the mdi-parent form (the outer "container") i get no Keys.Up/Down/Left/Right - messages. but only if there's no modifier pressed. means: "ctrl-up" or "alt-down" do reach the child-window , but it seems that someone blocks the simple cursor-key-pressed-events, when i enable the IsMdiContainer-property of the main form.
anyone any idea?
:wq
|
|
|
|
|
If you override IsInputKey/IsInputChar do you still see that problem?
Try overriding it in the MDI child first, then in the parent, then in both.
HTH,
James
Simplicity Rules!
|
|
|
|
|
man, what are you doing? editor for the class-library-documentation?
the following seems to work, inserted in the child-window-class
protected override bool IsInputKey(Keys data)
{
return true;
}
at least in my little test-app. i will try in the real project in a minute.
thx!
-----------
edit:
did it a bit safer in the real project
protected override bool IsInputKey(Keys data)
{
bool ret = base.IsInputKey(data);
if (data==Keys.Up || data==Keys.Down || data==Keys.Left || data==Keys.Right)
return true;
else
return ret;
}
nevertheless - it works.
:wq
|
|
|
|
|
Rüpel wrote:
man, what are you doing? editor for the class-library-documentation?
LOL, no nothing quite as nice as that; I just have a knack for remembering programming related things. Unfortunately 90% of the time I can't remember what I said 5 minutes after I say it :-P
James
Simplicity Rules!
|
|
|
|
|
Hello!
I would like to display some little information (numbers to be exactly) in the system tray. I tried successfully to display an Icon there (NotifyIcon), but this is of course static. Is it possible to display Text/numbers in the tray?
When it is not, are there possibilities to dynamically create/draw icons at runtime to display them?
Thanx for any help
Mario
|
|
|
|
|
Hello.
Solved it with:
// Create Bitmap
Bitmap TestBitmap = new Bitmap(16,16,PixelFormat.Format32bppArgb);
// Draw whatever you want
for (int i=0; i<16; i++)
TestBitmap.SetPixel(i,i,Color.Red);
// Show as Icon
IntPtr PtrIcon = TestBitmap.GetHicon();
this.MyTrayIcon.Icon = Icon.FromHandle(PtrIcon);
MyTrayIcon is a "NotifyIcon", Other PixelFormat may be better, This is just a code-snipped...
Mario
|
|
|
|
|
I'm sure many of you have experimented with the code commenting features in C#. For those of you who haven't it works like this - above a function you can place some code comments using a special identifier "///" in xml format, like this:
/// <summary>
/// Logs the user into the system
/// </summary>
/// <param name="UserName">User's name</param>
/// <param name="Password">User's password</param>
/// <returns>Boolean value indicating success (true) or failure (false)</returns>
/// <exception cref="LoginException">User name or password was incorrect</exception>
The C# compiler provides you with the option to generate an xml file containing all of these comments in a nicely structured format. VS.NET provides a utility to generate web pages from this xml file. These web pages are rather nice, and could be bundled into a .chm file for distribution. However, this tool doesn't generate pages of the same quality as msdn. The pages look pretty yukky and only certain info is included - for example exceptions are not shown, which is a problem as consumers need to know what exceptions might be thrown.
So after that whole essay - does anybody know of a tool which can generate nice documentation (up to the standard of msdn), and then package that documentation automatically into .chm files? If not, would this be a valuable article? If so, would somebody be willing to collaborate with me on this effort?
Cheers
|
|
|
|
|
Take a look at nDoc, it has an option to produce output almost exactly like MSDN
James
Simplicity Rules!
|
|
|
|
|
James!
You don't know how much easier you have made my life; nDoc is EXACTLY (a good start anyway) what I was looking for...
Thanks,
Neil A. Van Note
|
|
|
|
|
>>nDoc is EXACTLY (a good start anyway) what I was looking for...
I concur, thank you James!
Is a society built on greed better than a society built on survival?
|
|
|
|
|
How can I create an outlook bar in C#, is it very complicate ?
BTW i don't know if it's only a problem with my VS .NET version ( I Have full release) but the splitter control seems to have a bug, anybody can help me on this ?
|
|
|
|
|
Its going to be as complicated as creating it with any other toolkit :-P
What is your problem with the splitter?
James
Simplicity Rules!
|
|
|
|
|
But how can I create one Outlook Bar ?
Splitter = why this control have to be docked somewhere to work ? in VC++ you can place it anywhere on the screen no ?
Thanks J
|
|
|
|
|
Creating one is a bit different, but might not be too hard to do. Essentially each pane in the outlook bar consists of a Panel, a Button, and a List View set in Large Icon or Small Icon mode.
Instead of a list view you can also create your own control which uses flat buttons instead.
Clicking on a button tells the outer-most control that it needs to move the panels above to the top so only the button can be seen, and move the panels beneath the one selected to the bottom (changing the height of the panel so as not to obscure the other buttons). Then resize the panel that was clicked on so that it fills the rest of the area (DockStyle.Fill )
Off the top of my head anyway
If I get around to it I may actually write an Outlook Bar component someday
MFC differs a bit from .NET because it doesn't have any builtin layout engine. In .NET you get some aspects built in, which is why I think it requires docking. Usually though docking isn't a problem, you just have to figure out the combination of splitters and other controls to get it to look the way you want.
James
Simplicity Rules!
|
|
|
|
|
k I think I got it.
BTW I have another question how can I create a custom control on C#, I search over MSDN but I didn't got good result. The example in the .NET show us how create a user control make from existing control like a panel with 3 buttons and this will be a futur control I can use. But what I want to do it's to create a control by the beginning at the drawing stage or derived an existing one.
Do you have good tutorials for this or reference anything which I can use to help me ??
Thanks Again James
Jonathan
|
|
|
|
|
To create your own control simply create a new class and derive from System.Windows.Forms.Control; or in VS.NET choose to add a new item and choose Custom Control from the box.
You can then handle the events you want (overriding OnPaint is going to be one of them )
Here's a simple control that creates a very lightweight label
using System;
using System.Drawing;
using System.Windows.Forms;
public class LightLabel : System.Windows.Forms.Control
{
public LightLabel() : base()
{
}
public override void OnPaint(PaintEventArgs e)
{
Brush textBrush = new SolidBrush(ForeColor);
Brush background = new SolidBrush(BackColor);
Graphics g = e.Graphics;
g.FillRectangle(background, Bounds);
g.DrawString(Text, Font, textBrush, Bounds);
textBrush.Dispose();
background.Dispose();
}
} I didn't actually compile the code but that is the general idea behind creating your own control. You'll also want to look at the ControlPaint class for lots of cool drawing effects you find on controls (the etched border, drawing a 'disabled' image, etc).
If you want to get really fancy with your control you'll need to look at Designers which is something I haven't looked at in-depth yet.
James
Simplicity Rules!
|
|
|
|
|
I had a similar problem with a Toolbar - I did not want it locked so I put this in the Constructor after it initializes eg DockStyle.None . This is possible but you can forget about using the designer as it will not understand that the component is no longer docked and other coomponents eg a fill component will overwrite it so I had to use Dock to Bottom for the Fill Panel.
Ben
|
|
|
|
|
i send a RowData object from a DataSet (dataset.getTable().Rows[x]) to a form that then displays that row in unbound controls. That form has a navigate forward and back button.
how do i find out the row's index in a dataset so that i may 'movenext' or even iterate from that point? the problem is that the form does not know the row index and it cannot call back to the owner form.
burnt
|
|
|
|
|
You'll have to somehow pass the row index to the child form.
I would work with the DataTable object in the child form, then you could do your iteration through that, as well as add new rows to the table. You can get the DataTable object from the DataRow object by the DataRow's Table property.
James
Simplicity Rules!
|
|
|
|
|
but i dont have the index and can not change the api i am using.
the question is, and remains, how do i get the index of a row in a dataset given a DataRow object, and a DataSet object, and NOT the index of the current RowData object.
if i can say dataset.Table().rows[20] and get a DataRow object, shouldnt i be able to easily code dataset.Table().rows[_row.rowID + 1] ?
the rowID property shows up in the watch window, but why is private? how do i get to it?
|
|
|
|
|
Hi,
I'm wondering if it is possible to save an instance of a class to a file (as is) and vice versa.
I have a class that can contain about 2000 ethernet packages. I would like to save this entire class to a file, but also be able to open it again for later use. Something like: MyClass = (MyClassType)FileStream ???
Any ideas??
G
|
|
|
|
|
You need to look at something called serialization.
Heres a simple example
using System;
using System.Runtime.Serialization.Formatter.Binary;
using System.IO;
[Serializable()]
public class MyClass
{
public int MyInt;
private int privateInt;
public MyClass(int pub, int pri)
{
MyInt = pub;
privateInt = pri;
}
public void PrintOut()
{
Console.WriteLine("MyInt = {0}, privateInt = {1}", MyInt.ToString(), privateInt.ToString());
}
}
public class Driver
{
public static void Main()
{
MyClass myClass = new MyClass(4, 2);
FileStream stream = new FileStream("C:\\myclass.bin", FileMode.CreateNew, FileAccess.Write);
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(myClass);
stream.Close();
myClass = null;
stream = new FileStream("C:\\myclass.bin", FileMode.Open, FileAccess.Read);
myClass = (MyClass) formatter.Deserialize(stream);
stream.Close();
myClass.PrintOut();
}
} If you want to customize what is saved in the serialization process refer to the documentation on the ISerializable interface
HTH,
James
Simplicity Rules!
|
|
|
|
|
With File.GetLogicalDrives() I can get name of drives,but how can I check if they are CD-ROM or Floppy drives?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|