private void UpdateBitmap() { var bitmapdata = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, renderBuffer.width, renderBuffer.height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); if (bytes == null) { stride = Math.Abs(bitmapdata.Stride); bytes = new byte[stride * bitmapdata.Height]; } for (int i = 0; i < renderBuffer.width; i++) { for (int j = 0; j < renderBuffer.height; j++) { float4 color = renderBuffer.getPixel(i, j); int destidx = j * stride + i * 4; bytes[destidx + 0] = floatToByte(color.b); bytes[destidx + 1] = floatToByte(color.g); bytes[destidx + 2] = floatToByte(color.r); bytes[destidx + 3] = floatToByte(color.a); } } System.Runtime.InteropServices.Marshal.Copy(bytes, 0, bitmapdata.Scan0, bytes.Length); bitmap.UnlockBits(bitmapdata); control.Invalidate(); }
/// <summary> /// Called when the property changed. /// </summary> void _propertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e) { System.Windows.Forms.Control control = CadKit.Documents.Manager.Instance.ActiveView as System.Windows.Forms.Control; if (null != control) { control.Invalidate(true); } }
public virtual void MoveControl(Rectangle valueRect, PropertyEnumerator propEnum) { if (mInPlaceCtrl == null) { return; } valueRect.Height--; if (mInPlaceCtrl.Bounds != valueRect) { mInPlaceCtrl.Invalidate(); mInPlaceCtrl.Bounds = valueRect; } (mInPlaceCtrl as IInPlaceControl).RepositionChildren(); }
/// <summary> /// Called when the color changed. /// </summary> void _editorColorChanged(object sender, CadKit.Color.ColorChangedEventArgs args) { try { CadKit.Interfaces.IClearColor color = CadKit.Documents.Manager.Instance.ActiveView as CadKit.Interfaces.IClearColor; if (null != color) { color.ClearColor = args.Color; System.Windows.Forms.Control control = color as System.Windows.Forms.Control; if (null != control) { control.Invalidate(true); } } } catch (System.Exception e) { System.Console.WriteLine("Error 3571950654: {0}", e.Message); } }