|
Ok, ok-- you are absolutely correct. This IS the much better way to do it.
i do have a question about imagelists, before i be fishing for some within some well known apps, do you happen to know whether these are available in vs or msdn-- or more to the point, whether ms has a policy of encouraging standard images for buttons to get a standard user experience in stuff like rtf button design, or whether they view that as every app's value-add.
in any case, yet once again thanks for the fishing tips!!
________________________________________
Gosh, it would be awful pleas'n, to reason out the reason, for things I can't explain.
Then perhaps I'd deserve ya, and be even worthy of ya..
if I only had a brain!
|
|
|
|
|
Actually, look at the thread right below this current thread! (http://www.codeproject.com/script/comments/forums.asp?msg=706678&forumid=1649#xx706678xx[^])
You can also find common icons and image strips in shell32.dll, and in your Common7\Graphics subdirectory of your Visual Studio installation directory.
If you use bitmaps, make sure you set the ImageList.TransparentColor before adding images, and that all the bitmaps (or the image strip) uses the same color mask (magenta is common).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Does anyone know where to get a free pack of pretty Icons (Like: Delete, Add, Undo "Stuff like that")
P.S. Common7 has old Icons I don't like them
TIA
|
|
|
|
|
If you're talking about the ones commonly used in Windows, they're not icons. It's an image strip (a bitmap resource) and you can find most of them in %SYSTEMROOT%\System32\browseui.dll. Open the library in Visual Studio and you'll see the resources. Expand the Bitmap category and search through the different bitmaps. It contains image strips of various resolutions and color depths. You can use ImageList.Images.AddStrip to treat them as separate images for use in ListView , ToolBar , custom classes, etc.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Do any one know way FolderBrowserDialog do not come up with data if you put it in a dll ???
Program Flow:
C++ unmanged -> loads a managed C# dll
C# dll creates new FolderBrowserDialog and the dialog come up
with only the two buttons no tree view !
NOTE: the same code works fine in 2000 but not in XP home !
Thanks
Jimmy B
|
|
|
|
|
Why are you loading a managed library just to use the FolderBrowserDialog ? You do realize that it's just encapsulates the SHBrowseForFolder native method? It's in the shlobj.h header. See the Platform SDK for additional information.
Also, every control in System.Windows.Forms is just a wrapper for Windows Common Controls, just FYI.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Its not just to open FolderBrowserDialog, thats just whats not working !
there are a lot of other functionality its a plugin in system.
Jimmy B
|
|
|
|
|
Someone posted a message here not too long before you posted this about some incompatibilities or bugs or something with 2000. Perhaps the converse is that what's required to make it work in Win2K causes it to not work in WinXP, although I'd find that strange. He said he found the information at http://support.microsoft.com[^]. You might look there to see if there are any bugs that might cause this odd behavior.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Been asked to create a vector drawing package.
Already i have managed to get line, rectangle, ellipse, filled rectangles and filled ellipses placed on the screen. I can open and save my drawings.
But need help, with drawing Polygon, open curves and closed curves.
I need different pens and brushes, and implement some rubbing banding with the objects.
If anyone can help.
email2miles@yahoo.com
or lay help on here
|
|
|
|
|
There's a couple decent articles on this site about rubber bands. Just search for "rubber" or something (I wouldn't recommend doing a google search with that keyword, though! )
As far as pens and brushes, you can extend both Pen and Brush and create your own. There's also brushes with support for hatches in the System.Drawing.Drawing2D namespace.
For polygons, use the GraphicsPath class.
What I don't understand is that, while you're posting to the C# forum (hence using .NET), that you're not just using the System.Drawing namespace (like the Graphics class). I mean, maybe I'm interpretting your question wrong, but why not use what's already there? If you have to save these vectors to a file, you can always use serialization (though some ISerializationSurrogate s might be necessary) or create your own document format to save vector instructions (like an Adobe Illustrator file, for example).
You might also consider using SVG to save those instructions. It's a standard (or recommendation, don't remember its current state but I know it's still evolving pretty heavily). There is a couple good articles here on CP. Just search for, of course, "SVG".
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi all,
here's what i'm trying to do this time. I want to send text to my txtbox in an app that will serve as an output window (catch exception text, info about what's going on etc) but i don't know how to add the text line by line for every event without messing with the whole .Text property of the txtbox. Anyone can help me on this one? TIA (thanks in advance
|
|
|
|
|
When I was tracing some mess from my application I used a ListBox, it's more easy.
----
hxxbin
|
|
|
|
|
Yeah, that sounds easier, thanks mate.
But anyhow i'd like to know how this can be done with a txtbox if anyone has done it before
|
|
|
|
|
Make sure the textbox in question is a multiline textbox (Multiline property is true) and then you do something like this:
textBox1.Text = textBox1.Text + Environment.NewLine + TextToAdd;
Where textBox1 is the variable name of your textbox and TextToAdd is a string that contains the line you're adding.
EDIT: You might also want to set the WordWrap property to False.
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
Thanks mate, that worked sweet
|
|
|
|
|
Concatenating strings like - especially potentially large strings - is a bad idea. It is an 2(O(n+m)) operation. Instead, use String.Concat and when you start getting a lot of text in there, you'll notice a substantial difference.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Just drop this on your form, somewhere visible, and use Console as normal.
#region License
#endregion
using System;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace Xacc.Controls
{
public class WinConsole : System.Windows.Forms.RichTextBox
{
class MessageWriter : TextWriter
{
public override System.Text.Encoding Encoding
{
get { return System.Text.Encoding.Default;}
}
public delegate void MessageWriterHandler(string text);
MessageWriterHandler handler;
public MessageWriter(MessageWriterHandler handler)
{
this.handler = handler;
}
public override void WriteLine(string format)
{
Write(format + NewLine);
}
public override void Write(string format)
{
if (handler != null)
handler(format);
}
}
private System.ComponentModel.Container components = null;
public WinConsole()
{
InitializeComponent();
SetStyle(ControlStyles.Selectable, false);
Console.SetOut( new MessageWriter(
new MessageWriter.MessageWriterHandler(Messg)));
}
Control GetFocus(Control p)
{
Control sender = null;
foreach (Control c in p.Controls)
{
if (c.Focused)
return c;
if (c.HasChildren)
{
sender = GetFocus(c);
if (sender != null)
{
return sender;
}
}
}
return null;
}
void Messg(string text)
{
Control sender = GetFocus(TopLevelControl);
Select();
AppendText(text);
SelectionStart = TextLength;
ScrollToCaret();
if (sender != null)
sender.Select();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
private void InitializeComponent()
{
this.BackColor = System.Drawing.SystemColors.Info;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Font = new System.Drawing.Font("Lucida Console", 9F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.ReadOnly = true;
this.WordWrap = false;
}
#endregion
}
}
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
TextBox.AppendText ("string of data to add to window");
|
|
|
|
|
Hello,
I've for a couple of days been trying to figure out the best way to implement Save/Open dialogs that can show a preview and it turns out to be pretty much work!
Since this feature is present and fairly easy solutions exists outside of .NET, (using for example MFC), can I just create a C++ class for this and use it from my C# program?
If yes, how is this done?
Thanks for your help,
Bjorn
|
|
|
|
|
Create the functions in native win32 dll and then you can call them like the way you call other win32 in C#. Search DllImport in CP and in MSDN for the use of native methods in .NET
Mazy
No sig. available now.
|
|
|
|
|
I told you how before. What about that didn't make sense?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
No sorry I didn't understand fully and didn't want to reply on that since it would be placed far down on the messageboard =)
(But I just figured out that's what the 'mail-me-when-replied' function is there for...)
What I'm wondering about is the many alternatives to making a control in C++, like COM, Win32 API, etc..
Which of these solutions is best/easiest/tractable?
The reason I dont fully understand is i'm not much into windows programming from before..
|
|
|
|
|
Doing this as a COM component will allow you to use COM interop in your application, which is pretty easy to do. But if you don't know much about Windows programming, COM is even more difficult to learn so I wouldn't recommend it. Besides, deploying the solution requires that not only do you copy the COM DLL to a target directory but that you also register it (both not hard, but it's still a two-step process).
If you just make use of the GetOpenFileName and GetSaveFileName functions, along with the OPENFILENAME struct and a Win32 dialog template resource (all of which you'd have to do for the COM component anyway), you can encapsulate this function just like the default Windows Forms components that you want to replace. As I said before, use a good decompiler to see how they do it. Most of the controls in Windows Forms are just wrappers for native functions and controls, after all. I would recommend this approach. To deploy, just copy the DLL into your application's installation directory or somewhere in the PATH environment variable (like the Windows or Windows\System32 directory). I would recommend the application installation directory with the rest of your managed application though, since it would keep your files together and wouldn't clutter the system with DLLs that other applications might not use.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
If i want to reproduce the functionality found in many microsoft apps, such as the windows on the bottom of vs7, that allow one splitter between two panels, to resize each panel as you move it left and right, how would i do that. I know that i can dock one, and fill the other, and have the splitter eat one of the panels area as you move the splitter, but what if you want both of the panels seperated by the splitter to resize so you dont crop any information?
Thanks,
Ryan
|
|
|
|
|
It's all about the order that the controls are added to your form. Add a Panel , dock it to the left (for example), then add a Splitter (default is to dock left), then add your final Panel with dock fill. In code, it would look like this:
this.Controls.AddRange(new Control[]
{
this.panel2,
this.splitter,
this.panel1
});
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|