|
Hi!!
Because i need to create about 50 panel with mouse event. how i can create an object array in C#?
I tried
Panel[] mPanel = new Panel[50] ;
it does not work. How can i compete it??
thx thx!!
|
|
|
|
|
That allocates the array. You then need to initialize the array:
for(int i = 0; i < mPanel.Length; i++)
{
mPanel[i] = new Panel();
}
That said, I seriously question why you need to create 50 panels; especially during each mouse event. What are you trying to do?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: How 'bout a little guitar now?
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Does anybody know if there's a particular property that controls the selectable area of a tab? I'm creating a new class that extends TabControl in order to override the paint method and draw custom tabs. However, the selectable area of the tabs do not reflect the actual painted rectangle. None of the TabSizeMode properties of the TabControl seem to work. The "Normal" option is supposed to take into account everything that's within the tab, but it doesn't. The selectable area turns out to be governed only by the length of the text within the tab. I was willing to comprimise and set the mode to "Fixed", but that didn't work either.
I'm considering trying to capture the Mouse Event triggered when entering the ClientRectangle of the TabPage and overriding the Click event, but I'm hoping there's a more elegant way to control the selectable area.
Any help is greatly appreciated.
Thanks!
Josiah
|
|
|
|
|
HI,
I got trouble of sending an email out from my application. An exception happened when from smtpclient.send object .
Any suggestion?
Thanks.
Kyah
|
|
|
|
|
Could you give us some information on the exception? what type? what was the error message?
Also, could you post some your code (the 10 o 15 lines where you send the email)? From what you say it's hard for us to know the problem.
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
I just followed the sample code in the MSDN library for Visual Studio in 2005.
The exception:
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: U
able to connect to the remote server ---> System.Net.Sockets.SocketException: An est
blished connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress s
cketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s
, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncRes
lt asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner,
Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32
imeout)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 tim
out, GeneralAsyncDelegate asyncCallback)
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asy
cCallback)
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDeleg
te asyncCallback, Int32 creationTimeout)
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
-----------------
I just want to send a test to my network mail server not local machine.
Thanks.
Kyah
|
|
|
|
|
I haven't seen the code, but I would guess you are trying to use localhost as your SMTP server when the service has not been enabled. Could you post the code?
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
I have run into this problem. In my case, our Virus software was preventing the mail from being sent. Our administrator had to allow mail coming from my machine for the vshost.exe process.
|
|
|
|
|
I'm having a problem with a graphics control I'm working on. It seems that the Graphics.DrawImage method is clipping a half pixel off of the image, and then shifting it up and left by that half pixel. This can usually only be seen when zoomed in 2-4x or more, but now that I know what to look for, I'm seeing it happen even close to 1x with certain images. The following image shows the extent of the issue when zoomed in significantly - the green lines you see are where the bounds of the bitmap should be: odd_image.jpg[^]
The graphics object that gets drawn to is from a bitmap that gets created on the fly depending on the size of the control and the objects in it. All graphics properties are set to the default except for the following:
g.InterpolationMode = InterpolationMode.NearestNeighbor
g.PageUnit = GraphicsUnit.Millimeter
and there is a translation applied (though removing it did not affect the problem).
I tried changing to the PageUnit to various values with no change, I also messed with PixelOffsetMode, CompositingMode, CompositingQuality and SmoothingMode, trying various values to no effect.
I've done several searches in here and MSDN and found nothing that fixed the problem, or even hints that there is one. Has anyone seen anything similar to this, or have any ideas to try?
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
Setting the PixelOffsetMode to "HighQuality" worked for me before, IIRC.
|
|
|
|
|
That did it alright. I swore I tried that yesterday - but I tried a million combinations before giving up and posting, that one must have slipped through, or maybe it didn't work with some other setting I had at the time.
Whatever, works now - Thanks!
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
Actually i am facing one problem while customising custome data gride. Actually i want to Create custome table style and add it to Datagrids Table style so user can set custome Column style by clicking Datagrids Property window(Table Style window) so i want to put my own Custom table style over there....So Experts Please help me out...........
Keep Smiling
|
|
|
|
|
I have written a component in C# with the following structure:
Data is loaded from database into a DataSet
"Record" class wraps each DataRow in the DataTable I have loaded. i.e. the properties on the object read/write the columns in the DataRow.
"Records" class inherits from CollectionBase and is a colleciton of "Record" objects.
The problem I have is how to sort the Records collection. I am currently doing this by sorting the underlying DataView which is held in the "Records" object. However, I then had to write some messy code to sort the Records collection class based on the order of the view. It works, it's not really slow, but I just feel there must be a much better way of approaching this.
Does anyone have any suggestions?
|
|
|
|
|
You can use ORDER BY ColumnName keyword in query.
Know Yourself Then Grow Yourself.
|
|
|
|
|
I am aware of the ORDER BY command in SQL. However, I need to sort the data after it has been retrieved by the client application and hence this will not help.
I was wondering if I need to use the CompareTo or Equals methods which are on the base object interface to do this?
|
|
|
|
|
Hi,
i would like to create a simple control for smart phone (cf2.0) that changes its background color depending upon whether it is focused or not. i have the following code.
class mylabel:Control{
protected override void OnGotFocus(EventArgs e){
base.OnGotFocus(e);
this.BackColor = Color.Red;}
protected override void OnLostFocus(EventArgs e){
base.OnLostFocus(e);
this.BackColor = Color.White;}
}
The problem is it can get focus (and changes its bg color) but it seems it does not loose focus. if i inherit LinkLabel instead of Control then it works fine.
What could be wrong? i would really appreciate.
regards,
rnv
|
|
|
|
|
Well, I've never programmed for CF, but the recommended way to determine when a control gets focus AFAIK are the Enter and Leave events.
However, why are you deriving from Control ? Unless you are creating a new control from scratch, if you want to add this functionality to existing controls (text boxes, buttons, and so on) I would rather subscribe to the events for the controls. You could write a little class that given the control reference in the constructor, it would subscribe and handle the events. Then you could apply it to any control with just one line of code.
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
Hello!
In C++ we could do m_listView.SetRedraw(TRUE) in order to block repainting of the list view control. Add some items to it and call m_listView.SetRedraw(FALSE) to allow drawing again. This was pretty fast.
Now my question: is there an equivalent to this in .NET? I've looked at the member list of ListView, but didn't find one that does that. Have I overlooked something?
Note: I do NOT want to use a virtual list view.
Thanks in advance and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Yes, you have ListView.BeginUpdate() and ListView.EndUpdate() .
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
Works perfectly! Many thanks!
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
You are welcome! I'm glad I could help!
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
I need to build TextBox control that will display baloon tooltip if entered value is invalid. The question is, how can I retrieve size of such tooltip to allocate it on right place? Thanks.
|
|
|
|
|
Hi,
I am working on Media File Steam Edition, and want to cut a file into many, and join two files. I am using DirecX9 SDK. I tried hard, but cant go on further with my own knowledge.
Can any knowledged person guide me for the same. I was working on .avi files, but now am thinking of .wmv files.
Any thing that can help me do the coding for joining and cutting media files will do.
Thanks,
Jc Shreyash Singh Parihar
|
|
|
|
|
I have metod
private void axWebBrowser1_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e){
}
Help me please.
|
|
|
|
|
What is it that you want help with?
---
b { font-weight: normal; }
|
|
|
|