Hi, yesterday I tried all day to update my article, I always get the same error. Can someone help me with this?
Andreoli Carlo
Posts
-
Impossibility to update my article -
Impossibility to update my articleMy article has been edited and now it contains a smaller mistake in the title. When I try to edit it the site says: Article Submission Wizard An error occurred while loading the article. Please refresh the page to retry. The article is this: Martix-style rain in C# with WPF[^] Where the title should say "Matrix" instead of "Martix" :)
-
1500x1500 image at 30fps on wpfOn a first try using
writeableBitmap.Lock();
unsafe {
Marshal.Copy(my_arrb_8bit
, 0
, writeableBitmap.BackBuffer
, img_w * img_h);
}// Specify the area of the bitmap that changed.
writeableBitmap.AddDirtyRect(new Int32Rect(0, 0, img_w, img_h));// Release the back buffer and make it available for display.
writeableBitmap.Unlock();seems to start working not yet at 30fps but almost there...thank you very much :)
-
1500x1500 image at 30fps on wpfHello, i'm moving my actual winform based application to WPF. My application acquire 1500x1500 8bit depth images at 30 frame per second. In winform i was used to BitBlt my images to a panel handle and that work fine. In wpf i tried two ways:
// on every frame:
int stride = img_w * ((PixelFormats.Gray8.BitsPerPixel + 7) / 8);
bmpSource = BitmapSource.Create(img_w, img_h, 96, 96, PixelFormats.Gray8, null, my_arrb_8bit, stride);this.Image1.Source = bmpSource;
but this is too slow...then i try
// on every frame:
int max = PixelFormats.Rgb24.BitsPerPixel;
uint count = (uint)(img_w * img_h * PixelFormats.Rgb24.BitsPerPixel / 8);
IntPtr section = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, FileMapProtection.PageReadWrite, 0, count, null);
IntPtr map = MapViewOfFile(section, FileMapAccess.FileMapAllAccess, 0, 0, (UIntPtr)count);System.Runtime.InteropServices.Marshal.Copy(my_arrb_24bit, 0, map, (int)count);
my_ibs = System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(
section,
(int)img_w,
(int)img_h,
PixelFormats.Rgb24,
(int)(img_w * PixelFormats.Rgb24.BitsPerPixel / 8), 0) as System.Windows.Interop.InteropBitmap;
this.Image1.Source = my_ibs;this is faster than the first solution, but still i can't manage to reach 30fps....am i doing something wrong? any suggestion?
-
1500 x 1500 fast image diplayingHello, i'm moving my actual winform based application to WPF. My application acquire 1500x1500 8bit depth images at 30 frame per second. In winform i was used to BitBlt my images to a panel handle and that work fine. In wpf i tried two ways:
// on every frame:
int stride = img_w * ((PixelFormats.Gray8.BitsPerPixel + 7) / 8);
bmpSource = BitmapSource.Create(img_w, img_h, 96, 96, PixelFormats.Gray8, null, my_arrb_8bit, stride);this.Image1.Source = bmpSource;
but this is too slow...then i try
// on every frame:
int max = PixelFormats.Rgb24.BitsPerPixel;
uint count = (uint)(img_w * img_h * PixelFormats.Rgb24.BitsPerPixel / 8);
IntPtr section = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, FileMapProtection.PageReadWrite, 0, count, null);
IntPtr map = MapViewOfFile(section, FileMapAccess.FileMapAllAccess, 0, 0, (UIntPtr)count);System.Runtime.InteropServices.Marshal.Copy(my_arrb_24bit, 0, map, (int)count);
my_ibs = System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(
section,
(int)img_w,
(int)img_h,
PixelFormats.Rgb24,
(int)(img_w * PixelFormats.Rgb24.BitsPerPixel / 8), 0) as System.Windows.Interop.InteropBitmap;
this.Image1.Source = my_ibs;this is faster than the first solution, but still i can't manage to reach 30fps....am i doing something wrong? any suggestion?
-
Cursor, converting code from vb.net to c++ok i get it if you wanna know
value class IconInfo
{
public:
bool fIcon;
Int32 xHotspot;
Int32 yHotspot;
IntPtr hbmMask;
IntPtr hbmColor;
}; -
Cursor, converting code from vb.net to c++hello i'm trying to convert this piece of code from vb
Private Structure IconInfo
Public fIcon As Boolean
Public xHotspot As Int32
Public yHotspot As Int32
Public hbmMask As IntPtr
Public hbmColor As IntPtr
End Structure<DllImport("user32.dll", EntryPoint:="CreateIconIndirect")> \_ Private Shared Function CreateIconIndirect(ByVal iconInfo As IntPtr) As IntPtr End Function <DllImport("user32.dll", CharSet:=CharSet.Auto)> \_ Public Shared Function DestroyIcon(ByVal handle As IntPtr) As Boolean End Function <DllImport("gdi32.dll")> \_ Public Shared Function DeleteObject(ByVal hObject As IntPtr) As Boolean End Function Public Function CreateCursor(ByVal bmp As Bitmap) As Cursor 'Setup the Cursors IconInfo Dim tmp As New IconInfo tmp.xHotspot = \_gHotSpotPt.X tmp.yHotspot = \_gHotSpotPt.Y tmp.fIcon = False If \_gBlackBitBack Then tmp.hbmMask = bmp.GetHbitmap(Color.FromArgb(0, 0, 0, 0)) tmp.hbmColor = bmp.GetHbitmap(Color.FromArgb(0, 0, 0, 0)) Else tmp.hbmMask = bmp.GetHbitmap() tmp.hbmColor = bmp.GetHbitmap() End If 'Create the Pointer for the Cursor Icon Dim pnt As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(tmp)) Marshal.StructureToPtr(tmp, pnt, True) Dim curPtr As IntPtr = CreateIconIndirect(pnt) 'Save the image of the cursor with the \_gBlackBitBack effect 'Not really needed for normal use. 'I use it to create a screen shot with the gCursor included \_gCursorImage = Icon.FromHandle(curPtr).ToBitmap 'Clean Up DestroyIcon(pnt) DeleteObject(tmp.hbmMask) DeleteObject(tmp.hbmColor) Return New Cursor(curPtr) End Function
By now i traslate the all thing into:
public struct IconInfo
{
bool fIcon;
int xHotspot;
int yHotspot;
System::IntPtr hbmMask;
System::IntPtr hbmColor;
};\[System::Runtime::InteropServices::DllImport("user32.dll, EntryPoint:=CreateIconIndirect")\] System::IntPtr CreateIconIndirect(System::IntPtr iconInfo); \[System::Runtime::InteropServices::DllImport("user32.dll, CharSet:=CharSet.Auto")\] bool DestroyIcon(System::IntPtr handle); \[System::Runtime::InteropServices::DllImport("gdi32.dll")\] bool DeleteObject(System::IntPtr handl);
System::Windows::Forms::Cursor ^CreateCurs
-
delete dataGridView row [modified]Explanation:
//wrong code for(int j =0;j<this->s_dataGridView->Rows->Count;j++) { this->s_dataGridView->Rows->RemoveAt(j); } //right code // the rows goes from 0 to count-1 for(int j =0;j<this->s_dataGridView->Rows->Count-1;j++) { this->s_dataGridView->Rows->RemoveAt(j); }
and again
//wrong code int j = this->s_dataGridView->RowCount; while(j<=0) { this->s_dataGridView->Rows->RemoveAt(j); rowCount --; } // right code int j = this->s_dataGridView->RowCount-1; while(j>=0) { this->s_dataGridView->Rows->RemoveAt(j); j--; }
-
Custom combo Box[modified]some line of code of what you have done till now would help
modified on Friday, June 25, 2010 7:48 AM
-
Multiple forms problem C++ / CLIthe problem come from this -> "Login form -> open form1 form , and form1.h has the others #include files just like "test1.h" and ect." the include file must be correct utilized cause they can lead to your problem. in an ideal world you should include the .h files like in a tree:
super\_main.h / \\ main1.h main2.h / \\
submain1_1.h submain1_2.h
where each .h have one .cpp with the operational code -- or -- there are some workaround like #ifndef #define ....code.... #endif to make life easier when implementing .h :)
-
Get the button click event from another formit was just the name i used...so no reason for that
-
Get the button click event from another formso....here we are: in form 1 substitute:
private: System::Void testbutton_click(System::Object^ sender, System::EventArgs^ e) { testlabel->Text = "new form open"; Form2^ popup = gcnew Form2(); popup->ShowDialog(); } private: void raised_event (System::Object^ sender, System::EventArgs^ e) { /* Get the text from the textbox on the other form */ Form2^ popup = gcnew Form2(); testlabel->Text = popup->textbox->Text; } }; // susbstitute with..... private: Form2^ popup; void testbutton_click(System::Object^ sender, System::EventArgs^ e) { testlabel->Text = "new form open"; popup = gcnew Form2(); popup->button_send->Click += gcnew EventHandler(this, &Form1::raised_event); popup->ShowDialog(); } void raised_event (System::Object^ sender, System::EventArgs^ e) { testlabel->Text = popup->textbox->Text; }
i'm pretty sure you'll understand my changes. Maybe it would be better to use delegates....i'll write you some code for that// form 1///////////////////////////////////////////////////////// #pragma once #include "Form2.h" namespace delete1 { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); } protected: ~Form1() { if (components) { delete components; } } private: void testbutton_click(System::Object^ sender, System::EventArgs^ e) { testlabel->Text = "new form open"; Form2^ popup = gcnew Form2(); popup->myPersonalDelegateCl += gcnew Form2::myPersonalDelegate(this,&Form1::raised_from_delegate); popup->ShowDialog(); } void raised_from_delegate (String ^txt) { this->testlabel->Text=txt; } System::Windows::Forms::Button^ testbutton; System::Windows::Forms::Label^ testlabel; System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code void InitializeComponent(void) { this->testbutton = (gcnew System::Windows::Forms::Button()); this->testlabel = (gcnew System::Windows::Forms::Label()); this->SuspendLayout(); /* Testbutton */ this->te
-
Get the button click event from another formthe code you write is actually....working....so...if you write here or post as attachment the full code i will check what's wrong :)
-
Incorporating a jpg image in .exe file -
List View Column delete [modified]what the "ListView_DeleteColumn" function do? it's not a .net function...so write the code here if you want an answer :doh:
-
Passing structure form VC++ to C# Dllthe structure (SCS3Over ) in c# dll is public? if it's public you can directly use it in visual c++ without having to redeclare it...so your visual c code:
//struct SCS3OverVwPg //{ // __int32 iOvrPgNo; // char sOvrPgTitle[30]; //OverView Page Title //}; void CToolTab::SendOverview() { //SCS3OverVwPg *pOverVw = 0; //pOverVw = new SCS3OverVwPg; Globals1::SCS3Over tmp; //use the correct namespace to go to SCS3Over tmp.iOvrPgNo=1; tmp.sOvrPgTitle="ciao"; Globals1::gwtoolbar->SetTree(tmp); }
-
How to call a method on another formgoogle for this....and you'll find the solution [DllImport("user32.dll")] extern IntPtr FindWindow(String^ lpClassName, String^ lpWindowName); once you have the pointer to the data's form, you have several way to get the data
-
How to call a method on another formis there some reletion between the first form and the second form.... do the first form generate the second form or the second form generate the first?
-
object to string (with 15 digit precision if decimal) [modified]try with the following: System::Convert::ToInt32 System::Convert::ToDouble System::Convert::To......
-
Invoking Event Handlers Programmatically?loaak at http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx[^] also...you black boxes give you the possibilities only to use the "control+c" key or they provide also some public function to do the operations? if they give also public function you can always try to static_cast or dynamic_cast the Control pointer...if this is your case this is far better than trigger the ctr+c command