|
Use a scrollable control like a panel forexample.
set AutoScroll property of the panel to true. Add a picturebox control onto your panel and set SizeMode to AutoSize. Do NOT set Dock property of picturebox to any value. Set location of your picturebox to 0,0 which places it to the topleft corner of the parent panel. That's all.
|
|
|
|
|
I was browsing the internet the other day and I ended up at a website that had a keylogger as one of its products. Anyhoo it said that it could make the program virtually invisible to users.
My question is: How would I make a program disappear from the process list under task manager?
|
|
|
|
|
I do not believe that this is possible, unless the program is a dll and is injected into a currently running program or the dll is injected into the OS. Through programming you would be able to write a program to see what processes use what dlls, but the task manager does not have this capability and would inadvertenly hide the injected program from view. Hence the reason why the program is so called "'virtually' invisible to users"
Regards,
1tg46
Check out 3D Game Development with Dark Basic Professional [^]programming.
|
|
|
|
|
How to import a value from listBox to textBox
vasildb@yahoo.com
Vasildb
|
|
|
|
|
Are you trying to take a selected item from a listbox and populate it into a textbox?
|
|
|
|
|
If that is the case then something like this is probably what you're looking for:
textBox1.Text = listBox1.Items[listBox1.SelectedIndex].ToString();
Where textBox1 and listBox1 can be substituted for the names of the respective controls in your program.
Hope this helps,
PJC
|
|
|
|
|
I recently developed my first full custom control. It is a is a simple tab control that mimics VS.NET 2005 look and functions. What I am trying to accomplish next is adding design time support. I have read tutorials and articles on this, but I am try to figure out how to add certain events to the control once it is added to a form. For eaxmple I want the developer to be able to switch tabs in design time. What has to be done in order to accomplish this? Thanks in advance.
CBN
|
|
|
|
|
You would have to implement a Control Designer. ParentControlDesigner if I am correct.
Here are basic steps:
1) Create an inherited class of a ParentControlDesigner, or the designer that is best suited for you. For the purpose of instruction the inherited Designer is called TabDesigner.
2) For the control (Tab Control in this case) you will add the Desinger attribute to the control class with reference to TabDesigner
3) In TabDesigner you will override the WndProc function so that you can get a handle on all events to the TabControl. You will add any code you will like to change tabs and handle click events by processing WM_MOUSEMOVE and WM_RBUTTONCLICK (may not be exact constant names, check with API-Viewer (google it))
4) To add any VS menu items to your control during designer-time you will override the Verb collection property. In the initialization of the TabDesigner you will create a new Verb Collection and return the new verb collection in the Verb property
4) Test your control with the new designer during Design-Time
I would go into more detail with this information and include information on VS smart tags, but that would take longer. If you have any questions just ask.
Regards,
1tg46
P.S. This sounds like a good article that I could write, so check within the next month at this site and I may have posted an article on this subject.
Check out 3D Game Development with Dark Basic Professional [^]programming.
|
|
|
|
|
Thanks for all your information ... I am playing with this I have not found any good example code ... I will be excitinly waiting for your article!
|
|
|
|
|
Now the only problem that I see in writing this type of article is: What type of control would be both useful and simple to create that could use these design time features? I would want a control that wasn't so significant that it would take away from the overall article about the design time features. Any Suggestions?
Regards,
1tg46
Check out 3D Game Development with Dark Basic Professional [^]programming.
|
|
|
|
|
|
Hello, I want to slide a panel like f.e. toolbox in Visual Studio.
It works fine...as long as there are no further controls on it,
then it gets interrupted quite often (I guess because it repaints the controls on it every time) while applying the slide effect which looks ugly...
I tried several things, but nothing worked...any ideas or
suggestions? thanks.
-- modified at 13:48 Saturday 4th March, 2006
|
|
|
|
|
Create a custom panel from inherited from Panel class. In constructor after InitializeComponent() function, write:
this.SetStyle(ControlStyles.DoubleBuffer,true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint,true);
this.SetStyle(ControlStyles.UserPaint,true);
and then do all the painting by overriding onpaint event of your custom control. That's all.
Bluehunter
|
|
|
|
|
thank you for this advice..but this doesn't help because I move the panel by changing its location to achieve the slider effect...so DoubleBuffered doesn't help..(I also tried it already with no effect).
|
|
|
|
|
Have you tried handling the WM_PAINT event in the WndProc? If you try using the WndProc you will be able to choose when the control should paint and stop the event from raising when the control should not be painted.
Regards,
1tg46
Check out 3D Game Development with Dark Basic Professional [^]programming.
|
|
|
|
|
Hi, I don't know how it did not worked because I'm also a visual component developer and have developed custom panels also which you can move by mouse, expand and collapse vertically and horizontally (with or without animation) and everything works fine. Override WndProc event of your panel where you can find an example in MSDN library under WndProc. Handle the WM_PAINT event in a switch statement which is a value of 0x000F. To prevent repaint of your panel on every pixel move, checkout the location change and make it repaint itself forexample if the change is 2 or 3 pixels...
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
protected override void WndProc(ref Message m)
{
// Listen for operating system messages.
switch (m.Msg)
{
// The WM_PAINT message occurs when the application
// becomes the active application or becomes inactive.
case 0x000F: // WM_PAINT
// What you should check...
// if new location of your panel is NOT different enough
// to repaint:
// Msg.Result = IntPtr.Zero; // prevents the repaint of your panel
// else:
// do nothing
break;
}
base.WndProc(ref m);
}
But my first reply should have helped you, if this does not help either, send me your code. I can have a look at it and may see if you do something wrong by mistake.
|
|
|
|
|
Please clear the comments of WM_PAINT message decleration. I have forgotten to change them because I copied the code from MSDN Library example and modified explicitly. WM_PAINT occures nearly %90 of all times, "not only" when the application becomes active or inactive. Hope everything works fine.
|
|
|
|
|
Thank you for your help.....
it's better now...but with controls on it (like some standard buttons) when the panel grows (I mean when it sliders to the right) it still has some problems...
here is the code:
public partial class LeftSidedSliderPanel : Panel //, IMessageFilter
{
public static List<LeftSidedSliderPanel> allPanels = new List<LeftSidedSliderPanel>();
private int headerWidth = 30;
private bool animating = false;
private Timer slideEffectTimer;
public int HeaderWidth
{
get { return headerWidth; }
set { headerWidth = value; }
}
public LeftSidedSliderPanel()
{
InitializeComponent();
allPanels.Add(this);
this.Disposed += delegate { allPanels.Remove(this); };
this.DoubleBuffered = true;
// Application.AddMessageFilter(this);
}
public void Stop()
{
if (this.slideEffectTimer != null)
{
this.slideEffectTimer.Stop();
}
if (hoverTimer != null)
{
hoverTimer.Stop();
}
//preparing for more speed
for (int i = 0; i < this.Controls.Count; i++)
{
this.Controls[i].ResumeLayout();
}
animating = false;
}
private void StartSliding(int targetValue)
{
if (animating)
{
return;
}
this.animating = true;
this.SuspendLayout();
//preparing for more speed
for (int i = 0; i < this.Controls.Count; i++)
{
this.Controls[i].SuspendLayout();
}
this.slideEffectTimer = new Timer();
this.slideEffectTimer.Interval = 10;
int difference = 40;// 40;
if (this.Location.X > targetValue + difference) //get smaller
{
difference = 20;
}
int tempDifference = difference;
this.slideEffectTimer.Tick += delegate
{
if (difference <= 0)
{
difference = tempDifference;
}
if (this.Location.X > targetValue + difference) //get smaller
{
User32.MoveWindow(this.Handle, this.Location.X - difference, this.Location.Y, this.Width, this.Height, true);
difference++;
}
else
{
if (this.Location.X < targetValue - difference) //grow
{
User32.MoveWindow(this.Handle, this.Location.X + difference, this.Location.Y, this.Width, this.Height, true);
difference++; //--;
}
else // finnish effect
{
this.Location = new Point(targetValue, this.Location.Y);
this.Stop();
this.ResumeLayout();
this.Invalidate();
this.Refresh();
}
}
};
this.slideEffectTimer.Start();
}
public void Grow(bool withAnimation)
{
this.Stop();
for (int i = 0; i < allPanels.Count; i++)
{
if ((allPanels[i] != null) && (allPanels[i] != this))
{
allPanels[i].Stop();
allPanels[i].Collapse(false);
}
}
if (withAnimation)
{
this.StartSliding(0);
}
else
{
this.Location = new Point(0, this.Location.Y);
}
}
public void Collapse(bool withAnimation)
{
this.Stop();
if (withAnimation)
{
this.StartSliding(this.headerWidth - this.Width);
}
else
{
this.Location = new Point(this.headerWidth - this.Width, this.Location.Y);
}
}
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
if (this.Location.X == 0)
{
this.Stop();
return;
}
this.Grow(true);
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
if (animating)
{
return;
}
hoverTimer = new Timer();
hoverTimer.Interval = 1000;
hoverTimer.Tick += delegate { this.Collapse(true); hoverTimer.Stop(); };
hoverTimer.Start();
}
protected override void OnLayout(LayoutEventArgs levent)
{
base.OnLayout(levent);
if (!this.DesignMode)
{
this.Collapse(false);
}
}
protected override void OnPaint(PaintEventArgs e)
{
//base.OnPaint(e);
}
private Timer hoverTimer;
int painting = 0; //for animation
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
protected override void WndProc(ref Message m)
{
// Listen for operating system messages.
switch (m.Msg)
{
case 0x000F: // WM_PAINT
if (animating)
{
if (painting % 3 == 0)
{
m.Result = IntPtr.Zero;
}
painting++;
}
break;
}
base.WndProc(ref m);
}
}
|
|
|
|
|
I created service and client application. I had no problems with Server-activated Objects but in my case SAO is not what I need, becouse object must keep state for each client individually.
But when I use CAO I get error: object does not have constructor.
I tried to share only Interface betwean server and client and then full object definition, but I still get the same exception.
Piece of server code:
<br />
namespace ServerService<br />
{<br />
public partial class Service1 : ServiceBase<br />
{<br />
<br />
public Service1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
protected override void OnStart(string[] args)<br />
{<br />
<br />
ChannelServices.RegisterChannel(new HttpChannel(9999));<br />
RemotingConfiguration.ApplicationName = "tester";<br />
RemotingConfiguration.RegisterActivatedServiceType(typeof(MyRemoteClass));<br />
<br />
}<br />
<br />
protected override void OnStop()<br />
{<br />
}<br />
}<br />
<br />
public class MyRemoteClass : MarshalByRefObject, MyInterface<br />
{<br />
public bool wywolany = false;<br />
<br />
public int FunctionOne(string str)<br />
{<br />
if (wywolany) return str.Length + 1;<br />
else<br />
{<br />
wywolany = true;<br />
return str.Length;<br />
}<br />
}<br />
}<br />
}<br />
Client code:
<br />
namespace Client<br />
{<br />
class Program<br />
{<br />
public static MyInterface m_RemoteObject = null;<br />
public static ObjectHandle oh = null;<br />
<br />
static void Main(string[] args)<br />
{<br />
object[] url = { new UrlAttribute("http://localhost:9999/tester") };<br />
<br />
<br />
try<br />
{<br />
<br />
m_RemoteObject = (MyInterface)Activator.CreateInstance(typeof(MyInterface), url, null);<br />
<br />
}<br />
catch(Exception e)<br />
{<br />
Console.WriteLine("Error konstruowania");<br />
Console.WriteLine(e.Message);<br />
Console.ReadLine();<br />
return;<br />
}<br />
<br />
if(m_RemoteObject==null)<br />
{<br />
Console.WriteLine("Error wykonania");<br />
}<br />
else{<br />
try<br />
{<br />
Console.WriteLine(m_RemoteObject.FunctionOne("Nish"));<br />
Console.WriteLine(m_RemoteObject.FunctionOne("Nish"));<br />
}<br />
catch<br />
{<br />
Console.WriteLine("Error");<br />
Console.ReadLine();<br />
return;<br />
}<br />
}<br />
Console.ReadLine();<br />
}<br />
}<br />
}<br />
I have read many tutorials about CAO but I still have problems with it...
Please help
source code of the project (if it's necessary) can be downloaded from http://www.mdz.jawnet.pl/CAO.zip
Secound question:
In one article there was a method to get CAO using singlecall SAO - singlecalll method return reference to the object we want to host - is it a good idea?
|
|
|
|
|
i load datatable into a grid, the grid is added, edited. Now i put into the grid a new row with the same key as another row. I have used Rowchanged and Columnchanged Events. But after it messaged the error as i gave, it message a error message from System.
I want to turn of it. How can i do that? Please help me!
superdragon
|
|
|
|
|
You could try adding an event handler for Application.ThreadException (could be wrong on event name). This would catch all events for the current thead that are not already handled and allow the program to continue as normally.
Regards,
1tg46
Check out 3D Game Development with Dark Basic Professional [^]programming.
|
|
|
|
|
Hi all ,
In my project i have to pass parameters to a fuctionthat is present in Delphi created dll.
I am able to invoke the functiion with no parameters.
I am getting the message that was placed in the function that was present in a delphi created Dll.
Please any one help me.
Thanking you all
Varma g
Varmag
|
|
|
|
|
I could not understand what your request was but if you can give your code and the format of the function which is embedded in a dll created with delphi, I can help you better. Otherwise I offer you to checkout Marshal class under System.Runtime.InteropServices. This class should help you well. Hope it helps.
|
|
|
|
|
I`ve made a program which is using DirectX9.0 classes DirectX.Audio.Video.Output, DirectX.DirectSound! Every time i start the program on the user machine i get the errors like (every time is a different error):
Process id=0x748 (1864), Thread id=0x231...
Proces id=0x118 (280), Thread id=...
I have checked for the dependencies in my solution, and the only files which have been found by VS are DirectX classes and dotNETFXRedist_x86_enu.msm which cannot be redistributet!
DirectX90c is working fine on the user machine, and all classes can be found in Assembly Cache ot he user machine!
How can i fix this error!? I used the error handling in the program which is generating the log file whenever the program brakes, but in this case the log file is missing, which makes me think that the program breaks on the ".NET framework" layer (if i could say like that), and it doesn`t start at all! Could be that some .NET file is missing on the user machine because of different .NET versions on the Developer and User machine?? Any idea please!
Thanks a lot!
|
|
|
|
|
You only show the part of the error message that tells in what process it occured. What is the error message?
---
b { font-weight: normal; }
|
|
|
|