|
I am glad that you found the link useful. I certainly found it to be an interesting article. I have seen the ListBox control customised but not to the extent that you require. The DataGrid control was built with extensibility in mind whereas the ListBox control was always meant to be a simple control for simple situations.
Perhaps it is possible to do what you are asking with the ListBox control but I am not sure how you would go about it. I would personally stick with a method that is well documented and that is easier to find help for if you run into problems.
|
|
|
|
|
Hi,
I have the following problem and I would appreciate any help on it.
I want to create an OCX in unmanaged side and I would like to use/access a .NET component from it. Say the component want to access is a .NET control like a grid. Don't I need to specify to transfer the information about the parent window of the gridcontrol, which is my ActiveX window? How can I do this? How can I pass a window handle to the gridcontrol?
Please help.
Thanks a lot.
|
|
|
|
|
I have Visual Studio 2002 installed and would like to install VS 2003 on the same machine. I don’t want any old project-files from VS 2002 to be changed.
Is this possible or must VS 2002 bee uninstalled before?
_____________________________
...and justice for all
APe
|
|
|
|
|
sure you can...
it is the same (i think) as installing VStudio 2003 when you already had a Visual Studio 6...
when you try to open a project created with VS2002, just tell windows to "open with" ... visual Studio .NET 2002
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Ok. I'll do It in 2 days... Tnx
_____________________________
...and justice for all
APe
|
|
|
|
|
Hello, I am currently trying to develop a video game using .NET C++. The one thing I am having trouble with is when I move (with a Key_Down event) a pictureBox with an image set, there is always a lag, and thus a piece of the image's last position always appears. How would I get rid of this?? I had tried making it invisible, changing the pictureBox's location, then making it visible again, but that makes the image blink as it moves. Any help would be greatly appreciated. Thank you.
Michael
|
|
|
|
|
Hi,
in a video game you shouldn't use a picture box. Remove it and paint the bitmap yourself onto the form/control/whatever by overriding the Paint method (don't forget to call the base implementation) and calling e.Graphics.DrawImage. This should be by far faster than the picturebox.
|
|
|
|
|
Hey thanks, I tried that and it worked a lot better, however the image still jumps and is blurry as I move it. Would there be a way to get rid of that? I know that in java they use a buffering strategy, however I do not know how to do that in .NET C++. Thanks for the help so far.
Michael
|
|
|
|
|
(I'll use C# syntax as Im not very familiar with C++)
A simple double buffering can be enabled by adding this in the constructor of your form/control:
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
Does your image have the correct size or do you resize it while painting? If it has already the correct size use the DrawImageUnscaled function. If not resize it somewhere in the beginning:
Bitmap resizedBitmap = new Bitmap(wantedWidth, wantedHeight);
Graphics g = Graphics.FromImage(resizedBitmap);
g.DrawImageUnscaled(oldBitmap, 0, 0, wantedWidth, wantedHeight);
g.Dispose();
EDIT: You should also search for 'double buffering' here on CodeProject. There are some articles which might be interesting for you.
|
|
|
|
|
the C# syntax isn't that different (I just used :: instead of .) however the buffer didn't appear to do anything. I guess it isn't possible to get rid of the flicker when painting an image, however I still do not know how it is done in java, but can't be done in .NET C++. Also, did you mean to make a paint event for the form, and then e->Graphics->DrawImage it, because that is what I did. Anyways, thanks again for the help.
Michael
|
|
|
|
|
No I meant overriding the OnPaint method of the form (but that shouldn't make a difference). I made a simple text which work fine for me (when the image is very big it slows down). Probably it helps you:
public class Form1 : System.Windows.Forms.Form
{
private Point _curPos = new Point(0, 0);
private Image _image;
public Form1()
{
base.KeyPress += new KeyPressEventHandler(Form1_KeyPress);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
_image = new Bitmap("C:\\test2.jpg");
}
private void Form1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
switch (e.KeyChar)
{
case 'w': _curPos.Y -= 5; break;
case 's': _curPos.Y += 5; break;
case 'a': _curPos.X -= 5; break;
case 'd': _curPos.X += 5; break;
}
Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
e.Graphics.DrawImageUnscaled(_image, _curPos);
}
}
Note that I'm calling the Invalidate method instead of Refresh. This is always better because the Refresh will repaint the form immediatly while Invalidate will wait until there is time to do so. If you have much more other things on your form it would also be a good idea to give a Rectangle into the form which specifies which particular region should be repainted.
|
|
|
|
|
Hi.
I am new to the .NET Framework and to the Enterprise Library. I was wondering if the Enterprise Library facilitates developers in implementing different acces levels, e.g.: an administrator will be able to view usernames&passwords, while a customer in the development department will not have such access.
Thank you,
Elena
|
|
|
|
|
I wrote a DirectX 9 program with C#.NET and it would not run on my non-development machine. I keep getting this type of error:
Application has generated an exception that could not be handled.
Process id=0xedc (3804), Thread id=0xee0 (3808)
Click OK to terminate the application.
Click CANCEL to debug the application.
I get this error from running the DirectX Tutorial program from this site as well. The programs run fine on my development machine.
Does anyone know what's cauing this problem? It's not limited to this machine. Other non-development machines also have errors running the programs. I think this problem is caused by DirectX because other .NET applications run fine.
Thanks.
|
|
|
|
|
The information you gave here just states that your application has crashed.
Where and why cannot be determined from this info.
Use try/catch to find out where your app crashes.
Regards,
mav
|
|
|
|
|
Thanks for the reply. I found the problem. The machine did not have Managed DirectX installed. I installed the June redist and it worked fine.
On a side note, I've tried adding try/catch blocks to every method in my program and that didnt do anything.
|
|
|
|
|
I've faced a strange problem in the ListView control when I mirror it to support the right-to-left layout. I am talking about .NET 1.1. When a ListView control is mirrored, ListViewItems do the mirroring, but ClomnHeader controls do not, i.e. it keeps to display as left-to-right.
Here is an example of what I've described,
http://www.elc4sa.com/mr.gif
Any ideas ??
|
|
|
|
|
When i want to handle an event from a remoting class in the client app i got
a security exception telling me that DelegateSerializationHolder is not
permitted to be deserialized at this security level. Use .NET security
policy administration tool.
plz guide me how can i handle this error and what security permissions
should i give to my assembly.
|
|
|
|
|
You need to set the TypeFilter level to Full. The following snippet might help.
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
IDictionary props = new Hashtable();
int portNumber = 9876;
props["port"] = portNumber;
props["typeFilterLevel"] =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
try
{
ChannelServices.RegisterChannel(new TcpChannel(props, clientProvider, serverProvider));
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thanks alot. your code helped me.
|
|
|
|
|
but when it want to handle the event there is another error telling me Can Not find ... assembply.
the object can be referenced but not events.
i really appreciate any help since i couldnt understand how to solve it.
|
|
|
|
|
I need wrapper class for SqlConnection which realizes interface ICommnad.
|
|
|
|
|
Is there something wrong with using SqlCommand ?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I have a problem with checking file permissions. I'm trying to check wether a user can write, read to a specific folder/file but when i test my code it says it can even thou i have removed all permissions. Don't know if the code is correct.
<br />
FileIOPermission filePermission = new<br />
FileIOPermission(FileIOPermissionAccess.Write,<br />
Request.PhysicalApplicationPath+@"test\\test.txt");<br />
try<br />
{<br />
filePermission.Demand();<br />
Reponse.Write("Permission demand successful");<br />
}<br />
catch( SecurityException securityEx )<br />
{<br />
Reponse.Write(securityEx.Message);<br />
}<br />
|
|
|
|
|
Hello You!
I need Your HELP.
I have my own TreeView Nodes Editor, in order to add 'MyTreeNode'', like node which are ComboBox and so.
I have two classes. one inherit from 'TreeView' and the other from 'TreeNode'.
In 'MyTreeView' i override 'Nodes' (keyword- new) in order to open my custom editor.
In public partial class MyTreeView : TreeView, I use the next statement:
[
DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Editor(typeof(NodesTypeEditor), typeof(UITypeEditor)),
]
new public TreeNodeCollection Nodes
{
get { return base.Nodes; }
set
{
TreeNode[] myTreeNodeArray = new TreeNode[((TreeNodeCollection)value).Count];
((TreeNodeCollection)value).CopyTo(myTreeNodeArray, 0);
((TreeNodeCollection)value).Clear();
this.Nodes.AddRange(myTreeNodeArray);
}
}
but the DesignerSerializationVisibility create the next code, which produce casting error on run time:
MyCheckTreeNode myCheckTreeNode1 = ((MyCheckTreeNode)(new TreeNode("TreeNode")));
I need it to be :
MyCheckTreeNode myCheckTreeNode1 = new MyCheckTreeNode("TreeNode");
In the editor i use TreeView and PropertyGrid. the code in 'Add CheckBox Node' is:
treeView1.Nodes.Add(new MyCheckTreeNode("TreeNode"));
How can i fix it???
Please Help me. I need it fast.
Thanks,
Ran S'
|
|
|
|