|
I don't know if this can be done but I am sure that someone else will provide help if it can.
What I would say is that if you look at similar properties in the inbuilt controls e.g. AutoSize for labels, textboxes etc. they do not disable other properties when set. The program logic just ignores changes to the irrelevant properties if they (AutoSize) are set to true.
So in the setter for ColumnWidth only apply setting if AutoWidth is false.
something like:
public int ColumnWidth
{
get
{
return this.columnWidth;
}
set
{
if (!this.autoSize)
{
if (this.columnWidth != value)
{
this.columnWidth = value;
this.Invalidate();
}
}
}
}
Hope this helps.
Honi soit qui mal y pongs - Evil to he who thinks it stinks
|
|
|
|
|
A good point well made.
Much appreciated.
As an aside, I notice that items like 'DataSource' in component properties are intially set to '(none)'. As yet, I have not figured out how to do this for my own (custom) properties. If anyone knows this I would be grateful for an educational 'nudge'.
|
|
|
|
|
Google, or otherwise search) for info on the AttributeProvider attribute.
Come back if still no joy.
Honi soit qui mal y pongs - Evil to he who thinks it stinks
|
|
|
|
|
|
i have developed a apps and in that apps a timer is there and i am showing ShowBalloonTip repeatedly from a timer method but the problem is ShowBalloonTip not showing. my timer elapsed time is 30 seconds.
from my timer tick method i have written code like
objNotifyer.Text = "MyMessage";
objNotifyer.ShowBalloonTip(1, "Info", "MyMessage", ToolTipIcon.Info);
i just can not understand why balloon is not showing. so please guide me regarding this and if possible then tell me how to write the code which will repeatedly show the balloon message from my timer tick method. please help.
tbhattacharjee
|
|
|
|
|
Try adding objNotifyer.Visible = true before ShowBalloonTip.
|
|
|
|
|
Hello All!
I have created a control that inherits from a Panel. My control has a method, UpdateControls() that repositions all of its child controls to where they need to be after they’ve been resized.
Sometimes the resizing causes the Vertical and Horizontal scroll bars to appear. I want the Vertical, but not the Horizontal, so at the end of the UpdateControls() method my control checks to see if the Vertical scroll is visible, and if it is, it increases its width so the Horizontal scroll bar isn’t needed.
protected void UpdateControls()
{
this.SuspendLayout();
int LastTop = this.AutoScrollPosition.Y;
foreach (Control ic in _controls)
{
ic.Top = LastTop;
LastTop = ic.Bottom + 5;
}
this.ResumeLayout(true);
if (this.Width != this.NeededWidth)
{
this.Width = NeededWidth;
}
}
public int NeededWidth
{
get
{
if (this.VScroll)
return _MaxWidth + 17;
else
return _MaxWidth;
}
}
However, the form that contains my control isn’t updated properly. It seems to lag behind by one UpdateControls() call. It seems as though the resize of my control isn’t taking place until after all of the painting is done.
I’ve tried calling this.parent.Invalidate(true) and this.parent.Refresh() at the end of my UpdateControls() method, but neither force the new size to be used.
I found that by listening to the MyControl.SizeChanged event in MyForm and re-assigning the new width (after it had already been updated, thus triggering the SizeChanged event) will force the new size to be used, but MyControl gets drawn twice and it is noticeable on my form.
_ItemsContainer = new MyControl();
_ItemsContainer.SizeChanged += new EventHandler(_ItemsContainer_SizeChanged);
...
void _ItemsContainer_SizeChanged(object sender, EventArgs e)
{
_ItemsContainer.Width = _ItemsContainer.NeededWidth;
}
How can I force the new size to be used so the Horizontal Scroll bars aren’t being drawn in my control?
Thank you!
|
|
|
|
|
Edit:
I had this problem when dealing with panels, what I did was keep all the panals inside my control visible = false, add the controls to each sub panel inside my panel and then reset the main panels height and width, then toggled all controls inside to visible=true as needed (it was a menu based off a data table, might not be exactly what you are looking for) then call the forms Update method after adding controls to my panels
|
|
|
|
|
After further auditing of my old code (your post had me refactor it a bit) I see that I set the visibility of the panel to false, added all the controls, resized it then set visibility to true, that was there is no visible horizontal / vertical bars appearing to the user as its visibility was off.
Let me know if I'm off base with this over here.
|
|
|
|
|
Why don't you just set the child control anchor properties correctly and be done with it?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Setting the anchor to Left | Right worked.
Thanks everybody!
|
|
|
|
|
Hi all,
i need to send a data message to a device every data message must have its header.
byte[] messageheader;
messageheader= new byte[10];
messageheader[0] = 0x16;
messageheader[1] = 0x01;
messageheader= BitConverter.GetBytes(01);
messagehd[3] = 02;
messageheader[4] = 00;
messageheader[5] = (byte)(message.Length);
serialPort1.Write(messageheader, 0, messageheader.Length);
now the BitConverter delete every thing, i think this is very simple, but I'm struggling with it
thanks in advance.
modified on Wednesday, January 7, 2009 3:31 AM
|
|
|
|
|
A4ad wrote: messageheader= BitConverter.GetBytes(01); // this must be divided into two bytes within the array
Since BitConverter.GetBytes() returns an array, your messageheader gets reassigned, thus losing the reference created 3 lines above. What you need to do is:
byte[] messageheader = new byte[10];
messageheader[0] = 0x16;
messageheader[1] = 0x01;
Array.Copy(BitConverter.GetBytes(01), 0, messageheader, 2, 2);
messagehd[4] = 02;
messageheader[5] = 00;
messageheader[6] = (byte)(message.Length);
serialPort1.Write(messagehd, 0, messagehd.Length);
|
|
|
|
|
thank u for your answer, it helps me a lot...
but is it an issue if id do the array copy, for the whole array. i don't think it will effect the performances of my application, but it looks to me that is not the write way to do this for the array.
|
|
|
|
|
The performance difference between copying 2 bytes and 4 bytes is insignificant, but you should take the habit of not doing more than necessary.
|
|
|
|
|
Please for good people - only - how to change computer name by c# , i found many codes but all is not working well.
thanks & regards
|
|
|
|
|
|
Hi,
SetComputerNameEx[^] should do it, however you must restart the system to make it work!
|
|
|
|
|
Dear All,
I have created a setup project using vs 2005 and i want to install another .exe file after finishing my c# application setup.I am getting the .exe file as embeded resource to my project.
now using Installer when i use to run the .exe file after installation, it gives me an error file not found. I know the Error is that it can not locate or find the .exe file which i am installing after c# application.
I am asking how to get the installation path (folder which i am installing the application)?
I use Application.startup, but it did not help.
Remember that the .exe file which i am installing is inside that installation folder.
Abdul Rahaman Hamidy
Senior Student Student in Computer Science
Kabul, Afghanistan
Software Developer
|
|
|
|
|
Abdul Rahman Hamidy wrote: I am getting the .exe file as embeded resource to my project.
Which project?? Is it the C# app, or it's installer project??
If you've got a seperate .EXE, unpack it and make it a part of your app's installer project. There's no need to keep it as a resource in your app.
|
|
|
|
|
well i added the .exe file into my setup project (the one which i created through setup and deployment)
the .exe is now added to computer Application Folder like (c:\programe files\company Name\Application) through installing setup project.
How can i get this path from installer class to execute this .exe when c# application setup finished?
Abdul Rahaman Hamidy
Senior Student Student in Computer Science
Kabul, Afghanistan
Software Developer
|
|
|
|
|
Well, that changes the question entirely. AFAIK, there's no support for this in the Visual Studio installer project. The reason being, the last time I tried this (a LONG time ago), the installer waited for the application to close on first launch. This caused some rather serious "issues" because of the nature of the environment.
AFAIK, you'd have to modify the installation using an external utility, like Orca or InnoSetup, to make this kind of change. See this[^] post.
|
|
|
|
|
Hi,
I am facing with a performance issue in one of my windowsapplication.
I need to create a dialog window for excluding subfolders and files in a particular folder (passed as input).
The Exclude dialog must allow the user to select folders and files which he wants to exclude from counting.
Currently I am using a tree view and list view (both with checkboxes) for this purpose.
<br />
Implementation:<br />
1. I bind the tree view with all subfolders on the load time.<br />
2. The list view shows the files and folders of each selected node in the tree.<br />
3. When a node or list item checked or unchecked, all its sub-items has to get checked or unchecked.<br />
<br />
Issue faced:<br />
1. In case of a large folder (with large no. of Subfolders and files), it takes long time for loading the tree (to bind all these sub-folders and files to tree)<br />
2. If I go for an implementation of binding only two levels to the tree node each time (on load and on node click), issue occurs when I uncheck a node or list item. Only the sub items up to 2 level gets unchecked.<br />
3. Check- Uncheck for large subfolders too takes long time.<br />
<br />
Can anyone help me out with a solution for this? Even a design change or change in the current implementation can be suggested.
Thanks in Advance
Praji
|
|
|
|
|
KP_Prajilal wrote: In case of a large folder (with large no. of Subfolders and files), it takes long time for loading the tree (to bind all these sub-folders and files to tree)
You could fill the node when it's opened. Just fill the root and perhaps some child levels in the beginning
KP_Prajilal wrote: If I go for an implementation of binding only two levels to the tree node each time (on load and on node click), issue occurs when I uncheck a node or list item. Only the sub items up to 2 level gets unchecked
You can either fill the child nodes for the selected node upon selecting but you can also change the logic so that if the child nodes aren't filled, the outer node selection automatically implies to all subfolders even if they are not in the tree. So when working on user's choices (what ever you do with them) you don't expect to find every folder in the tree.
|
|
|
|
|
I want to bind all the sub folders and file of a root folder when selecting it.
Could u please give me a sample code?
|
|
|
|