|
I suspect you're getting an off by one error, because if the top left corner is 0,0, say, and your rectangle is 20 pixels high, then your bottom corner will be 0, 20. However, a 20 pixel high rectangle would end at 0, 19. Try Height - 1.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks Christian, I tried something similar and the problem gets fixed for one height and not for all heights. What I did was place a couple of controls on my form, one to adjust the drawing height and another to adjust the height of my LinearGradientBrush. Usually setting the height of the LinearGradientBrush smaller shows the error mentioned; however, setting it larger by one pixel fixes the problem for some heights but not for all so the fix is not consistent.
I gave up on this problem and placed a border around my drawing to hide the incorrect row of pixels.
Thanks,
Rudy.
|
|
|
|
|
I figured out how to get it working, although it's not logical. The solution is to set the starting position of the LinearGradientBrush 1 pixel before the rectangle to be drawn.
Originally in my code I had:
<br />
Rectangle rc = new Rectangle(10,10,80,15 + this.mHeightOffset);<br />
Point p1 = new Point(rc.X, rc.Y);<br />
Point p2 = new Point(rc.X, rc.Y + rc.Height);
so I changed Point p1 = new Point(rc.X, rc.Y)
to: Point p1 = new Point(rc.X, rc.Y - 1)
Everything else stayed the same and I removed variable mHeightOffset
|
|
|
|
|
Hi i urgently need help in designing a tab control, i want the tab pages to list vertically on the side. I need urgent help...
N.M
|
|
|
|
|
You can set the TabControl property Alignment to left. However, there is a bug in this mode if you are using XP Visual Styles because in this mode the text won't show and all you can do is create a new tab, override the OnDrawItem of the tab and draw the text yourself.
|
|
|
|
|
Hi,
I'm working on a Office plugin which is supposed to work in Outlook (as well as other Office programs). I need to listen to certain events from Outlook, particularly the ItemAdd event on a folder I create, and the NewInspector event as well. The only problem is that my event handlers stop working at some point in time, sometimes it seems to happen when I cut a mail item from the folder, but sometimes for no particular reason at all. Has anyone experienced anything similar? I'm writing my plugin in C# by the way (hence I'm posting in this forum ).
Best regards,
Daníel
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
How do you subscribe to the events? Like this?
outlookObject.SomeEvent += new SomeEventHandler(MyEvent);
Maybe SomeEventHandler gets GC'ed (outlookObject is a COM object and maybe the interop layer decides it's not got nothing to do with SomeEventHandler instance) ?
Did you try instantiating SomeEventHandler as a class level member variable? Something like
class MyClass
{
private SomeEventHandler eventHandler;
public MyClass()
{
eventHandler = new SomeEventHandler(MyEvent);
outlookObject.SomeEvent += eventHandler;
}
}
I'm only guessing though, based on the fact that you said it works fine initially and then stops working after some time.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Excellent idea. I tried but unfortunately it does not seem to matter
However, it could be that it's not *my* event handler object that is being GC-ed, but some C# wrapper objects for the Outlook object model. And I have absolutely no idea how to test that theory or how to fix it if that is the case...???
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
hi there.
i have one problem i made server / client application . in that application the client connect the ip address of the server and logging the user in but that works only in both local host or in computers connected in network like in cyber cafe and others but when i used it on the internet my friend who is connected with me in yahoo messenger he asked me to have the client side tool i gave it to him and i ran my server with the ip address i obtained from my connection and i gave him my ip address and then he tried to login but the client tool tells him "can't connect to the server" . that means the bytes receieved from the server response is zero or there is no server at all . what is the problem in here why my server and client worked on the network and didn't work on the internet ? or the server must be running on server operating system like windows server 2003 or something any help with that ?
Miss With The Best And Die Like The Rest
|
|
|
|
|
Most probably, your client is behind a proxy/firewall.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
so how do yahoo messenger client works with any connected pc over the internet
Miss With The Best And Die Like The Rest
|
|
|
|
|
Either the proxy/firewall is configured to forward/allow that traffic or they use HTTP tunneling wherein they send and recieve information through HTTP (which is normally allowed by firewalls) instead of their custom protocols.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
I create a UserControl with some controls like Button, checkbox, picture, ...
I looking for RESIZING the UserControl.
I would like to keep the ASPECT RATIO of the UserControl.
How can I do it ?
Best Regards
youssef
|
|
|
|
|
|
Ok for the control.
What about the backgroung image ?
How can I resize it ?
Best Regards
youssef
|
|
|
|
|
Hi,
I have implemented the drag and drop functionality in my custom control...but i want to give the same visual appearance as Windows has given...like after picking a file or a control...a bitmap of itself is drawn with some transparency.... i wanted to know how to get the transparent image of the control selected at runtime???
can anybody help me?
Thanks and Regards,
Rajesh
|
|
|
|
|
How to change the background color in Window Form application?
thanks.
|
|
|
|
|
this.BackColor = Color.(Whatever).
|
|
|
|
|
Hi,
i need the program for list of Network and Dial up connection.
I tried to find out from registry when i connect thr dial up via modem , i did not get dial up name in registry how ever i am able to find the netwrok (Local area Network ) in registry.
Pls tell me how can i retrive the both Network and Dial up connection in Text box which is in Win Form
Wiating for the prompt reply
regards
sanjeev
|
|
|
|
|
Hi Man,
the only thing i kwow is through win API:
[DllImport("wininet.dll")]
private extern static bool
InternetGetConnectedState( out int Description,int ReservedValue ) ;
also go to this link http://msdn.microsoft.com/library/?url=/library/en-us/wininet/wininet/internetgetconnectedstate.asp
for more info on the API function.
Hope that helps
GanDad
|
|
|
|
|
i am trying to run a process through that code
Process.Start("myApllication.exe");
but the command prompet window opens while starting of the process
i want to delete this effect
how ?
thx all
|
|
|
|
|
Maby this will do:
Make an instance of process and change the standard input,output,error streams.
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
You need to use the ProcessStartInfo object. It has a CreateNoWindow property to prevent the console window from appearing. Your code will look like
ProcessStartInfo processStartInfo = new ProcessStartInfo("myApplication.exe")'
processStartInfo.CreateNoWindows = true;
Process.Start(processStartInfo);
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I need to create a toolbar like photoshop's one.
I did it, but if i select the main form it goes in second level so became unfocused.
How can i show both selected if i enable the main form or the toolbar and make them in second level if i enable another application?
Hope to have explain good.
Thanks in advance.
|
|
|
|
|
You can focus only on one form and/or one control.
|
|
|
|