|
paulsawyer wrote:
Does this include receiving an OnPaint event while your code is in the middle of processing some other event?
YES! But since WM_PAINT is a queued message it won't fire until your windows message pump gets around to calling GetMessage, which won't happen in the middle of an event handler, unless you call Application.DoEvents(), or idle the UI thread somehow.
You should see how many mouse events get fired off just by moving the mouse acrossed your form! The events are not "events" so to speak, but code your write that get executed when certain messages are posted to your window's message QUEUE (hint, hint). There are two types of messages, queued and non-queued. WM_PAINT is a queued message.
I highly recommend reading About Messages and Message Queues[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks very much for the help. I think that I see what is going on. What you and Microsoft say about OnPaint and Event Processing is only half correct. It is true that once I am processing an event, I will not be interrupted with an OnPaint that comes from my application's event queue. However, if I open a dialog box, there is code within the system.windows.forms.dll that will call the OnPaint procedures for any or all of the other controls in my forms while that dialog box is open. What is interesting is that, if my application is busy processing an event, that will prevent it from receiving OnPaint calls that result from actions generated by other applications or Windows. IE if the app is busy, the apps controls will not receive the OnPaint calls that are in its message queue until the application becomes idle. However, it seems to be a completely different story if my app opens a dialog box. Then all of its controls will receive OnPaint calls as is needed to update the controls while the dialog box is open. These OnPaint calls show up in the same Call Stack as my original event and nested "underneath" the original event.
Now that I have sorted that out, I am wondering if there are other calls or class methods like System.Windows.Forms.Form.ShowDialog() that could also cause
OnPaint messages to show up when there are not wanted.
Paul Sawyer
|
|
|
|
|
Hi!!!
I want draw text in .NET Framework control(f.e. System.Windows.Forms.Button),
that text could be located near control border (text of control is located in control
without margine).How can I do it ?
Thanks.
|
|
|
|
|
You can simply do this by setting the TextAligment property from the properties menu ,
I think you will admire it .
|
|
|
|
|
Thanks LongHC , I know that it is simply to do it by setting the TextAligment to MiddleLeft , but in this case margine remains , but I want that distance between text and control border will equal 0.
|
|
|
|
|
So use onpaint method and override it and then use it's graphics object to draw the text :
e.Graphics.DrawString(and specify here the font and the string and the location);
|
|
|
|
|
I'm downloading VS 2005 Beta 2 as we speak. It must have JUST been placed on MSDN Universal downloads.
|
|
|
|
|
Hi !!!
I have Visual C# project for creating an application for Pocket PC (Smart Device Application), this application uses function call from some unmanaged dll .
For example:
using System.Runtime.InteropServices;
[DllImport("TestDll.dll")]
public extern static void f();
private void button1_Click(object sender, System.EventArgs e)
{
f();
}
Mentioned application deployed to Pocket PC Emulator, and unmanaged dll copied to application folder.But when I run application and try to call function from dll MethodMissingException exception occurs.
Please, help me.Thanks.
|
|
|
|
|
If you wrote the function f in C++, and you didn't use extern "C" , its name will have been 'mangled' to encode the type information and calling convention.
You can view what the name actually is by using dumpbin /exports . The dumpbin tool is installed by eVC 4.0 - you'll find a copy in C:\Program Files\Microsoft eMbedded C++ 4.0\EVC\wce420\bin (for example).
You can either use the mangled name as-is by adding the EntryPoint property to the DllImport attribute, or you can add extern "C" to the declaration and rebuild your DLL.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Installed fonts in .NET Compact Framework
Hi all !!!!!
I need system installed fonts in .NET Compact Framework. For .NET Framework it is easy,
f.e.
System.Drawing.Text.InstalledFontCollection installedFontCollection = new System.Drawing.Text.InstalledFontCollection();
System.Drawing.FontFamily[] fontFamilies = installedFontCollection.Families;
but InstalledFontCollection class not supported in .NET Compact Framework .
Please anybody help me?
Thanks.
|
|
|
|
|
The underlying API is EnumFontFamiliesEx , but I'm not sure this will work for you. You see, it uses a callback function, which itself takes a couple of structures that require advanced layout. Compact Framework 1.0 does not support calling back from native to managed code.
So I think you'd have to write a C++ DLL that wraps EnumFontFamiliesEx with an interface usable from .NET and then call that.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
in Layout Design,
Is there anyone know the trick, how to put some field(s) into the Page Header Section ?
coz, in every page i wanna show those field(s) shown.
Thank You.
email : sukasukabo@hotmail.com
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_layout_v1_9uia.asp
|
|
|
|
|
Dear friends,
I've an application written in .NET, and ofcourse, in order to run it, we need to install entire .NET framework in the target machine.
Few days ago i came to know about the tool which extracts the minimum dependencies of the .NET application, and as such, we only need to install those DLLs and not the entire framework. The tool was discussed here but i've forgotten about it.
Can anyone tell me about that tool ??
|
|
|
|
|
Try googling for "Tool to prevent a customer from installing the .NET Framework".
Because that is what might happen if you only install minimum dependencies.
At least AFAIR. so, be careful with this.
Cheers
Sid
|
|
|
|
|
|
|
...the hard way that you should never use a reference as a key to a value within a hashtable! Someone please tell me what an idiot I am for having done so in the first place!
|
|
|
|
|
you're such an idiot! ;);)
|
|
|
|
|
Can I use the "file explorer control" in .net compact framework?
just like notes, pocket word to select files.
I searched on google but nothing can be found.
If you don't understand what I mean, here is a screenshot
http://www.jacco2.dds.nl/networking/screenshots/pocketpc/01explor.png
thanks for your help!
|
|
|
|
|
<br />
<br />
<% @Import Namespace="System.Data" %><br />
<script language="vb" runat="server"><br />
Dim searchword as String<br />
Dim pls as New DataTable()<br />
<br />
Sub Page_Load(sender as Object, e as EventArgs)<br />
BuildDataStore()<br />
<br />
completeData.DataSource = pls<br />
completeData.DataBind()<br />
End Sub<br />
<br />
<br />
Sub BuildDataStore()<br />
Dim dr as DataRow<br />
<br />
pls.Columns.Add(new DataColumn("Results", GetType(String)))<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "If only God would give me some clear sign! Like making a large deposit in my name at a Swiss bank."<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "Is sex dirty? Only when it's being done right."<br />
<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "On the plus side, death is one of the few things that can be done just as easily as lying down."<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "I took a speed reading course and read 'War and Peace' in twenty minutes. It involves Russia."<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "To *you* I'm an atheist; to God, I'm the Loyal Opposition."<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "Sex without love is an empty experience, but as empty experiences go, it's a pretty good empty experience."<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "It's not that I'm afraid to die. I just don't want to be there when it happens."<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "What if everything is an illusion and nothing exists? In that case, I definitely overpaid for my carpet."<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "Interestingly, according to modern astronomers, space is finite. This is a very comforting thought-- particularly for people who can never remember where they have left things."<br />
pls.Rows.Add(dr)<br />
<br />
dr = pls.NewRow()<br />
dr(0) = "Eighty percent of success is showing up."<br />
pls.Rows.Add(dr)<br />
End Sub<br />
<br />
<br />
Sub BindData(strQuery as String)<br />
searchword = strQuery<br />
<br />
Dim dv as DataView<br />
dv = New DataView(pls)<br />
dv.RowFilter = "Results LIKE '%" & Regex.Replace(searchword,"'","''") & "%'"<br />
<br />
SearchResults.DataSource = dv<br />
SearchResults.DataBind()<br />
End Sub<br />
<br />
<br />
Function Highlight(Search_Str as String, _<br />
InputTxt as String, _<br />
StartTag as String, _<br />
EndTag as String) As String<br />
<br />
Dim ResultStr As String <br />
Return Regex.Replace(InputTxt, "\b(" & Regex.Escape(Search_Str) & ")\b", _<br />
StartTag & "$1" & EndTag, RegExOptions.IgnoreCase)<br />
End Function<br />
<br />
<br />
Sub searchQuotes(sender as Object, e as EventArgs)<br />
BindData(SearchTerm.Text)<br />
SearchResults.Visible = True<br />
End Sub<br />
</script><br />
<br />
<style type="text/css"><br />
.highlight {text-decoration: none;color:black;background:yellow;}<br />
</style><br />
<br />
<form runat="server"><br />
Text to Search: <asp:TextBox id="SearchTerm" runat="server" /><br />
<asp:button runat="server" Text="Search Woody Allen Quotes"<br />
OnClick="searchQuotes" /><br />
<p><br />
<asp:DataGrid runat="server" id="SearchResults" AutoGenerateColumns="False"<br />
Visible="False" ShowHeader="False"><br />
<Columns><br />
<asp:TemplateColumn><br />
<ItemTemplate><br />
<%# Highlight(searchword, DataBinder.Eval(Container.DataItem, "results"), "", "") %><br />
</ItemTemplate><br />
</asp:TemplateColumn><br />
</Columns><br />
</asp:DataGrid><br />
<p><br />
The Data Being Search<br />
<asp:datagrid runat="server" id="completeData" ShowHeader="False" /><br />
I imported this code in Visual studio.net and change on click events and other thing that they have to change but
there is a problem ! Framework said that error BC30390: 'webapplication1.webform1.searchwords' is not
accessible in this context because it is 'Private'.
any idea ?
onezero@gmail.com
|
|
|
|
|
So,try it in the COde-Behind file in the class level.
|
|
|
|
|
I've written a dynamic assembly loading mechanism using Memorystreams, that enables me to "hot" unload an assembly, and load a new version without needing to shutdown my executable.
I use Debug versions of my assemblies so that I can get StackTraces out of Exceptions if they occur, which works fine when I use a filebased load of the assembly.
Is there some way that I can tell .NET that my PDB files are in a Disk location, and the Assembly has been loaded from a memory stream?
BTW: This is using .NET Framework 1.1
|
|
|
|
|
Paul, Did you ever figure out how to do this? I am having the exact same issue. Thanks, Dave
Dave Kolb
http://dotnetcodeslingers.com
|
|
|
|
|
OK I figured it out - just use the other version of Load(byte[], byte[]) where the second byte array is the symbol stream!
Dave Kolb
http://dotnetcodeslingers.com
|
|
|
|